@ttsc/unplugin 0.8.1 → 0.10.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/README.md +8 -9
- package/lib/api.js +3 -2
- package/lib/api.js.map +1 -1
- package/lib/api.mjs +1 -1
- package/lib/bun.js +1 -1
- package/lib/bun.js.map +1 -1
- package/lib/bun.mjs +1 -1
- package/lib/bun.mjs.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.js +7 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/index.mjs +8 -4
- package/lib/core/index.mjs.map +1 -1
- package/lib/core/options.d.ts +3 -3
- package/lib/core/transform.d.ts +11 -3
- package/lib/core/transform.js +233 -80
- package/lib/core/transform.js.map +1 -1
- package/lib/core/transform.mjs +234 -63
- package/lib/core/transform.mjs.map +1 -1
- package/package.json +4 -7
- package/src/bun.ts +1 -1
- package/src/core/index.ts +14 -4
- package/src/core/options.ts +3 -3
- package/src/core/transform.ts +304 -66
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Bundler adapter for `ttsc` plugins.
|
|
13
13
|
|
|
14
|
-
Use it when Vite, Rollup, esbuild, Webpack, Rspack, Next.js, Farm, or Bun
|
|
14
|
+
Use it when Vite, Rollup, esbuild, Webpack, Rspack, Next.js, Farm, or Bun owns the build but the project still needs `ttsc` plugins.
|
|
15
15
|
|
|
16
16
|
## Setup
|
|
17
17
|
|
|
@@ -150,7 +150,7 @@ await Bun.build({
|
|
|
150
150
|
|
|
151
151
|
## Configuration
|
|
152
152
|
|
|
153
|
-
By default, `@ttsc/unplugin` finds the nearest `tsconfig.json` from the file being transformed and
|
|
153
|
+
By default, `@ttsc/unplugin` finds the nearest `tsconfig.json` from the file being transformed and uses that project's plugin settings, including directly installed plugin packages.
|
|
154
154
|
|
|
155
155
|
If that is already the config you want, `ttsc()` is enough.
|
|
156
156
|
|
|
@@ -188,7 +188,10 @@ export default {
|
|
|
188
188
|
transform: "@ttsc/lint",
|
|
189
189
|
config: { "no-var": "error" },
|
|
190
190
|
},
|
|
191
|
-
{
|
|
191
|
+
{
|
|
192
|
+
transform: "typia/lib/transform",
|
|
193
|
+
finite: true,
|
|
194
|
+
},
|
|
192
195
|
],
|
|
193
196
|
},
|
|
194
197
|
}),
|
|
@@ -200,7 +203,7 @@ export default {
|
|
|
200
203
|
|
|
201
204
|
### Plugin Overrides
|
|
202
205
|
|
|
203
|
-
Use the top-level `plugins` option inside `ttsc(...)` when the bundler should
|
|
206
|
+
Use the top-level `plugins` option inside `ttsc(...)` when the bundler should use a different plugin list from `tsconfig.json`:
|
|
204
207
|
|
|
205
208
|
```ts
|
|
206
209
|
import ttsc from "@ttsc/unplugin/vite";
|
|
@@ -217,11 +220,7 @@ export default {
|
|
|
217
220
|
};
|
|
218
221
|
```
|
|
219
222
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
1. `plugins` option.
|
|
223
|
-
2. `compilerOptions.plugins` option.
|
|
224
|
-
3. `compilerOptions.plugins` from `project` / discovered `tsconfig.json`.
|
|
223
|
+
Explicit adapter options override the plugin list read from the selected project config.
|
|
225
224
|
|
|
226
225
|
Set `plugins: false` to run the adapter without loading project plugins.
|
|
227
226
|
|
package/lib/api.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./core/index.js');
|
|
4
|
-
var options = require('./core/options.js');
|
|
5
4
|
var transform = require('./core/transform.js');
|
|
5
|
+
var options = require('./core/options.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
exports.unplugin = index.default;
|
|
10
|
-
exports.
|
|
10
|
+
exports.createTtscTransformCache = transform.createTtscTransformCache;
|
|
11
11
|
exports.transformTtsc = transform.transformTtsc;
|
|
12
|
+
exports.resolveOptions = options.resolveOptions;
|
|
12
13
|
//# sourceMappingURL=api.js.map
|
package/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/lib/api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as unplugin } from './core/index.mjs';
|
|
2
|
+
export { createTtscTransformCache, transformTtsc } from './core/transform.mjs';
|
|
2
3
|
export { resolveOptions } from './core/options.mjs';
|
|
3
|
-
export { transformTtsc } from './core/transform.mjs';
|
|
4
4
|
//# sourceMappingURL=api.mjs.map
|
package/lib/bun.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var fs = require('node:fs/promises');
|
|
6
6
|
var index = require('./core/index.js');
|
|
7
7
|
|
|
8
|
-
const sourceFilePattern = /\.[cm]?
|
|
8
|
+
const sourceFilePattern = /\.[cm]?tsx?$/;
|
|
9
9
|
function bun(options) {
|
|
10
10
|
return {
|
|
11
11
|
name: "ttsc-unplugin",
|
package/lib/bun.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.js","sources":["../src/bun.ts"],"sourcesContent":[null],"names":["unplugin"],"mappings":";;;;;;;AAkBA,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"bun.js","sources":["../src/bun.ts"],"sourcesContent":[null],"names":["unplugin"],"mappings":";;;;;;;AAkBA,MAAM,iBAAiB,GAAG,cAAc;AAE1B,SAAU,GAAG,CAAC,OAA6B,EAAA;IACvD,OAAO;AACL,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,CAAC,KAAK,EAAA;YACT,MAAM,GAAG,GAAGA,aAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,EAAyB,CAAC;AAC5D,YAAA,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,OAAO,IAAI,KAAI;AACzD,gBAAA,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AACnD,gBAAA,MAAM,MAAM,GACV,OAAO,GAAG,CAAC,SAAS,KAAK;AACvB,sBAAE,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAW,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI;sBACvD,SAAS;AACf,gBAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,oBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC7B;gBACA,IACE,OAAO,MAAM,KAAK,QAAQ;AAC1B,oBAAA,MAAM,KAAK,IAAI;AACf,oBAAA,MAAM,IAAI,MAAM;AAChB,oBAAA,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAC/B;AACA,oBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE;gBAClC;AACA,gBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC7B,YAAA,CAAC,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
package/lib/bun.mjs
CHANGED
package/lib/bun.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.mjs","sources":["../src/bun.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAkBA,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"bun.mjs","sources":["../src/bun.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAkBA,MAAM,iBAAiB,GAAG,cAAc;AAE1B,SAAU,GAAG,CAAC,OAA6B,EAAA;IACvD,OAAO;AACL,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,KAAK,CAAC,KAAK,EAAA;YACT,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,EAAyB,CAAC;AAC5D,YAAA,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,OAAO,IAAI,KAAI;AACzD,gBAAA,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AACnD,gBAAA,MAAM,MAAM,GACV,OAAO,GAAG,CAAC,SAAS,KAAK;AACvB,sBAAE,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,EAAW,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI;sBACvD,SAAS;AACf,gBAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,oBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC7B;gBACA,IACE,OAAO,MAAM,KAAK,QAAQ;AAC1B,oBAAA,MAAM,KAAK,IAAI;AACf,oBAAA,MAAM,IAAI,MAAM;AAChB,oBAAA,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAC/B;AACA,oBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE;gBAClC;AACA,gBAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC7B,YAAA,CAAC,CAAC;QACJ,CAAC;KACF;AACH;;;;"}
|
package/lib/core/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UnpluginInstance } from "unplugin";
|
|
2
2
|
import type { TtscUnpluginOptions } from "./options";
|
|
3
3
|
import { resolveOptions } from "./options";
|
|
4
|
-
import { transformTtsc } from "./transform";
|
|
4
|
+
import { createTtscTransformCache, transformTtsc } from "./transform";
|
|
5
5
|
declare const unplugin: UnpluginInstance<TtscUnpluginOptions | undefined, false>;
|
|
6
6
|
export type { TtscUnpluginCompilerOptionsJson, TtscUnpluginOptions, } from "./options";
|
|
7
|
-
export { resolveOptions, transformTtsc, unplugin };
|
|
7
|
+
export { createTtscTransformCache, resolveOptions, transformTtsc, unplugin };
|
|
8
8
|
export default unplugin;
|
package/lib/core/index.js
CHANGED
|
@@ -7,11 +7,12 @@ var options = require('./options.js');
|
|
|
7
7
|
var transform = require('./transform.js');
|
|
8
8
|
|
|
9
9
|
const name = "ttsc-unplugin";
|
|
10
|
-
const sourceFilePattern = /\.[cm]?
|
|
10
|
+
const sourceFilePattern = /\.[cm]?tsx?$/;
|
|
11
11
|
const nodeModulesPattern = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
|
|
12
12
|
const virtualModulePattern = /\0/;
|
|
13
13
|
const unpluginFactory = (rawOptions = {}) => {
|
|
14
14
|
const options$1 = options.resolveOptions(rawOptions);
|
|
15
|
+
const transformCache = transform.createTtscTransformCache();
|
|
15
16
|
let aliases;
|
|
16
17
|
return {
|
|
17
18
|
name,
|
|
@@ -21,6 +22,9 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
21
22
|
aliases = config.resolve.alias;
|
|
22
23
|
},
|
|
23
24
|
},
|
|
25
|
+
buildStart() {
|
|
26
|
+
transformCache.clear();
|
|
27
|
+
},
|
|
24
28
|
transformInclude(id) {
|
|
25
29
|
const file = transform.stripQuery(id);
|
|
26
30
|
return isTransformTarget(file);
|
|
@@ -30,7 +34,7 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
30
34
|
if (!isTransformTarget(file)) {
|
|
31
35
|
return undefined;
|
|
32
36
|
}
|
|
33
|
-
return transform.transformTtsc(file, source, options$1, aliases);
|
|
37
|
+
return transform.transformTtsc(file, source, options$1, aliases, transformCache);
|
|
34
38
|
},
|
|
35
39
|
};
|
|
36
40
|
};
|
|
@@ -43,6 +47,7 @@ function isTransformTarget(id) {
|
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
exports.resolveOptions = options.resolveOptions;
|
|
50
|
+
exports.createTtscTransformCache = transform.createTtscTransformCache;
|
|
46
51
|
exports.transformTtsc = transform.transformTtsc;
|
|
47
52
|
exports.default = unplugin;
|
|
48
53
|
exports.unplugin = unplugin;
|
package/lib/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":["options","resolveOptions","stripQuery","transformTtsc","createUnplugin","isDeclarationFile"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":["options","resolveOptions","createTtscTransformCache","stripQuery","transformTtsc","createUnplugin","isDeclarationFile"],"mappings":";;;;;;;;AAYA,MAAM,IAAI,GAAG,eAAe;AAC5B,MAAM,iBAAiB,GAAG,cAAc;AACxC,MAAM,kBAAkB,GAAG,oCAAoC;AAC/D,MAAM,oBAAoB,GAAG,IAAI;AAEjC,MAAM,eAAe,GAGjB,CAAC,UAAU,GAAG,EAAE,KAAI;AACtB,IAAA,MAAMA,SAAO,GAAGC,sBAAc,CAAC,UAAU,CAAC;AAC1C,IAAA,MAAM,cAAc,GAAGC,kCAAwB,EAAE;AACjD,IAAA,IAAI,OAAgB;IAEpB,OAAO;QACL,IAAI;AACJ,QAAA,OAAO,EAAE,KAAK;AAEd,QAAA,IAAI,EAAE;AACJ,YAAA,cAAc,CAAC,MAAM,EAAA;AACnB,gBAAA,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;YAChC,CAAC;AACF,SAAA;QAED,UAAU,GAAA;YACR,cAAc,CAAC,KAAK,EAAE;QACxB,CAAC;AAED,QAAA,gBAAgB,CAAC,EAAE,EAAA;AACjB,YAAA,MAAM,IAAI,GAAGC,oBAAU,CAAC,EAAE,CAAC;AAC3B,YAAA,OAAO,iBAAiB,CAAC,IAAI,CAAC;QAChC,CAAC;AAED,QAAA,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,EAAA;AACxB,YAAA,MAAM,IAAI,GAAGA,oBAAU,CAAC,EAAE,CAAC;AAC3B,YAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;AAC5B,gBAAA,OAAO,SAAS;YAClB;AACA,YAAA,OAAOC,uBAAa,CAAC,IAAI,EAAE,MAAM,EAAEJ,SAAO,EAAE,OAAO,EAAE,cAAc,CAAC;QACtE,CAAC;KACF;AACH,CAAC;AAED,MAAM,QAAQ,GACZK,yBAAc,CAAC,eAAe;AAUhC,SAAS,iBAAiB,CAAC,EAAU,EAAA;AACnC,IAAA,QACE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,QAAA,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,CAACC,2BAAiB,CAAC,EAAE,CAAC;AACtB,QAAA,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;AAEhC;;;;;;;;"}
|
package/lib/core/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { createUnplugin } from 'unplugin';
|
|
2
2
|
import { resolveOptions } from './options.mjs';
|
|
3
|
-
import { stripQuery, transformTtsc, isDeclarationFile } from './transform.mjs';
|
|
3
|
+
import { stripQuery, transformTtsc, isDeclarationFile, createTtscTransformCache } from './transform.mjs';
|
|
4
4
|
|
|
5
5
|
const name = "ttsc-unplugin";
|
|
6
|
-
const sourceFilePattern = /\.[cm]?
|
|
6
|
+
const sourceFilePattern = /\.[cm]?tsx?$/;
|
|
7
7
|
const nodeModulesPattern = /(?:^|[/\\])node_modules(?:[/\\]|$)/;
|
|
8
8
|
const virtualModulePattern = /\0/;
|
|
9
9
|
const unpluginFactory = (rawOptions = {}) => {
|
|
10
10
|
const options = resolveOptions(rawOptions);
|
|
11
|
+
const transformCache = createTtscTransformCache();
|
|
11
12
|
let aliases;
|
|
12
13
|
return {
|
|
13
14
|
name,
|
|
@@ -17,6 +18,9 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
17
18
|
aliases = config.resolve.alias;
|
|
18
19
|
},
|
|
19
20
|
},
|
|
21
|
+
buildStart() {
|
|
22
|
+
transformCache.clear();
|
|
23
|
+
},
|
|
20
24
|
transformInclude(id) {
|
|
21
25
|
const file = stripQuery(id);
|
|
22
26
|
return isTransformTarget(file);
|
|
@@ -26,7 +30,7 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
26
30
|
if (!isTransformTarget(file)) {
|
|
27
31
|
return undefined;
|
|
28
32
|
}
|
|
29
|
-
return transformTtsc(file, source, options, aliases);
|
|
33
|
+
return transformTtsc(file, source, options, aliases, transformCache);
|
|
30
34
|
},
|
|
31
35
|
};
|
|
32
36
|
};
|
|
@@ -38,5 +42,5 @@ function isTransformTarget(id) {
|
|
|
38
42
|
!nodeModulesPattern.test(id));
|
|
39
43
|
}
|
|
40
44
|
|
|
41
|
-
export { unplugin as default, resolveOptions, transformTtsc, unplugin };
|
|
45
|
+
export { createTtscTransformCache, unplugin as default, resolveOptions, transformTtsc, unplugin };
|
|
42
46
|
//# sourceMappingURL=index.mjs.map
|
package/lib/core/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/core/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAYA,MAAM,IAAI,GAAG,eAAe;AAC5B,MAAM,iBAAiB,GAAG,cAAc;AACxC,MAAM,kBAAkB,GAAG,oCAAoC;AAC/D,MAAM,oBAAoB,GAAG,IAAI;AAEjC,MAAM,eAAe,GAGjB,CAAC,UAAU,GAAG,EAAE,KAAI;AACtB,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC;AAC1C,IAAA,MAAM,cAAc,GAAG,wBAAwB,EAAE;AACjD,IAAA,IAAI,OAAgB;IAEpB,OAAO;QACL,IAAI;AACJ,QAAA,OAAO,EAAE,KAAK;AAEd,QAAA,IAAI,EAAE;AACJ,YAAA,cAAc,CAAC,MAAM,EAAA;AACnB,gBAAA,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;YAChC,CAAC;AACF,SAAA;QAED,UAAU,GAAA;YACR,cAAc,CAAC,KAAK,EAAE;QACxB,CAAC;AAED,QAAA,gBAAgB,CAAC,EAAE,EAAA;AACjB,YAAA,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC;AAC3B,YAAA,OAAO,iBAAiB,CAAC,IAAI,CAAC;QAChC,CAAC;AAED,QAAA,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,EAAA;AACxB,YAAA,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC;AAC3B,YAAA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE;AAC5B,gBAAA,OAAO,SAAS;YAClB;AACA,YAAA,OAAO,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC;QACtE,CAAC;KACF;AACH,CAAC;AAED,MAAM,QAAQ,GACZ,cAAc,CAAC,eAAe;AAUhC,SAAS,iBAAiB,CAAC,EAAU,EAAA;AACnC,IAAA,QACE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,QAAA,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,CAAC,iBAAiB,CAAC,EAAE,CAAC;AACtB,QAAA,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;AAEhC;;;;"}
|
package/lib/core/options.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export interface TtscUnpluginOptions {
|
|
|
18
18
|
/**
|
|
19
19
|
* `ttsc` plugin entries.
|
|
20
20
|
*
|
|
21
|
-
* `undefined` reads `compilerOptions.plugins`
|
|
22
|
-
* `false` disables project plugins, and
|
|
23
|
-
* plugin list.
|
|
21
|
+
* `undefined` reads project plugins from `compilerOptions.plugins` and
|
|
22
|
+
* directly installed package markers, `false` disables project plugins, and
|
|
23
|
+
* an array overrides the project plugin list.
|
|
24
24
|
*/
|
|
25
25
|
plugins?: readonly ITtscProjectPluginConfig[] | false;
|
|
26
26
|
}
|
package/lib/core/transform.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import type { ITtscCompilerTransformation } from "ttsc";
|
|
1
2
|
import type { TransformResult } from "unplugin";
|
|
2
3
|
import type { ResolvedTtscUnpluginOptions } from "./options";
|
|
3
4
|
export type TtscTransformResult = Exclude<TransformResult, string | null | undefined>;
|
|
4
5
|
export interface TtscTransformAlias {
|
|
5
|
-
find: string
|
|
6
|
+
find: string;
|
|
6
7
|
replacement: string;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
+
export interface TtscCachedProjectTransform {
|
|
10
|
+
inputHashes: Record<string, string>;
|
|
11
|
+
projectRoot: string;
|
|
12
|
+
result: ITtscCompilerTransformation;
|
|
13
|
+
}
|
|
14
|
+
export type TtscTransformCache = Map<string, Promise<TtscCachedProjectTransform>>;
|
|
15
|
+
export declare function createTtscTransformCache(): TtscTransformCache;
|
|
16
|
+
export declare function transformTtsc(id: string, source: string, options: ResolvedTtscUnpluginOptions, aliases?: unknown, cache?: TtscTransformCache): Promise<TtscTransformResult | undefined>;
|
|
9
17
|
export declare function stripQuery(id: string): string;
|
|
10
18
|
export declare function isDeclarationFile(id: string): boolean;
|
|
11
|
-
export declare function createTransformResult(source: string, code: string
|
|
19
|
+
export declare function createTransformResult(source: string, code: string): TtscTransformResult | undefined;
|