threlte-minify 0.0.1 → 0.0.2
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/package.json +91 -61
- package/plugin/__tests__/compile.spec.ts +1 -0
- package/plugin/__tests__/extractImports.spec.ts +1 -0
- package/plugin/__tests__/findImportAlias.spec.ts +1 -0
- package/plugin/__tests__/hasDotComponent.spec.ts +1 -0
- package/plugin/__tests__/index.spec.ts +1 -0
- package/plugin/__tests__/insertImports.spec.ts +1 -0
- package/plugin/__tests__/replaceDotComponents.spec.ts +1 -0
- package/plugin/__tests__/stripScriptTags.spec.ts +1 -0
- package/plugin/__tests__/viteBuild.spec.ts +4 -3
- package/plugin/compile.js +2 -1
- package/plugin/extractExistingImports.js +1 -1
- package/plugin/hasDotComponent.js +2 -1
- package/plugin/index.js +1 -0
- package/plugin/insertImports.js +1 -0
- package/plugin/replaceDotComponents.js +2 -1
package/package.json
CHANGED
|
@@ -1,62 +1,92 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2
|
+
"name": "threlte-minify",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "A Vite plugin that reduces bundle size for Threlte and Three.js applications through deep tree-shaking and minification.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vite",
|
|
7
|
+
"vite-plugin",
|
|
8
|
+
"threlte",
|
|
9
|
+
"three",
|
|
10
|
+
"threejs",
|
|
11
|
+
"three.js",
|
|
12
|
+
"svelte",
|
|
13
|
+
"minify",
|
|
14
|
+
"tree-shaking",
|
|
15
|
+
"bundle-size",
|
|
16
|
+
"optimization",
|
|
17
|
+
"3d",
|
|
18
|
+
"webgl"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/michealparks/threlte-minify#readme",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/michealparks/threlte-minify.git"
|
|
24
|
+
},
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/michealparks/threlte-minify/issues"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Micheal Parks",
|
|
32
|
+
"email": "michealparks1989@gmail.com",
|
|
33
|
+
"url": "https://parks.lol"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18"
|
|
37
|
+
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"import": "./plugin/index.js",
|
|
40
|
+
"types": "./plugin/index.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"./plugin/*"
|
|
44
|
+
],
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@changesets/cli": "^2.30.0",
|
|
47
|
+
"@eslint/js": "^10.0.1",
|
|
48
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
49
|
+
"@sveltejs/kit": "^2.55.0",
|
|
50
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
51
|
+
"@threlte/core": "^8.5.5",
|
|
52
|
+
"@threlte/extras": "^9.14.2",
|
|
53
|
+
"@types/three": "^0.183.1",
|
|
54
|
+
"@yushijinhun/three-minifier-rollup": "^0.4.0",
|
|
55
|
+
"eslint": "^10.1.0",
|
|
56
|
+
"eslint-config-prettier": "^10.1.8",
|
|
57
|
+
"eslint-plugin-perfectionist": "^5.8.0",
|
|
58
|
+
"eslint-plugin-svelte": "^3.17.0",
|
|
59
|
+
"globals": "^17.4.0",
|
|
60
|
+
"prettier": "^3.8.1",
|
|
61
|
+
"prettier-plugin-svelte": "^3.5.1",
|
|
62
|
+
"svelte": "^5.55.1",
|
|
63
|
+
"svelte-check": "^4.4.6",
|
|
64
|
+
"three": "^0.183.2",
|
|
65
|
+
"typescript": "^6.0.2",
|
|
66
|
+
"typescript-eslint": "^8.58.0",
|
|
67
|
+
"vite": "^8.0.3",
|
|
68
|
+
"vitest": "^4.1.2"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"vite": ">=5.0.0"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"magic-string": "^0.30.21"
|
|
75
|
+
},
|
|
76
|
+
"type": "module",
|
|
77
|
+
"scripts": {
|
|
78
|
+
"dev": "vite dev --host",
|
|
79
|
+
"build": "vite build",
|
|
80
|
+
"build:null": "vite build --mode null",
|
|
81
|
+
"build:threlte": "vite build --mode threlte",
|
|
82
|
+
"build:three": "vite build --mode three",
|
|
83
|
+
"preview": "vite preview",
|
|
84
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
85
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
86
|
+
"lint": "prettier --check . && eslint .",
|
|
87
|
+
"format": "prettier --write . && eslint . --fix",
|
|
88
|
+
"stats": "node stats.js",
|
|
89
|
+
"test": "vitest",
|
|
90
|
+
"test:watch": "vitest --watch"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
2
|
-
import { join } from 'node:path'
|
|
3
|
-
import { afterEach, describe, expect, it } from 'vitest'
|
|
4
1
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
|
|
3
|
+
import { join } from 'node:path'
|
|
5
4
|
import { build } from 'vite'
|
|
5
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
6
|
+
|
|
6
7
|
import { threlteMinify } from '../index.js'
|
|
7
8
|
|
|
8
9
|
const tempDirs = new Set<string>()
|
package/plugin/compile.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import MagicString from 'magic-string'
|
|
2
|
-
import { insertImports } from './insertImports.js'
|
|
3
2
|
import { parse, preprocess } from 'svelte/compiler'
|
|
3
|
+
|
|
4
|
+
import { insertImports } from './insertImports.js'
|
|
4
5
|
import { replaceDotComponents } from './replaceDotComponents.js'
|
|
5
6
|
|
|
6
7
|
/**
|
package/plugin/index.js
CHANGED
package/plugin/insertImports.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import MagicString from 'magic-string'
|
|
2
|
-
import { findImportAlias } from './findImportAlias.js'
|
|
3
2
|
import { parse } from 'svelte/compiler'
|
|
4
3
|
|
|
4
|
+
import { findImportAlias } from './findImportAlias.js'
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
7
8
|
* @param {Set<string>} imports A list of imports from "THREE"
|