@textadventures/vite-plugin-squiffy 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +29 -0
- package/dist/types.d.ts +5 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import './types';
|
|
2
|
+
import { compileFile } from 'squiffy-packager';
|
|
3
|
+
export default function squiffyPlugin(options = {}) {
|
|
4
|
+
const { verbose = false } = options;
|
|
5
|
+
return {
|
|
6
|
+
name: 'vite-plugin-squiffy',
|
|
7
|
+
enforce: 'pre', // run before other transforms that might depend on output
|
|
8
|
+
async transform(code, id) {
|
|
9
|
+
if (!id.endsWith('.squiffy'))
|
|
10
|
+
return null;
|
|
11
|
+
if (verbose) {
|
|
12
|
+
this.warn(`vite-plugin-squiffy: transforming ${id}`);
|
|
13
|
+
}
|
|
14
|
+
const result = await compileFile(id);
|
|
15
|
+
if (result == null)
|
|
16
|
+
return null;
|
|
17
|
+
return {
|
|
18
|
+
code: result,
|
|
19
|
+
map: null,
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
// Optional: so users can import *.squiffy without adding `assetsInclude` themselves
|
|
23
|
+
config() {
|
|
24
|
+
return {
|
|
25
|
+
assetsInclude: ['**/*.squiffy'],
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
package/dist/types.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@textadventures/vite-plugin-squiffy",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vite plugin to compile .squiffy files",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/types.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json && shx cp src/types.d.ts ./dist/",
|
|
22
|
+
"dev": "tsc -w -p tsconfig.json",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"author": "Alex Warren",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"squiffy-packager": "^6.0.0-alpha.5"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"vite": "^7.1.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"shx": "^0.4.0",
|
|
38
|
+
"typescript": "^5.9.2"
|
|
39
|
+
}
|
|
40
|
+
}
|