@ttsc/unplugin 0.8.0 → 0.8.1

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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -7
  3. package/lib/api.js +12 -18
  4. package/lib/api.js.map +1 -1
  5. package/lib/api.mjs +4 -0
  6. package/lib/api.mjs.map +1 -0
  7. package/lib/bun.js +12 -11
  8. package/lib/bun.js.map +1 -1
  9. package/lib/bun.mjs +31 -0
  10. package/lib/bun.mjs.map +1 -0
  11. package/lib/core/index.js +22 -17
  12. package/lib/core/index.js.map +1 -1
  13. package/lib/core/index.mjs +42 -0
  14. package/lib/core/index.mjs.map +1 -0
  15. package/lib/core/options.js +5 -5
  16. package/lib/core/options.js.map +1 -1
  17. package/lib/core/options.mjs +14 -0
  18. package/lib/core/options.mjs.map +1 -0
  19. package/lib/core/transform.js +62 -73
  20. package/lib/core/transform.js.map +1 -1
  21. package/lib/core/transform.mjs +272 -0
  22. package/lib/core/transform.mjs.map +1 -0
  23. package/lib/esbuild.js +9 -8
  24. package/lib/esbuild.js.map +1 -1
  25. package/lib/esbuild.mjs +6 -0
  26. package/lib/esbuild.mjs.map +1 -0
  27. package/lib/farm.js +9 -8
  28. package/lib/farm.js.map +1 -1
  29. package/lib/farm.mjs +6 -0
  30. package/lib/farm.mjs.map +1 -0
  31. package/lib/index.js +10 -8
  32. package/lib/index.js.map +1 -1
  33. package/lib/index.mjs +6 -0
  34. package/lib/index.mjs.map +1 -0
  35. package/lib/next.js +10 -9
  36. package/lib/next.js.map +1 -1
  37. package/lib/next.mjs +18 -0
  38. package/lib/next.mjs.map +1 -0
  39. package/lib/rolldown.js +9 -8
  40. package/lib/rolldown.js.map +1 -1
  41. package/lib/rolldown.mjs +6 -0
  42. package/lib/rolldown.mjs.map +1 -0
  43. package/lib/rollup.js +9 -8
  44. package/lib/rollup.js.map +1 -1
  45. package/lib/rollup.mjs +6 -0
  46. package/lib/rollup.mjs.map +1 -0
  47. package/lib/rspack.js +9 -8
  48. package/lib/rspack.js.map +1 -1
  49. package/lib/rspack.mjs +6 -0
  50. package/lib/rspack.mjs.map +1 -0
  51. package/lib/vite.js +9 -8
  52. package/lib/vite.js.map +1 -1
  53. package/lib/vite.mjs +6 -0
  54. package/lib/vite.mjs.map +1 -0
  55. package/lib/webpack.js +9 -8
  56. package/lib/webpack.js.map +1 -1
  57. package/lib/webpack.mjs +6 -0
  58. package/lib/webpack.mjs.map +1 -0
  59. package/package.json +31 -16
  60. package/src/core/index.ts +2 -0
  61. package/src/core/transform.ts +5 -1
package/lib/vite.js CHANGED
@@ -1,9 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const index_1 = __importDefault(require("./core/index"));
7
- const vite = index_1.default.vite;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = require('./core/index.js');
6
+
7
+ const vite = index.default.vite;
8
+
8
9
  exports.default = vite;
9
- //# sourceMappingURL=vite.js.map
10
+ //# sourceMappingURL=vite.js.map
package/lib/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":";;;;;AAAA,yDAAoC;AAEpC,MAAM,IAAI,GAAyB,eAAQ,CAAC,IAAI,CAAC;kBAElC,IAAI"}
1
+ {"version":3,"file":"vite.js","sources":["../src/vite.ts"],"sourcesContent":[null],"names":["unplugin"],"mappings":";;;;;;AAEA,MAAM,IAAI,GAAyBA,aAAQ,CAAC;;;;"}
package/lib/vite.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import unplugin from './core/index.mjs';
2
+
3
+ const vite = unplugin.vite;
4
+
5
+ export { vite as default };
6
+ //# sourceMappingURL=vite.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.mjs","sources":["../src/vite.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,MAAM,IAAI,GAAyB,QAAQ,CAAC;;;;"}
package/lib/webpack.js CHANGED
@@ -1,9 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const index_1 = __importDefault(require("./core/index"));
7
- const webpack = index_1.default.webpack;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var index = require('./core/index.js');
6
+
7
+ const webpack = index.default.webpack;
8
+
8
9
  exports.default = webpack;
9
- //# sourceMappingURL=webpack.js.map
10
+ //# sourceMappingURL=webpack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":";;;;;AAAA,yDAAoC;AAEpC,MAAM,OAAO,GAA4B,eAAQ,CAAC,OAAO,CAAC;kBAE3C,OAAO"}
1
+ {"version":3,"file":"webpack.js","sources":["../src/webpack.ts"],"sourcesContent":[null],"names":["unplugin"],"mappings":";;;;;;AAEA,MAAM,OAAO,GAA4BA,aAAQ,CAAC;;;;"}
@@ -0,0 +1,6 @@
1
+ import unplugin from './core/index.mjs';
2
+
3
+ const webpack = unplugin.webpack;
4
+
5
+ export { webpack as default };
6
+ //# sourceMappingURL=webpack.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.mjs","sources":["../src/webpack.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,MAAM,OAAO,GAA4B,QAAQ,CAAC;;;;"}
package/package.json CHANGED
@@ -1,52 +1,64 @@
1
1
  {
2
2
  "name": "@ttsc/unplugin",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Bundler adapters for ttsc plugins.",
5
5
  "main": "lib/index.js",
6
+ "module": "lib/index.mjs",
6
7
  "types": "lib/index.d.ts",
7
8
  "exports": {
8
9
  ".": {
9
10
  "types": "./lib/index.d.ts",
11
+ "import": "./lib/index.mjs",
10
12
  "default": "./lib/index.js"
11
13
  },
12
14
  "./api": {
13
15
  "types": "./lib/api.d.ts",
16
+ "import": "./lib/api.mjs",
14
17
  "default": "./lib/api.js"
15
18
  },
16
19
  "./bun": {
17
20
  "types": "./lib/bun.d.ts",
21
+ "import": "./lib/bun.mjs",
18
22
  "default": "./lib/bun.js"
19
23
  },
20
24
  "./esbuild": {
21
25
  "types": "./lib/esbuild.d.ts",
26
+ "import": "./lib/esbuild.mjs",
22
27
  "default": "./lib/esbuild.js"
23
28
  },
24
29
  "./farm": {
25
30
  "types": "./lib/farm.d.ts",
31
+ "import": "./lib/farm.mjs",
26
32
  "default": "./lib/farm.js"
27
33
  },
28
34
  "./next": {
29
35
  "types": "./lib/next.d.ts",
36
+ "import": "./lib/next.mjs",
30
37
  "default": "./lib/next.js"
31
38
  },
32
39
  "./rolldown": {
33
40
  "types": "./lib/rolldown.d.ts",
41
+ "import": "./lib/rolldown.mjs",
34
42
  "default": "./lib/rolldown.js"
35
43
  },
36
44
  "./rollup": {
37
45
  "types": "./lib/rollup.d.ts",
46
+ "import": "./lib/rollup.mjs",
38
47
  "default": "./lib/rollup.js"
39
48
  },
40
49
  "./rspack": {
41
50
  "types": "./lib/rspack.d.ts",
51
+ "import": "./lib/rspack.mjs",
42
52
  "default": "./lib/rspack.js"
43
53
  },
44
54
  "./vite": {
45
55
  "types": "./lib/vite.d.ts",
56
+ "import": "./lib/vite.mjs",
46
57
  "default": "./lib/vite.js"
47
58
  },
48
59
  "./webpack": {
49
60
  "types": "./lib/webpack.d.ts",
61
+ "import": "./lib/webpack.mjs",
50
62
  "default": "./lib/webpack.js"
51
63
  },
52
64
  "./package.json": "./package.json"
@@ -54,10 +66,6 @@
54
66
  "publishConfig": {
55
67
  "access": "public"
56
68
  },
57
- "scripts": {
58
- "build": "rimraf lib && tsgo",
59
- "test": "pnpm run build && node --test --test-reporter=spec ../../tests/unplugin/**/*.test.cjs"
60
- },
61
69
  "keywords": [
62
70
  "ttsc",
63
71
  "unplugin",
@@ -78,18 +86,22 @@
78
86
  "magic-string": "^0.30.21",
79
87
  "unplugin": "^2.3.11"
80
88
  },
81
- "peerDependencies": {
82
- "@typescript/native-preview": ">=7.0.0-dev.0",
83
- "ttsc": "^0.8.0"
84
- },
85
89
  "devDependencies": {
86
- "@types/node": "catalog:utils",
87
- "@typescript/native-preview": "catalog:tsgo",
90
+ "@rollup/plugin-commonjs": "^29.0.2",
91
+ "@rollup/plugin-node-resolve": "^16.0.3",
92
+ "@rollup/plugin-typescript": "^12.3.0",
93
+ "@types/node": "^25.3.0",
94
+ "@typescript/native-preview": "7.0.0-dev.20260506.1",
88
95
  "esbuild": "^0.25.12",
89
- "rimraf": "catalog:utils",
96
+ "rimraf": "^6.1.2",
90
97
  "rollup": "^4.60.3",
91
- "ttsc": "workspace:*",
92
- "vite": "^7.1.12"
98
+ "rollup-plugin-auto-external": "^2.0.0",
99
+ "rollup-plugin-node-externals": "^9.0.1",
100
+ "tinyglobby": "^0.2.16",
101
+ "tslib": "^2.8.1",
102
+ "typescript": "^6.0.3",
103
+ "vite": "^7.1.12",
104
+ "ttsc": "0.8.1"
93
105
  },
94
106
  "repository": {
95
107
  "type": "git",
@@ -102,5 +114,8 @@
102
114
  },
103
115
  "homepage": "https://github.com/samchon/ttsc/tree/master/packages/unplugin#readme",
104
116
  "sideEffects": false,
105
- "packageManager": "pnpm@10.6.4"
106
- }
117
+ "scripts": {
118
+ "build": "rimraf lib && tsgo --emitDeclarationOnly && rollup -c",
119
+ "test": "pnpm --dir ../.. --filter ttsc build && pnpm run build && node --test --test-reporter=spec ../../tests/unplugin/**/*.test.cjs"
120
+ }
121
+ }
package/src/core/index.ts CHANGED
@@ -8,6 +8,7 @@ import { isDeclarationFile, stripQuery, transformTtsc } from "./transform";
8
8
  const name = "ttsc-unplugin";
9
9
  const sourceFilePattern = /\.[cm]?[jt]sx?$/;
10
10
  const nodeModulesPattern = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
11
+ const virtualModulePattern = /\0/;
11
12
 
12
13
  const unpluginFactory: UnpluginFactory<
13
14
  TtscUnpluginOptions | undefined,
@@ -55,6 +56,7 @@ export default unplugin;
55
56
  function isTransformTarget(id: string): boolean {
56
57
  return (
57
58
  sourceFilePattern.test(id) &&
59
+ !virtualModulePattern.test(id) &&
58
60
  !isDeclarationFile(id) &&
59
61
  !nodeModulesPattern.test(id)
60
62
  );
@@ -27,7 +27,11 @@ export async function transformTtsc(
27
27
  options: ResolvedTtscUnpluginOptions,
28
28
  aliases?: unknown,
29
29
  ): Promise<TtscTransformResult | undefined> {
30
- const file = path.resolve(stripQuery(id));
30
+ const clean = stripQuery(id);
31
+ if (clean.includes("\0")) {
32
+ return undefined;
33
+ }
34
+ const file = path.resolve(clean);
31
35
  if (isDeclarationFile(file)) {
32
36
  return undefined;
33
37
  }