wc-compiler 0.16.0 → 0.17.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 +2 -8
- package/package.json +26 -19
- package/src/dom-shim.js +1 -3
- package/src/index.d.ts +19 -0
- package/src/jsx-loader.js +15 -7
- package/src/register.js +3 -0
- package/src/wcc.js +22 -17
- package/dist/wcc.dist.cjs +0 -32811
- package/src/ts-loader.js +0 -32
package/src/ts-loader.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import { transform } from 'sucrase';
|
|
3
|
-
|
|
4
|
-
const tsRegex = /\.(ts)$/;
|
|
5
|
-
|
|
6
|
-
export function resolve(specifier, context, defaultResolve) {
|
|
7
|
-
const { parentURL } = context;
|
|
8
|
-
|
|
9
|
-
if (tsRegex.test(specifier)) {
|
|
10
|
-
return {
|
|
11
|
-
url: new URL(specifier, parentURL).href,
|
|
12
|
-
shortCircuit: true
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return defaultResolve(specifier, context, defaultResolve);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function load(url, context, defaultLoad) {
|
|
20
|
-
if (tsRegex.test(url)) {
|
|
21
|
-
const contents = await fs.readFile(new URL(url), 'utf-8');
|
|
22
|
-
const result = transform(contents, { transforms: ['typescript'] });
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
format: 'module',
|
|
26
|
-
shortCircuit: true,
|
|
27
|
-
source: result.code
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return defaultLoad(url, context, defaultLoad);
|
|
32
|
-
}
|