Skip to content

Commit

Permalink
Simplify codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Apr 7, 2023
1 parent 050dcdc commit 5d9f088
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 1,097 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
- name: Checkout repo
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2

- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Test
run: pnpm install
- name: Lint
run: pnpm lint
- name: Run tests
run: pnpm test
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
dist
test/Output.svelte
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Import assets directly in the markup.
Install with your package manager:

```bash
npm install svelte-preprocess-import-assets
npm install --save-dev svelte-preprocess-import-assets
```

Include the preprocessor in your bundler's Svelte plugin `preprocess` option:

```js
import importAssets from 'svelte-preprocess-import-assets'
import { importAssets } from 'svelte-preprocess-import-assets'

svelte({ preprocess: [importAssets()] })

Expand All @@ -42,8 +42,6 @@ export default {
}
```

[Here is more information](https://github.com/sveltejs/svelte-preprocess/blob/main/docs/usage.md) on how to integrate it with your bundler.

## API

The `importAssets()` function receives an optional options object for its first parameter. The object may contain these properties:
Expand All @@ -68,7 +66,7 @@ The `importAssets()` function receives an optional options object for its first
}
```

- **Default:** See `DEFAULT_SOURCES` in [src/constants.ts](./src/constants.ts)
- **Default:** See `DEFAULT_SOURCES` in [src/constants.js](./src/constants.js)

These are the sources to look for when scanning for imports. You can provide an entirely different list of sources, or declare a function to access the default sources and augment it. The supported tags and attributes are based on [html-loader](https://github.com/webpack-contrib/html-loader#sources) (except `icon-uri`). Component name as `tag` is also supported.

Expand Down
45 changes: 22 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@
"version": "0.2.6",
"license": "MIT",
"author": "Bjorn Lu",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"type": "module",
"types": "index.d.ts",
"typesVersions": {
"*": {
"*": [
"src/*"
]
}
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"types": "./src/index.d.ts",
"default": "./src/index.js"
}
},
"files": [
"dist"
"src"
],
"homepage": "https://github.com/bluwy/svelte-preprocess-import-assets",
"repository": {
"type": "git",
"url": "https://github.com/bluwy/svelte-preprocess-import-assets.git"
Expand All @@ -32,13 +36,12 @@
"assets"
],
"scripts": {
"build": "tsc && tsup src/index.ts --dts --no-splitting --format esm,cjs",
"test": "tsm test/index.ts",
"test:update": "tsm test/index.ts -u",
"format": "prettier -w {src,test}/**/*",
"prepublishOnly": "rm -rf dist && pnpm build"
"lint": "prettier \"**/*.{js,ts,css,md,svelte}\" --check --cache",
"format": "prettier \"**/*.{js,ts,css,md,svelte}\" --write --cache",
"test": "node tests/index.js",
"test-update": "node tests/index.js"
},
"packageManager": "pnpm@7.13.0",
"packageManager": "pnpm@8.1.0",
"dependencies": {
"magic-string": "^0.30.0",
"svelte-parse-markup": "^0.1.1"
Expand All @@ -47,15 +50,11 @@
"svelte": "^3.37.0"
},
"devDependencies": {
"@types/node": "^18.14.0",
"prettier": "^2.8.4",
"prettier-plugin-svelte": "^2.9.0",
"sass": "^1.58.3",
"svelte": "^3.55.1",
"svelte-preprocess": "^5.0.1",
"tsm": "^2.3.0",
"tsup": "^6.6.3",
"typescript": "^4.9.5",
"prettier": "^2.8.7",
"prettier-plugin-svelte": "^2.10.0",
"sass": "^1.61.0",
"svelte": "^3.58.0",
"svelte-preprocess": "^5.0.3",
"uvu": "^0.5.6"
}
}
Loading

0 comments on commit 5d9f088

Please sign in to comment.