@nativescript/vite 0.0.1-alpha.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/dist/configuration/angular.d.ts +4 -0
- package/dist/configuration/angular.js +30 -0
- package/dist/configuration/base.d.ts +4 -0
- package/dist/configuration/base.js +270 -0
- package/dist/configuration/old-without-merge-base.d.ts +13 -0
- package/dist/configuration/old-without-merge-base.js +249 -0
- package/dist/configuration/react.d.ts +4 -0
- package/dist/configuration/react.js +85 -0
- package/dist/configuration/solid.d.ts +4 -0
- package/dist/configuration/solid.js +48 -0
- package/dist/configuration/vue.d.ts +4 -0
- package/dist/configuration/vue.js +45 -0
- package/dist/helpers/commonjs-plugins.d.ts +6 -0
- package/dist/helpers/commonjs-plugins.js +75 -0
- package/dist/helpers/config-as-json.d.ts +2 -0
- package/dist/helpers/config-as-json.js +35 -0
- package/dist/helpers/css-tree.d.ts +4 -0
- package/dist/helpers/css-tree.js +21 -0
- package/dist/helpers/dynamic-import-plugin.d.ts +4 -0
- package/dist/helpers/dynamic-import-plugin.js +62 -0
- package/dist/helpers/external-configs.d.ts +6 -0
- package/dist/helpers/external-configs.js +33 -0
- package/dist/helpers/flavor.d.ts +5 -0
- package/dist/helpers/flavor.js +40 -0
- package/dist/helpers/global-defines.d.ts +14 -0
- package/dist/helpers/global-defines.js +18 -0
- package/dist/helpers/main-entry.d.ts +5 -0
- package/dist/helpers/main-entry.js +75 -0
- package/dist/helpers/module-resolution.d.ts +1 -0
- package/dist/helpers/module-resolution.js +17 -0
- package/dist/helpers/nativescript-package-resolver.d.ts +5 -0
- package/dist/helpers/nativescript-package-resolver.js +139 -0
- package/dist/helpers/ns-cli-plugins.d.ts +19 -0
- package/dist/helpers/ns-cli-plugins.js +162 -0
- package/dist/helpers/package-platform-aliases.d.ts +4 -0
- package/dist/helpers/package-platform-aliases.js +83 -0
- package/dist/helpers/project.d.ts +23 -0
- package/dist/helpers/project.js +28 -0
- package/dist/helpers/resolver.d.ts +4 -0
- package/dist/helpers/resolver.js +31 -0
- package/dist/helpers/ts-config-paths.d.ts +4 -0
- package/dist/helpers/ts-config-paths.js +241 -0
- package/dist/helpers/utils.d.ts +29 -0
- package/dist/helpers/utils.js +101 -0
- package/dist/helpers/workers.d.ts +20 -0
- package/dist/helpers/workers.js +86 -0
- package/dist/hmr/hmr-angular.d.ts +1 -0
- package/dist/hmr/hmr-angular.js +34 -0
- package/dist/hmr/hmr-bridge.d.ts +18 -0
- package/dist/hmr/hmr-bridge.js +154 -0
- package/dist/hmr/hmr-client.d.ts +5 -0
- package/dist/hmr/hmr-client.js +93 -0
- package/dist/hmr/hmr-server.d.ts +20 -0
- package/dist/hmr/hmr-server.js +179 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/polyfills/mdn-data-at-rules.d.ts +7 -0
- package/dist/polyfills/mdn-data-at-rules.js +7 -0
- package/dist/polyfills/mdn-data-properties.d.ts +7 -0
- package/dist/polyfills/mdn-data-properties.js +7 -0
- package/dist/polyfills/mdn-data-syntaxes.d.ts +7 -0
- package/dist/polyfills/mdn-data-syntaxes.js +7 -0
- package/dist/polyfills/module.d.ts +17 -0
- package/dist/polyfills/module.js +29 -0
- package/dist/shims/react-reconciler-constants.d.ts +14 -0
- package/dist/shims/react-reconciler-constants.js +20 -0
- package/dist/shims/react-reconciler.d.ts +8 -0
- package/dist/shims/react-reconciler.js +14 -0
- package/dist/shims/set-value.d.ts +4 -0
- package/dist/shims/set-value.js +21 -0
- package/dist/transformers/NativeClass/index.d.ts +5 -0
- package/dist/transformers/NativeClass/index.js +46 -0
- package/package.json +31 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* A TypeScript transform that compiles classes marked with `@NativeClass` as es5
|
|
4
|
+
*/
|
|
5
|
+
export default function (ctx) {
|
|
6
|
+
function isNativeClassExtension(node) {
|
|
7
|
+
let decorators;
|
|
8
|
+
if ('canHaveDecorators' in ts && ts.canHaveDecorators(node)) {
|
|
9
|
+
// use the newer decorators API when using a newer typescript version
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
decorators = ts.getDecorators(node);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
// fallback to old behavior on older typescript versions
|
|
15
|
+
decorators = node.decorators;
|
|
16
|
+
}
|
|
17
|
+
return !!decorators?.some((d) => {
|
|
18
|
+
const fullText = d.getFullText().trim();
|
|
19
|
+
if (fullText.indexOf('@NativeClass') > -1) {
|
|
20
|
+
console.log('found @NativeClass decorator in:', fullText);
|
|
21
|
+
}
|
|
22
|
+
return fullText.indexOf('@NativeClass') > -1;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function visitNode(node) {
|
|
26
|
+
if (ts.isClassDeclaration(node) && isNativeClassExtension(node)) {
|
|
27
|
+
return createHelper(node);
|
|
28
|
+
}
|
|
29
|
+
return ts.visitEachChild(node, visitNode, ctx);
|
|
30
|
+
}
|
|
31
|
+
function createHelper(node) {
|
|
32
|
+
// we remove the decorator for now!
|
|
33
|
+
return ts.factory.createIdentifier(ts
|
|
34
|
+
.transpileModule(node.getText().replace(/@NativeClass(\((.|\n)*?\))?/gm, ''), {
|
|
35
|
+
compilerOptions: {
|
|
36
|
+
noEmitHelpers: true,
|
|
37
|
+
module: ts.ModuleKind.ESNext,
|
|
38
|
+
target: ts.ScriptTarget.ES5,
|
|
39
|
+
experimentalDecorators: true,
|
|
40
|
+
emitDecoratorMetadata: true,
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
.outputText.replace(/(Object\.defineProperty\(.*?{.*?)(enumerable:\s*false)(.*?}\))/gs, '$1enumerable: true$3'));
|
|
44
|
+
}
|
|
45
|
+
return (source) => ts.factory.updateSourceFile(source, ts.visitNodes(source.statements, visitNode));
|
|
46
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nativescript/vite",
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"description": "Vite for NativeScript",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"nativescript",
|
|
14
|
+
"vite"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@analogjs/vite-plugin-angular": "^1.20.2",
|
|
18
|
+
"@angular-devkit/build-angular": "^20.0.0",
|
|
19
|
+
"@angular/build": "^20.0.0",
|
|
20
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
21
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
22
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
23
|
+
"@vitejs/plugin-vue-jsx": "^5.1.1",
|
|
24
|
+
"minimist": "^1.2.8",
|
|
25
|
+
"react-reconciler": "^0.32.0",
|
|
26
|
+
"sass": ">=1.70.0 <2",
|
|
27
|
+
"vite": "^7.1.0",
|
|
28
|
+
"vite-plugin-solid": "^2.11.8",
|
|
29
|
+
"vite-plugin-static-copy": "^3.1.0"
|
|
30
|
+
}
|
|
31
|
+
}
|