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 CHANGED
@@ -1,62 +1,92 @@
1
1
  {
2
- "name": "threlte-minify",
3
- "version": "0.0.1",
4
- "description": "A vite plugin to better minify Threlte apps.",
5
- "keywords": [
6
- "Threlte"
7
- ],
8
- "license": "MIT",
9
- "author": {
10
- "name": "Micheal Parks",
11
- "email": "michealparks1989@gmail.com",
12
- "url": "https://parks.lol"
13
- },
14
- "exports": {
15
- "import": "./plugin/index.js",
16
- "types": "./plugin/index.d.ts"
17
- },
18
- "files": [
19
- "./plugin/*"
20
- ],
21
- "scripts": {
22
- "dev": "vite dev --host",
23
- "build": "vite build",
24
- "build:null": "vite build --mode null",
25
- "build:threlte": "vite build --mode threlte",
26
- "build:three": "vite build --mode three",
27
- "preview": "vite preview",
28
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
30
- "lint": "prettier --check . && eslint .",
31
- "format": "prettier --write .",
32
- "stats": "node stats.js",
33
- "test": "vitest",
34
- "test:watch": "vitest --watch"
35
- },
36
- "devDependencies": {
37
- "@changesets/cli": "^2.30.0",
38
- "@sveltejs/adapter-auto": "^3.2.1",
39
- "@sveltejs/kit": "^2.55.0",
40
- "@sveltejs/vite-plugin-svelte": "^6.2.4",
41
- "@threlte/core": "^8.5.0",
42
- "@threlte/extras": "^9.14.0",
43
- "@types/three": "^0.183.0",
44
- "@yushijinhun/three-minifier-rollup": "^0.4.0",
45
- "eslint": "^9.0.0",
46
- "eslint-config-prettier": "^10.0.0",
47
- "eslint-plugin-svelte": "^3.0.0",
48
- "prettier": "^3.2.5",
49
- "prettier-plugin-svelte": "^3.2.3",
50
- "svelte": "^5.55.0",
51
- "svelte-check": "^4.0.0",
52
- "three": "^0.183.0",
53
- "typescript": "^5.4.5",
54
- "vite": "^6.3.0",
55
- "vitest": "^3.0.0"
56
- },
57
- "dependencies": {
58
- "magic-string": "^0.30.10"
59
- },
60
- "type": "module",
61
- "packageManager": "pnpm@10.29.3"
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,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { compile } from '../compile.js'
3
4
 
4
5
  describe('compile', () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { extractExistingImports } from '../extractExistingImports.js'
3
4
 
4
5
  describe('extractExistingImports', () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { findImportAlias } from '../findImportAlias.js'
3
4
 
4
5
  describe('findImportAlias', () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { hasDotComponent } from '../hasDotComponent.js'
3
4
 
4
5
  describe('hasDotComponent', () => {
@@ -1,6 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises'
2
2
  import { resolve } from 'node:path'
3
3
  import { describe, expect, it } from 'vitest'
4
+
4
5
  import { threlteMinify } from '../index.js'
5
6
 
6
7
  const getTransform = () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { insertImports } from '../insertImports.js'
3
4
 
4
5
  describe('insertImports', () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { replaceDotComponents } from '../replaceDotComponents.js'
3
4
 
4
5
  describe('replaceDotComponents', () => {
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest'
2
+
2
3
  import { stripScriptTags } from '../stripScriptTags.js'
3
4
 
4
5
  describe('stripScriptTags', () => {
@@ -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
  /**
@@ -11,7 +11,7 @@ export const extractExistingImports = (code, moduleName) => {
11
11
  /**
12
12
  * @type {RegExpExecArray | null}
13
13
  */
14
- let match = null
14
+ let match
15
15
 
16
16
  /**
17
17
  * @type {Set<string>}
@@ -1,5 +1,6 @@
1
- import { findImportAlias } from './findImportAlias.js'
2
1
  import { parse } from 'svelte/compiler'
2
+
3
+ import { findImportAlias } from './findImportAlias.js'
3
4
  import { stripScriptTags } from './stripScriptTags.js'
4
5
 
5
6
  /**
package/plugin/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import MagicString from 'magic-string'
2
+
2
3
  import { compile } from './compile.js'
3
4
  import { hasDotComponent } from './hasDotComponent.js'
4
5
 
@@ -1,4 +1,5 @@
1
1
  import MagicString from 'magic-string'
2
+
2
3
  import { extractExistingImports } from './extractExistingImports.js'
3
4
 
4
5
  /**
@@ -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"