@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.
Files changed (73) hide show
  1. package/dist/configuration/angular.d.ts +4 -0
  2. package/dist/configuration/angular.js +30 -0
  3. package/dist/configuration/base.d.ts +4 -0
  4. package/dist/configuration/base.js +270 -0
  5. package/dist/configuration/old-without-merge-base.d.ts +13 -0
  6. package/dist/configuration/old-without-merge-base.js +249 -0
  7. package/dist/configuration/react.d.ts +4 -0
  8. package/dist/configuration/react.js +85 -0
  9. package/dist/configuration/solid.d.ts +4 -0
  10. package/dist/configuration/solid.js +48 -0
  11. package/dist/configuration/vue.d.ts +4 -0
  12. package/dist/configuration/vue.js +45 -0
  13. package/dist/helpers/commonjs-plugins.d.ts +6 -0
  14. package/dist/helpers/commonjs-plugins.js +75 -0
  15. package/dist/helpers/config-as-json.d.ts +2 -0
  16. package/dist/helpers/config-as-json.js +35 -0
  17. package/dist/helpers/css-tree.d.ts +4 -0
  18. package/dist/helpers/css-tree.js +21 -0
  19. package/dist/helpers/dynamic-import-plugin.d.ts +4 -0
  20. package/dist/helpers/dynamic-import-plugin.js +62 -0
  21. package/dist/helpers/external-configs.d.ts +6 -0
  22. package/dist/helpers/external-configs.js +33 -0
  23. package/dist/helpers/flavor.d.ts +5 -0
  24. package/dist/helpers/flavor.js +40 -0
  25. package/dist/helpers/global-defines.d.ts +14 -0
  26. package/dist/helpers/global-defines.js +18 -0
  27. package/dist/helpers/main-entry.d.ts +5 -0
  28. package/dist/helpers/main-entry.js +75 -0
  29. package/dist/helpers/module-resolution.d.ts +1 -0
  30. package/dist/helpers/module-resolution.js +17 -0
  31. package/dist/helpers/nativescript-package-resolver.d.ts +5 -0
  32. package/dist/helpers/nativescript-package-resolver.js +139 -0
  33. package/dist/helpers/ns-cli-plugins.d.ts +19 -0
  34. package/dist/helpers/ns-cli-plugins.js +162 -0
  35. package/dist/helpers/package-platform-aliases.d.ts +4 -0
  36. package/dist/helpers/package-platform-aliases.js +83 -0
  37. package/dist/helpers/project.d.ts +23 -0
  38. package/dist/helpers/project.js +28 -0
  39. package/dist/helpers/resolver.d.ts +4 -0
  40. package/dist/helpers/resolver.js +31 -0
  41. package/dist/helpers/ts-config-paths.d.ts +4 -0
  42. package/dist/helpers/ts-config-paths.js +241 -0
  43. package/dist/helpers/utils.d.ts +29 -0
  44. package/dist/helpers/utils.js +101 -0
  45. package/dist/helpers/workers.d.ts +20 -0
  46. package/dist/helpers/workers.js +86 -0
  47. package/dist/hmr/hmr-angular.d.ts +1 -0
  48. package/dist/hmr/hmr-angular.js +34 -0
  49. package/dist/hmr/hmr-bridge.d.ts +18 -0
  50. package/dist/hmr/hmr-bridge.js +154 -0
  51. package/dist/hmr/hmr-client.d.ts +5 -0
  52. package/dist/hmr/hmr-client.js +93 -0
  53. package/dist/hmr/hmr-server.d.ts +20 -0
  54. package/dist/hmr/hmr-server.js +179 -0
  55. package/dist/index.d.ts +5 -0
  56. package/dist/index.js +5 -0
  57. package/dist/polyfills/mdn-data-at-rules.d.ts +7 -0
  58. package/dist/polyfills/mdn-data-at-rules.js +7 -0
  59. package/dist/polyfills/mdn-data-properties.d.ts +7 -0
  60. package/dist/polyfills/mdn-data-properties.js +7 -0
  61. package/dist/polyfills/mdn-data-syntaxes.d.ts +7 -0
  62. package/dist/polyfills/mdn-data-syntaxes.js +7 -0
  63. package/dist/polyfills/module.d.ts +17 -0
  64. package/dist/polyfills/module.js +29 -0
  65. package/dist/shims/react-reconciler-constants.d.ts +14 -0
  66. package/dist/shims/react-reconciler-constants.js +20 -0
  67. package/dist/shims/react-reconciler.d.ts +8 -0
  68. package/dist/shims/react-reconciler.js +14 -0
  69. package/dist/shims/set-value.d.ts +4 -0
  70. package/dist/shims/set-value.js +21 -0
  71. package/dist/transformers/NativeClass/index.d.ts +5 -0
  72. package/dist/transformers/NativeClass/index.js +46 -0
  73. 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
+ }