@nativescript/vite 0.0.1 → 0.0.2
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/LICENSE +19 -0
- package/README.md +44 -0
- package/{dist/configuration → configuration}/angular.d.ts +1 -1
- package/configuration/angular.js +480 -0
- package/configuration/angular.js.map +1 -0
- package/configuration/base.d.ts +5 -0
- package/configuration/base.js +494 -0
- package/configuration/base.js.map +1 -0
- package/configuration/javascript.d.ts +4 -0
- package/configuration/javascript.js +151 -0
- package/configuration/javascript.js.map +1 -0
- package/{dist/configuration → configuration}/react.d.ts +1 -1
- package/{dist/configuration → configuration}/react.js +18 -17
- package/configuration/react.js.map +1 -0
- package/{dist/configuration → configuration}/solid.d.ts +1 -1
- package/{dist/configuration → configuration}/solid.js +17 -16
- package/configuration/solid.js.map +1 -0
- package/configuration/typescript.d.ts +4 -0
- package/configuration/typescript.js +175 -0
- package/configuration/typescript.js.map +1 -0
- package/{dist/configuration → configuration}/vue.d.ts +1 -1
- package/configuration/vue.js +163 -0
- package/configuration/vue.js.map +1 -0
- package/helpers/angular-linker.d.ts +13 -0
- package/helpers/angular-linker.js +181 -0
- package/helpers/angular-linker.js.map +1 -0
- package/helpers/cli-flags.d.ts +1 -0
- package/helpers/cli-flags.js +15 -0
- package/helpers/cli-flags.js.map +1 -0
- package/{dist/helpers → helpers}/commonjs-plugins.js +14 -13
- package/helpers/commonjs-plugins.js.map +1 -0
- package/{dist/helpers → helpers}/config-as-json.d.ts +1 -1
- package/{dist/helpers → helpers}/config-as-json.js +7 -6
- package/helpers/config-as-json.js.map +1 -0
- package/helpers/css-platform-plugin.d.ts +10 -0
- package/helpers/css-platform-plugin.js +76 -0
- package/helpers/css-platform-plugin.js.map +1 -0
- package/helpers/css-tree.js +22 -0
- package/helpers/css-tree.js.map +1 -0
- package/{dist/helpers → helpers}/dynamic-import-plugin.js +8 -7
- package/helpers/dynamic-import-plugin.js.map +1 -0
- package/helpers/esbuild-platform-resolver.d.ts +14 -0
- package/helpers/esbuild-platform-resolver.js +93 -0
- package/helpers/esbuild-platform-resolver.js.map +1 -0
- package/helpers/external-configs.d.ts +6 -0
- package/helpers/external-configs.js +34 -0
- package/helpers/external-configs.js.map +1 -0
- package/{dist/helpers → helpers}/flavor.d.ts +1 -0
- package/helpers/flavor.js +51 -0
- package/helpers/flavor.js.map +1 -0
- package/{dist/helpers → helpers}/global-defines.d.ts +11 -2
- package/helpers/global-defines.js +24 -0
- package/helpers/global-defines.js.map +1 -0
- package/helpers/logging.d.ts +13 -0
- package/helpers/logging.js +111 -0
- package/helpers/logging.js.map +1 -0
- package/helpers/main-entry.d.ts +10 -0
- package/helpers/main-entry.js +215 -0
- package/helpers/main-entry.js.map +1 -0
- package/{dist/helpers → helpers}/module-resolution.js +4 -3
- package/helpers/module-resolution.js.map +1 -0
- package/helpers/module-runner-patch.d.ts +3 -0
- package/helpers/module-runner-patch.js +63 -0
- package/helpers/module-runner-patch.js.map +1 -0
- package/helpers/nativeclass-transform.d.ts +7 -0
- package/helpers/nativeclass-transform.js +158 -0
- package/helpers/nativeclass-transform.js.map +1 -0
- package/helpers/nativeclass-transformer-plugin.d.ts +5 -0
- package/helpers/nativeclass-transformer-plugin.js +23 -0
- package/helpers/nativeclass-transformer-plugin.js.map +1 -0
- package/{dist/helpers → helpers}/nativescript-package-resolver.js +18 -17
- package/helpers/nativescript-package-resolver.js.map +1 -0
- package/helpers/ns-cli-plugins.d.ts +14 -0
- package/helpers/ns-cli-plugins.js +165 -0
- package/helpers/ns-cli-plugins.js.map +1 -0
- package/helpers/package-platform-aliases.d.ts +10 -0
- package/{dist/helpers → helpers}/package-platform-aliases.js +19 -23
- package/helpers/package-platform-aliases.js.map +1 -0
- package/helpers/postcss-platform-config.d.ts +13 -0
- package/helpers/postcss-platform-config.js +97 -0
- package/helpers/postcss-platform-config.js.map +1 -0
- package/helpers/prelink-angular.d.ts +2 -0
- package/helpers/prelink-angular.js +117 -0
- package/helpers/prelink-angular.js.map +1 -0
- package/helpers/preserve-imports.d.ts +2 -0
- package/helpers/preserve-imports.js +38 -0
- package/helpers/preserve-imports.js.map +1 -0
- package/{dist/helpers → helpers}/project.js +2 -4
- package/helpers/project.js.map +1 -0
- package/helpers/resolver.d.ts +4 -0
- package/{dist/helpers → helpers}/resolver.js +7 -6
- package/helpers/resolver.js.map +1 -0
- package/helpers/theme-core-plugins.d.ts +14 -0
- package/helpers/theme-core-plugins.js +121 -0
- package/helpers/theme-core-plugins.js.map +1 -0
- package/helpers/ts-config-paths.d.ts +10 -0
- package/{dist/helpers → helpers}/ts-config-paths.js +73 -72
- package/helpers/ts-config-paths.js.map +1 -0
- package/{dist/helpers → helpers}/utils.d.ts +6 -0
- package/{dist/helpers → helpers}/utils.js +28 -34
- package/helpers/utils.js.map +1 -0
- package/{dist/helpers → helpers}/workers.js +15 -16
- package/helpers/workers.js.map +1 -0
- package/hmr/client/css-handler.d.ts +4 -0
- package/hmr/client/css-handler.js +78 -0
- package/hmr/client/css-handler.js.map +1 -0
- package/hmr/client/index.d.ts +13 -0
- package/hmr/client/index.js +1550 -0
- package/hmr/client/index.js.map +1 -0
- package/hmr/client/utils.d.ts +38 -0
- package/hmr/client/utils.js +426 -0
- package/hmr/client/utils.js.map +1 -0
- package/hmr/entry-runtime.d.ts +8 -0
- package/hmr/entry-runtime.js +135 -0
- package/hmr/entry-runtime.js.map +1 -0
- package/hmr/frameworks/angular/server/strategy.d.ts +2 -0
- package/hmr/frameworks/angular/server/strategy.js +101 -0
- package/hmr/frameworks/angular/server/strategy.js.map +1 -0
- package/hmr/frameworks/vue/client/index.d.ts +22 -0
- package/hmr/frameworks/vue/client/index.js +1537 -0
- package/hmr/frameworks/vue/client/index.js.map +1 -0
- package/hmr/frameworks/vue/server/compiler.d.ts +11 -0
- package/hmr/frameworks/vue/server/compiler.js +26 -0
- package/hmr/frameworks/vue/server/compiler.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-transforms.d.ts +14 -0
- package/hmr/frameworks/vue/server/sfc-transforms.js +282 -0
- package/hmr/frameworks/vue/server/sfc-transforms.js.map +1 -0
- package/hmr/frameworks/vue/server/strategy.d.ts +2 -0
- package/hmr/frameworks/vue/server/strategy.js +273 -0
- package/hmr/frameworks/vue/server/strategy.js.map +1 -0
- package/hmr/helpers/ast-extract.d.ts +6 -0
- package/hmr/helpers/ast-extract.js +72 -0
- package/hmr/helpers/ast-extract.js.map +1 -0
- package/hmr/helpers/ast-normalizer.d.ts +7 -0
- package/hmr/helpers/ast-normalizer.js +772 -0
- package/hmr/helpers/ast-normalizer.js.map +1 -0
- package/hmr/helpers/babel.d.ts +3 -0
- package/hmr/helpers/babel.js +17 -0
- package/hmr/helpers/babel.js.map +1 -0
- package/hmr/helpers/sanitize.d.ts +6 -0
- package/hmr/helpers/sanitize.js +55 -0
- package/hmr/helpers/sanitize.js.map +1 -0
- package/hmr/helpers/vendor-rewrite.d.ts +1 -0
- package/hmr/helpers/vendor-rewrite.js +35 -0
- package/hmr/helpers/vendor-rewrite.js.map +1 -0
- package/hmr/server/compiler.d.ts +2 -0
- package/hmr/server/compiler.js +75 -0
- package/hmr/server/compiler.js.map +1 -0
- package/hmr/server/constants.d.ts +14 -0
- package/hmr/server/constants.js +23 -0
- package/hmr/server/constants.js.map +1 -0
- package/hmr/server/core-sanitize.d.ts +32 -0
- package/hmr/server/core-sanitize.js +134 -0
- package/hmr/server/core-sanitize.js.map +1 -0
- package/hmr/server/framework-strategy.d.ts +68 -0
- package/hmr/server/framework-strategy.js +2 -0
- package/hmr/server/framework-strategy.js.map +1 -0
- package/hmr/server/index.d.ts +5 -0
- package/hmr/server/index.js +19 -0
- package/hmr/server/index.js.map +1 -0
- package/hmr/server/vite-plugin.d.ts +5 -0
- package/hmr/server/vite-plugin.js +44 -0
- package/hmr/server/vite-plugin.js.map +1 -0
- package/hmr/server/websocket.d.ts +15 -0
- package/hmr/server/websocket.js +5528 -0
- package/hmr/server/websocket.js.map +1 -0
- package/hmr/shared/runtime/http-only-boot.d.ts +1 -0
- package/hmr/shared/runtime/http-only-boot.js +107 -0
- package/hmr/shared/runtime/http-only-boot.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
- package/hmr/shared/runtime/root-placeholder.js +142 -0
- package/hmr/shared/runtime/root-placeholder.js.map +1 -0
- package/hmr/shared/runtime/vendor-bootstrap.d.ts +1 -0
- package/hmr/shared/runtime/vendor-bootstrap.js +134 -0
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -0
- package/hmr/shared/vendor/manifest-loader.d.ts +9 -0
- package/hmr/shared/vendor/manifest-loader.js +38 -0
- package/hmr/shared/vendor/manifest-loader.js.map +1 -0
- package/hmr/shared/vendor/manifest.d.ts +34 -0
- package/hmr/shared/vendor/manifest.js +787 -0
- package/hmr/shared/vendor/manifest.js.map +1 -0
- package/hmr/shared/vendor/registry.d.ts +9 -0
- package/hmr/shared/vendor/registry.js +62 -0
- package/hmr/shared/vendor/registry.js.map +1 -0
- package/hmr/vendor-bootstrap.d.ts +3 -0
- package/hmr/vendor-bootstrap.js +32 -0
- package/hmr/vendor-bootstrap.js.map +1 -0
- package/{dist/index.d.ts → index.d.ts} +2 -0
- package/{dist/index.js → index.js} +3 -0
- package/index.js.map +1 -0
- package/package.json +39 -30
- package/{dist/polyfills → polyfills}/mdn-data-at-rules.js +1 -0
- package/polyfills/mdn-data-at-rules.js.map +1 -0
- package/{dist/polyfills → polyfills}/mdn-data-properties.js +1 -0
- package/polyfills/mdn-data-properties.js.map +1 -0
- package/{dist/polyfills → polyfills}/mdn-data-syntaxes.js +1 -0
- package/polyfills/mdn-data-syntaxes.js.map +1 -0
- package/{dist/polyfills → polyfills}/module.js +1 -0
- package/polyfills/module.js.map +1 -0
- package/runtime/core-aliases-early.d.ts +1 -0
- package/runtime/core-aliases-early.js +334 -0
- package/runtime/core-aliases-early.js.map +1 -0
- package/shims/angular-animations-stub.d.ts +8 -0
- package/shims/angular-animations-stub.js +14 -0
- package/shims/angular-animations-stub.js.map +1 -0
- package/shims/node-module.d.ts +5 -0
- package/shims/node-module.js +13 -0
- package/shims/node-module.js.map +1 -0
- package/{dist/shims → shims}/react-reconciler-constants.js +2 -1
- package/shims/react-reconciler-constants.js.map +1 -0
- package/{dist/shims → shims}/react-reconciler.js +1 -0
- package/shims/react-reconciler.js.map +1 -0
- package/{dist/shims → shims}/set-value.js +5 -1
- package/shims/set-value.js.map +1 -0
- package/transformers/NativeClass/index.d.ts +2 -0
- package/transformers/NativeClass/index.js +222 -0
- package/transformers/NativeClass/index.js.map +1 -0
- package/dist/configuration/angular.js +0 -30
- package/dist/configuration/base.d.ts +0 -13
- package/dist/configuration/base.js +0 -228
- package/dist/configuration/old-without-merge-base.d.ts +0 -13
- package/dist/configuration/old-without-merge-base.js +0 -249
- package/dist/configuration/vue.js +0 -45
- package/dist/helpers/css-tree.js +0 -21
- package/dist/helpers/flavor.js +0 -40
- package/dist/helpers/global-defines.js +0 -18
- package/dist/helpers/main-entry.d.ts +0 -5
- package/dist/helpers/main-entry.js +0 -75
- package/dist/helpers/ns-cli-plugins.d.ts +0 -17
- package/dist/helpers/ns-cli-plugins.js +0 -128
- package/dist/helpers/package-platform-aliases.d.ts +0 -4
- package/dist/helpers/resolver.d.ts +0 -4
- package/dist/helpers/ts-config-paths.d.ts +0 -4
- package/dist/hmr/hmr-angular.d.ts +0 -1
- package/dist/hmr/hmr-angular.js +0 -34
- package/dist/hmr/hmr-bridge.d.ts +0 -18
- package/dist/hmr/hmr-bridge.js +0 -154
- package/dist/hmr/hmr-client.d.ts +0 -5
- package/dist/hmr/hmr-client.js +0 -93
- package/dist/hmr/hmr-server.d.ts +0 -20
- package/dist/hmr/hmr-server.js +0 -179
- package/dist/transformers/NativeClass/index.d.ts +0 -5
- package/dist/transformers/NativeClass/index.js +0 -46
- /package/{dist/helpers → helpers}/commonjs-plugins.d.ts +0 -0
- /package/{dist/helpers → helpers}/css-tree.d.ts +0 -0
- /package/{dist/helpers → helpers}/dynamic-import-plugin.d.ts +0 -0
- /package/{dist/helpers → helpers}/module-resolution.d.ts +0 -0
- /package/{dist/helpers → helpers}/nativescript-package-resolver.d.ts +0 -0
- /package/{dist/helpers → helpers}/project.d.ts +0 -0
- /package/{dist/helpers → helpers}/workers.d.ts +0 -0
- /package/{dist/polyfills → polyfills}/mdn-data-at-rules.d.ts +0 -0
- /package/{dist/polyfills → polyfills}/mdn-data-properties.d.ts +0 -0
- /package/{dist/polyfills → polyfills}/mdn-data-syntaxes.d.ts +0 -0
- /package/{dist/polyfills → polyfills}/module.d.ts +0 -0
- /package/{dist/shims → shims}/react-reconciler-constants.d.ts +0 -0
- /package/{dist/shims → shims}/react-reconciler.d.ts +0 -0
- /package/{dist/shims → shims}/set-value.d.ts +0 -0
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import minimist from "minimist";
|
|
3
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
-
import NativeScriptPlugin from "../helpers/resolver.js";
|
|
5
|
-
import nsConfigAsJsonPlugin from "../helpers/config-as-json.js";
|
|
6
|
-
import { getProjectRootPath } from "../helpers/project.js";
|
|
7
|
-
import { aliasCssTree } from "../helpers/css-tree.js";
|
|
8
|
-
import { packagePlatformAliases } from "../helpers/package-platform-aliases.js";
|
|
9
|
-
import { getGlobalDefines } from "../helpers/global-defines.js";
|
|
10
|
-
import { getWorkerPlugins, workerUrlPlugin } from "../helpers/workers.js";
|
|
11
|
-
import { getTsConfigData } from "../helpers/ts-config-paths.js";
|
|
12
|
-
import { commonjsPlugins } from "../helpers/commonjs-plugins.js";
|
|
13
|
-
import { nativescriptPackageResolver } from "../helpers/nativescript-package-resolver.js";
|
|
14
|
-
import { hmrPlugin, cliPlugin } from "../helpers/ns-cli-plugins.js";
|
|
15
|
-
import { dynamicImportPlugin } from "../helpers/dynamic-import-plugin.js";
|
|
16
|
-
import { mainEntryPlugin } from "../helpers/main-entry.js";
|
|
17
|
-
import { determineProjectFlavor } from "../helpers/flavor.js";
|
|
18
|
-
const debugViteLogs = !!process.env.VITE_DEBUG_PATHS;
|
|
19
|
-
const projectRoot = getProjectRootPath();
|
|
20
|
-
export const baseConfig = ({ mode, skipCommonjsPackages, customCommonjsPlugins, commonjsIgnoreList, optimizeDeps, }) => {
|
|
21
|
-
const platform = mode;
|
|
22
|
-
const targetMode = process.env.production ? "production" : "development";
|
|
23
|
-
const cliArgs = minimist(process.argv.slice(2), { "--": true });
|
|
24
|
-
const cliFlags = (cliArgs["--"] || []).reduce((obj, flag) => {
|
|
25
|
-
// remove env prefix
|
|
26
|
-
const [rawKey, ...rest] = flag.replace(/^--env\./, "").split("=");
|
|
27
|
-
obj[rawKey] = rest.length === 0 ? true : rest.join("=");
|
|
28
|
-
return obj;
|
|
29
|
-
}, {});
|
|
30
|
-
console.log("cliFlags:", cliFlags);
|
|
31
|
-
const debug = !!cliFlags.viteDebug || !!process.env.DEBUG || targetMode === "development";
|
|
32
|
-
if (debug) {
|
|
33
|
-
console.log("--------------");
|
|
34
|
-
console.log("Vite config mode:", mode);
|
|
35
|
-
console.log("Target mode:", targetMode);
|
|
36
|
-
console.log("Platform:", platform);
|
|
37
|
-
console.log("--------------");
|
|
38
|
-
}
|
|
39
|
-
const flavor = determineProjectFlavor();
|
|
40
|
-
console.log(`Building for ${flavor}.`);
|
|
41
|
-
// Create TypeScript aliases with platform support
|
|
42
|
-
const tsConfigData = getTsConfigData(debugViteLogs, platform);
|
|
43
|
-
// Common resolve configuration for both main and worker builds
|
|
44
|
-
const resolveConfig = {
|
|
45
|
-
// ensures Vite prefers ESM entry‑points
|
|
46
|
-
mainFields: ["module", "main"],
|
|
47
|
-
// Make sure ESM conditions win during resolution
|
|
48
|
-
conditions: ["module", "import", "browser", "default"],
|
|
49
|
-
// use this with merge config instead or could list common dedupes in base here altogether
|
|
50
|
-
dedupe: ["@nativescript/core", "nativescript-vue", "vue"],
|
|
51
|
-
// Alias "@" and "~" to your src directory for cleaner imports
|
|
52
|
-
alias: [
|
|
53
|
-
...aliasCssTree,
|
|
54
|
-
// 1) Catch exactly `~/package.json` → virtual module (MUST be first!)
|
|
55
|
-
{ find: /^~\/package\.json$/, replacement: "~/package.json" },
|
|
56
|
-
// TypeScript path aliases from tsconfig.json
|
|
57
|
-
...tsConfigData.aliases,
|
|
58
|
-
// Generic platform resolution for any npm package
|
|
59
|
-
packagePlatformAliases(tsConfigData, platform, skipCommonjsPackages, debugViteLogs),
|
|
60
|
-
// 2) Catch everything else under "~/" → your src/
|
|
61
|
-
{ find: /^~\/(.*)$/, replacement: path.resolve(projectRoot, "src/$1") },
|
|
62
|
-
// optional: "@" → src/
|
|
63
|
-
{ find: "@", replacement: path.resolve(projectRoot, "src") },
|
|
64
|
-
],
|
|
65
|
-
extensions: [
|
|
66
|
-
".ios.tsx",
|
|
67
|
-
".android.tsx",
|
|
68
|
-
".tsx",
|
|
69
|
-
".ios.jsx",
|
|
70
|
-
".android.jsx",
|
|
71
|
-
".jsx",
|
|
72
|
-
".ios.ts",
|
|
73
|
-
".android.ts",
|
|
74
|
-
".ts",
|
|
75
|
-
".ios.js",
|
|
76
|
-
".android.js",
|
|
77
|
-
".js",
|
|
78
|
-
".mjs",
|
|
79
|
-
".json",
|
|
80
|
-
],
|
|
81
|
-
preserveSymlinks: true,
|
|
82
|
-
};
|
|
83
|
-
// Common define configuration for both main and worker builds
|
|
84
|
-
const defineConfig = getGlobalDefines(platform, targetMode);
|
|
85
|
-
return {
|
|
86
|
-
resolve: resolveConfig,
|
|
87
|
-
define: defineConfig,
|
|
88
|
-
// Vite's built-in solution for CommonJS/ESM compatibility issues
|
|
89
|
-
optimizeDeps: {
|
|
90
|
-
// Force pre-bundling of problematic CommonJS packages
|
|
91
|
-
include: [
|
|
92
|
-
// "source-map-js",
|
|
93
|
-
"@valor/nativescript-websockets",
|
|
94
|
-
// React and related packages for proper module resolution
|
|
95
|
-
"react",
|
|
96
|
-
"react-reconciler",
|
|
97
|
-
"react-nativescript",
|
|
98
|
-
...(optimizeDeps || []),
|
|
99
|
-
// Add any other problematic packages here
|
|
100
|
-
],
|
|
101
|
-
// Handle Node.js built-ins and other edge cases
|
|
102
|
-
esbuildOptions: {
|
|
103
|
-
// Pass the same conditions to ESBuild for css-tree compatibility
|
|
104
|
-
conditions: ["module", "import", "browser", "default"],
|
|
105
|
-
// Define globals for Node.js built-ins if needed
|
|
106
|
-
define: {
|
|
107
|
-
global: "globalThis",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
plugins: [
|
|
112
|
-
// TODO: make flavor plugins dynamic
|
|
113
|
-
// ...flavorPlugins,
|
|
114
|
-
...commonjsPlugins,
|
|
115
|
-
...(customCommonjsPlugins || []),
|
|
116
|
-
// Platform-specific package resolver - MUST come before commonjs plugin
|
|
117
|
-
nativescriptPackageResolver(platform),
|
|
118
|
-
// Simplified CommonJS handling - let Vite's optimizeDeps do the heavy lifting
|
|
119
|
-
commonjs({
|
|
120
|
-
include: [/node_modules/],
|
|
121
|
-
// Force specific problematic modules to be treated as CommonJS
|
|
122
|
-
requireReturnsDefault: "auto",
|
|
123
|
-
defaultIsModuleExports: "auto",
|
|
124
|
-
transformMixedEsModules: true,
|
|
125
|
-
// Ignore optional dependencies that are meant to fail gracefully
|
|
126
|
-
ignore: [
|
|
127
|
-
"@nativescript/android",
|
|
128
|
-
"@nativescript/ios",
|
|
129
|
-
...(commonjsIgnoreList || []),
|
|
130
|
-
],
|
|
131
|
-
}),
|
|
132
|
-
nsConfigAsJsonPlugin(),
|
|
133
|
-
NativeScriptPlugin({ platform }),
|
|
134
|
-
mainEntryPlugin(cliFlags, debug),
|
|
135
|
-
// NativeScript HMR integration - track changes for incremental builds
|
|
136
|
-
hmrPlugin(targetMode),
|
|
137
|
-
// NativeScript CLI integration - enhanced IPC communication for HMR
|
|
138
|
-
cliPlugin(targetMode, cliFlags),
|
|
139
|
-
dynamicImportPlugin(),
|
|
140
|
-
// Transform Vite worker URLs to NativeScript format AFTER bundling
|
|
141
|
-
workerUrlPlugin(),
|
|
142
|
-
],
|
|
143
|
-
css: {
|
|
144
|
-
postcss: "./postcss.config.js",
|
|
145
|
-
},
|
|
146
|
-
// Development server configuration for HMR
|
|
147
|
-
server: targetMode === "development"
|
|
148
|
-
? {
|
|
149
|
-
hmr: {
|
|
150
|
-
// Enable Vite's built-in HMR
|
|
151
|
-
port: 24678, // Different port to avoid conflicts with our custom WebSocket
|
|
152
|
-
},
|
|
153
|
-
// CORS for development
|
|
154
|
-
cors: true,
|
|
155
|
-
}
|
|
156
|
-
: {},
|
|
157
|
-
// Configure worker builds to bundle everything into standalone workers
|
|
158
|
-
worker: {
|
|
159
|
-
format: "es",
|
|
160
|
-
plugins: () => getWorkerPlugins(platform),
|
|
161
|
-
rollupOptions: {
|
|
162
|
-
// Don't externalize anything - bundle everything into the worker
|
|
163
|
-
external: [],
|
|
164
|
-
output: {
|
|
165
|
-
// Inline all dynamic imports to create standalone bundle
|
|
166
|
-
inlineDynamicImports: true,
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
build: {
|
|
171
|
-
target: "esnext",
|
|
172
|
-
minify: !debug,
|
|
173
|
-
// Generate source maps for debugging
|
|
174
|
-
// Note: just disabling for now until can hook up to angular vite/analog plugin
|
|
175
|
-
sourcemap: false, //debug,
|
|
176
|
-
// Disable module preloading to avoid browser APIs
|
|
177
|
-
modulePreload: false,
|
|
178
|
-
// Optimize for development speed
|
|
179
|
-
...(targetMode === "development" && {
|
|
180
|
-
// Faster builds in development
|
|
181
|
-
reportCompressedSize: false,
|
|
182
|
-
chunkSizeWarningLimit: 2000,
|
|
183
|
-
}),
|
|
184
|
-
commonjsOptions: {
|
|
185
|
-
include: [/node_modules/],
|
|
186
|
-
},
|
|
187
|
-
rollupOptions: {
|
|
188
|
-
input: "virtual:entry-with-polyfills",
|
|
189
|
-
output: {
|
|
190
|
-
dir: path.resolve(projectRoot, "dist"),
|
|
191
|
-
format: "es", // Emit ES modules (.mjs)
|
|
192
|
-
entryFileNames: "bundle.mjs", // <- no hash here
|
|
193
|
-
chunkFileNames: (chunk) => {
|
|
194
|
-
if (chunk.name === "vendor")
|
|
195
|
-
return "vendor.mjs";
|
|
196
|
-
// Place worker files at root level, not in assets/
|
|
197
|
-
if (chunk.name && chunk.name.includes("worker")) {
|
|
198
|
-
return "[name]-[hash].js";
|
|
199
|
-
}
|
|
200
|
-
return "[name]-[hash].mjs";
|
|
201
|
-
},
|
|
202
|
-
assetFileNames: "assets/[name][extname]",
|
|
203
|
-
// Create single vendor chunk - no separate globals chunk to avoid circular deps
|
|
204
|
-
manualChunks(id) {
|
|
205
|
-
if (id.includes("node_modules")) {
|
|
206
|
-
// Note: this is work in progress on best setup
|
|
207
|
-
// Keep polyfills and Zone-dependent packages in main bundle to ensure correct execution order
|
|
208
|
-
if ([
|
|
209
|
-
"@nativescript/core",
|
|
210
|
-
"@nativescript/angular",
|
|
211
|
-
"@nativescript/zone-js",
|
|
212
|
-
"@valor/nativescript-websockets",
|
|
213
|
-
"make-error",
|
|
214
|
-
// "source-map-js",
|
|
215
|
-
"zone.js",
|
|
216
|
-
"/globals",
|
|
217
|
-
"/polyfills",
|
|
218
|
-
].includes(id)) {
|
|
219
|
-
return undefined; // Keep in main bundle
|
|
220
|
-
}
|
|
221
|
-
return "vendor";
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { UserConfig } from "vite";
|
|
2
|
-
export declare const baseConfig: ({ mode, skipCommonjsPackages, customCommonjsPlugins, commonjsIgnoreList, optimizeDeps, }: {
|
|
3
|
-
mode: string;
|
|
4
|
-
skipCommonjsPackages?: string[];
|
|
5
|
-
customCommonjsPlugins?: {
|
|
6
|
-
name: string;
|
|
7
|
-
enforce: string;
|
|
8
|
-
resolveId(id: any): any;
|
|
9
|
-
load(id: any): string;
|
|
10
|
-
}[];
|
|
11
|
-
commonjsIgnoreList?: string[];
|
|
12
|
-
optimizeDeps?: string[];
|
|
13
|
-
}) => UserConfig;
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import minimist from "minimist";
|
|
3
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
4
|
-
import NativeScriptPlugin from "../helpers/resolver.js";
|
|
5
|
-
import nsConfigAsJsonPlugin from "../helpers/config-as-json.js";
|
|
6
|
-
import { getProjectRootPath } from "../helpers/project.js";
|
|
7
|
-
import { aliasCssTree } from "../helpers/css-tree.js";
|
|
8
|
-
import { packagePlatformAliases } from "../helpers/package-platform-aliases.js";
|
|
9
|
-
import { getGlobalDefines } from "../helpers/global-defines.js";
|
|
10
|
-
import { getWorkerPlugins, workerUrlPlugin } from "../helpers/workers.js";
|
|
11
|
-
import { getTsConfigData } from "../helpers/ts-config-paths.js";
|
|
12
|
-
import { commonjsPlugins } from "../helpers/commonjs-plugins.js";
|
|
13
|
-
import { nativescriptPackageResolver } from "../helpers/nativescript-package-resolver.js";
|
|
14
|
-
import { hmrPlugin, cliPlugin } from "../helpers/ns-cli-plugins.js";
|
|
15
|
-
import { dynamicImportPlugin } from "../helpers/dynamic-import-plugin.js";
|
|
16
|
-
import { mainEntryPlugin } from "../helpers/main-entry.js";
|
|
17
|
-
import { determineProjectFlavor } from "../helpers/flavor.js";
|
|
18
|
-
const debugViteLogs = !!process.env.VITE_DEBUG_PATHS;
|
|
19
|
-
const projectRoot = getProjectRootPath();
|
|
20
|
-
// NOTE: just testing with angular directly temporarily
|
|
21
|
-
// change this to pick up environment for flavors dynamically
|
|
22
|
-
// import { angularPlugins } from "./angular.js";
|
|
23
|
-
// import { getReactPlugins } from "./react.js";
|
|
24
|
-
// import { getSolidPlugins } from "./solid.js";
|
|
25
|
-
// import { vuePlugins } from "./vue.js";
|
|
26
|
-
export const baseConfig = ({ mode, skipCommonjsPackages, customCommonjsPlugins, commonjsIgnoreList, optimizeDeps, }) => {
|
|
27
|
-
const platform = mode;
|
|
28
|
-
const targetMode = process.env.production ? "production" : "development";
|
|
29
|
-
const cliArgs = minimist(process.argv.slice(2), { "--": true });
|
|
30
|
-
const cliFlags = (cliArgs["--"] || []).reduce((obj, flag) => {
|
|
31
|
-
// remove env prefix
|
|
32
|
-
const [rawKey, ...rest] = flag.replace(/^--env\./, "").split("=");
|
|
33
|
-
obj[rawKey] = rest.length === 0 ? true : rest.join("=");
|
|
34
|
-
return obj;
|
|
35
|
-
}, {});
|
|
36
|
-
console.log("cliFlags:", cliFlags);
|
|
37
|
-
const debug = !!cliFlags.viteDebug || !!process.env.DEBUG || targetMode === "development";
|
|
38
|
-
if (debug) {
|
|
39
|
-
console.log("--------------");
|
|
40
|
-
console.log("Vite config mode:", mode);
|
|
41
|
-
console.log("Target mode:", targetMode);
|
|
42
|
-
console.log("Platform:", platform);
|
|
43
|
-
console.log("--------------");
|
|
44
|
-
}
|
|
45
|
-
const flavor = determineProjectFlavor();
|
|
46
|
-
console.log(`Building with ${flavor}`);
|
|
47
|
-
// let flavorPlugins: any[] = [];
|
|
48
|
-
switch (flavor) {
|
|
49
|
-
// case "angular":
|
|
50
|
-
// flavorPlugins = angularPlugins;
|
|
51
|
-
// break;
|
|
52
|
-
// case "react":
|
|
53
|
-
// flavorPlugins = getReactPlugins(!debug);
|
|
54
|
-
// break;
|
|
55
|
-
// case "vue":
|
|
56
|
-
// flavorPlugins = vuePlugins;
|
|
57
|
-
// break;
|
|
58
|
-
// case "solid":
|
|
59
|
-
// flavorPlugins = getSolidPlugins(!debug);
|
|
60
|
-
// break;
|
|
61
|
-
}
|
|
62
|
-
// Create TypeScript aliases with platform support
|
|
63
|
-
const tsConfigData = getTsConfigData(debugViteLogs, platform);
|
|
64
|
-
// Common resolve configuration for both main and worker builds
|
|
65
|
-
const resolveConfig = {
|
|
66
|
-
// ensures Vite prefers ESM entry‑points
|
|
67
|
-
mainFields: ["module", "main"],
|
|
68
|
-
// Make sure ESM conditions win during resolution
|
|
69
|
-
conditions: ["module", "import", "browser", "default"],
|
|
70
|
-
// use this with merge config instead or could list common dedupes in base here altogether
|
|
71
|
-
dedupe: ["@nativescript/core", "nativescript-vue", "vue"],
|
|
72
|
-
// Alias "@" and "~" to your src directory for cleaner imports
|
|
73
|
-
alias: [
|
|
74
|
-
...aliasCssTree,
|
|
75
|
-
// 1) Catch exactly `~/package.json` → virtual module (MUST be first!)
|
|
76
|
-
{ find: /^~\/package\.json$/, replacement: "~/package.json" },
|
|
77
|
-
// TypeScript path aliases from tsconfig.json
|
|
78
|
-
...tsConfigData.aliases,
|
|
79
|
-
// Generic platform resolution for any npm package
|
|
80
|
-
packagePlatformAliases(tsConfigData, platform, skipCommonjsPackages, debugViteLogs),
|
|
81
|
-
// 2) Catch everything else under "~/" → your src/
|
|
82
|
-
{ find: /^~\/(.*)$/, replacement: path.resolve(projectRoot, "src/$1") },
|
|
83
|
-
// optional: "@" → src/
|
|
84
|
-
{ find: "@", replacement: path.resolve(projectRoot, "src") },
|
|
85
|
-
],
|
|
86
|
-
extensions: [
|
|
87
|
-
".ios.tsx",
|
|
88
|
-
".android.tsx",
|
|
89
|
-
".tsx",
|
|
90
|
-
".ios.jsx",
|
|
91
|
-
".android.jsx",
|
|
92
|
-
".jsx",
|
|
93
|
-
".ios.ts",
|
|
94
|
-
".android.ts",
|
|
95
|
-
".ts",
|
|
96
|
-
".ios.js",
|
|
97
|
-
".android.js",
|
|
98
|
-
".js",
|
|
99
|
-
".mjs",
|
|
100
|
-
".json",
|
|
101
|
-
],
|
|
102
|
-
preserveSymlinks: true,
|
|
103
|
-
};
|
|
104
|
-
// Common define configuration for both main and worker builds
|
|
105
|
-
const defineConfig = getGlobalDefines(platform, targetMode);
|
|
106
|
-
return {
|
|
107
|
-
resolve: resolveConfig,
|
|
108
|
-
define: defineConfig,
|
|
109
|
-
// Vite's built-in solution for CommonJS/ESM compatibility issues
|
|
110
|
-
optimizeDeps: {
|
|
111
|
-
// Force pre-bundling of problematic CommonJS packages
|
|
112
|
-
include: [
|
|
113
|
-
// "source-map-js",
|
|
114
|
-
"@valor/nativescript-websockets",
|
|
115
|
-
// React and related packages for proper module resolution
|
|
116
|
-
"react",
|
|
117
|
-
"react-reconciler",
|
|
118
|
-
"react-nativescript",
|
|
119
|
-
...(optimizeDeps || []),
|
|
120
|
-
// Add any other problematic packages here
|
|
121
|
-
],
|
|
122
|
-
// Handle Node.js built-ins and other edge cases
|
|
123
|
-
esbuildOptions: {
|
|
124
|
-
// Pass the same conditions to ESBuild for css-tree compatibility
|
|
125
|
-
conditions: ["module", "import", "browser", "default"],
|
|
126
|
-
// Define globals for Node.js built-ins if needed
|
|
127
|
-
define: {
|
|
128
|
-
global: "globalThis",
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
plugins: [
|
|
133
|
-
// TODO: make flavor plugins dynamic
|
|
134
|
-
// ...flavorPlugins,
|
|
135
|
-
...commonjsPlugins,
|
|
136
|
-
...(customCommonjsPlugins || []),
|
|
137
|
-
// Platform-specific package resolver - MUST come before commonjs plugin
|
|
138
|
-
nativescriptPackageResolver(platform),
|
|
139
|
-
// Simplified CommonJS handling - let Vite's optimizeDeps do the heavy lifting
|
|
140
|
-
commonjs({
|
|
141
|
-
include: [/node_modules/],
|
|
142
|
-
// Force specific problematic modules to be treated as CommonJS
|
|
143
|
-
requireReturnsDefault: "auto",
|
|
144
|
-
defaultIsModuleExports: "auto",
|
|
145
|
-
transformMixedEsModules: true,
|
|
146
|
-
// Ignore optional dependencies that are meant to fail gracefully
|
|
147
|
-
ignore: [
|
|
148
|
-
"@nativescript/android",
|
|
149
|
-
"@nativescript/ios",
|
|
150
|
-
...(commonjsIgnoreList || []),
|
|
151
|
-
],
|
|
152
|
-
}),
|
|
153
|
-
nsConfigAsJsonPlugin(),
|
|
154
|
-
NativeScriptPlugin({ platform }),
|
|
155
|
-
mainEntryPlugin(cliFlags, debug),
|
|
156
|
-
// NativeScript HMR integration - track changes for incremental builds
|
|
157
|
-
hmrPlugin(targetMode),
|
|
158
|
-
// NativeScript CLI integration - enhanced IPC communication for HMR
|
|
159
|
-
cliPlugin(targetMode, cliFlags),
|
|
160
|
-
dynamicImportPlugin(),
|
|
161
|
-
// Transform Vite worker URLs to NativeScript format AFTER bundling
|
|
162
|
-
workerUrlPlugin(),
|
|
163
|
-
],
|
|
164
|
-
css: {
|
|
165
|
-
postcss: "./postcss.config.js",
|
|
166
|
-
},
|
|
167
|
-
// Development server configuration for HMR
|
|
168
|
-
server: targetMode === "development"
|
|
169
|
-
? {
|
|
170
|
-
hmr: {
|
|
171
|
-
// Enable Vite's built-in HMR
|
|
172
|
-
port: 24678, // Different port to avoid conflicts with our custom WebSocket
|
|
173
|
-
},
|
|
174
|
-
// CORS for development
|
|
175
|
-
cors: true,
|
|
176
|
-
}
|
|
177
|
-
: {},
|
|
178
|
-
// Configure worker builds to bundle everything into standalone workers
|
|
179
|
-
worker: {
|
|
180
|
-
format: "es",
|
|
181
|
-
plugins: () => getWorkerPlugins(platform),
|
|
182
|
-
rollupOptions: {
|
|
183
|
-
// Don't externalize anything - bundle everything into the worker
|
|
184
|
-
external: [],
|
|
185
|
-
output: {
|
|
186
|
-
// Inline all dynamic imports to create standalone bundle
|
|
187
|
-
inlineDynamicImports: true,
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
build: {
|
|
192
|
-
target: "esnext",
|
|
193
|
-
minify: !debug,
|
|
194
|
-
// Generate source maps for debugging
|
|
195
|
-
// Note: just disabling for now until can hook up to angular vite/analog plugin
|
|
196
|
-
sourcemap: false, //debug,
|
|
197
|
-
// Disable module preloading to avoid browser APIs
|
|
198
|
-
modulePreload: false,
|
|
199
|
-
// Optimize for development speed
|
|
200
|
-
...(targetMode === "development" && {
|
|
201
|
-
// Faster builds in development
|
|
202
|
-
reportCompressedSize: false,
|
|
203
|
-
chunkSizeWarningLimit: 2000,
|
|
204
|
-
}),
|
|
205
|
-
commonjsOptions: {
|
|
206
|
-
include: [/node_modules/],
|
|
207
|
-
},
|
|
208
|
-
rollupOptions: {
|
|
209
|
-
input: "virtual:entry-with-polyfills",
|
|
210
|
-
output: {
|
|
211
|
-
dir: path.resolve(projectRoot, "dist"),
|
|
212
|
-
format: "es", // Emit ES modules (.mjs)
|
|
213
|
-
entryFileNames: "bundle.mjs", // <- no hash here
|
|
214
|
-
chunkFileNames: (chunk) => {
|
|
215
|
-
if (chunk.name === "vendor")
|
|
216
|
-
return "vendor.mjs";
|
|
217
|
-
// Place worker files at root level, not in assets/
|
|
218
|
-
if (chunk.name && chunk.name.includes("worker")) {
|
|
219
|
-
return "[name]-[hash].js";
|
|
220
|
-
}
|
|
221
|
-
return "[name]-[hash].mjs";
|
|
222
|
-
},
|
|
223
|
-
assetFileNames: "assets/[name][extname]",
|
|
224
|
-
// Create single vendor chunk - no separate globals chunk to avoid circular deps
|
|
225
|
-
manualChunks(id) {
|
|
226
|
-
if (id.includes("node_modules")) {
|
|
227
|
-
// Note: this is work in progress on best setup
|
|
228
|
-
// Keep polyfills and Zone-dependent packages in main bundle to ensure correct execution order
|
|
229
|
-
if ([
|
|
230
|
-
"@nativescript/core",
|
|
231
|
-
"@nativescript/angular",
|
|
232
|
-
"@nativescript/zone-js",
|
|
233
|
-
"@valor/nativescript-websockets",
|
|
234
|
-
"make-error",
|
|
235
|
-
// "source-map-js",
|
|
236
|
-
"zone.js",
|
|
237
|
-
"/globals",
|
|
238
|
-
"/polyfills",
|
|
239
|
-
].includes(id)) {
|
|
240
|
-
return undefined; // Keep in main bundle
|
|
241
|
-
}
|
|
242
|
-
return "vendor";
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import vue from "@vitejs/plugin-vue";
|
|
2
|
-
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import alias from "@rollup/plugin-alias";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { dirname, resolve } from "node:path";
|
|
7
|
-
import { mergeConfig } from "vite";
|
|
8
|
-
import { baseConfig } from "./base.js";
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = dirname(__filename);
|
|
11
|
-
const plugins = [
|
|
12
|
-
{
|
|
13
|
-
...alias({
|
|
14
|
-
entries: {
|
|
15
|
-
vue: "nativescript-vue",
|
|
16
|
-
"set-value": resolve(__dirname, "../shims/set-value.js"),
|
|
17
|
-
},
|
|
18
|
-
}),
|
|
19
|
-
enforce: "pre",
|
|
20
|
-
},
|
|
21
|
-
// Enable Vue Single File Component support
|
|
22
|
-
vue({
|
|
23
|
-
// NativeScript projects often use <script setup lang="ts">
|
|
24
|
-
script: {
|
|
25
|
-
defineModel: true,
|
|
26
|
-
propsDestructure: true,
|
|
27
|
-
},
|
|
28
|
-
// Keep template compilation basic; transform asset URLs is not needed for NS
|
|
29
|
-
template: {
|
|
30
|
-
transformAssetUrls: false,
|
|
31
|
-
compilerOptions: {
|
|
32
|
-
// Only treat real web custom elements (hyphenated) as custom.
|
|
33
|
-
// DO NOT match PascalCase NativeScript tags.
|
|
34
|
-
isCustomElement: (tag) => tag.includes("-"),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
// Optional: allow JSX/TSX in Vue components if used
|
|
39
|
-
vueJsx(),
|
|
40
|
-
];
|
|
41
|
-
export const vueConfig = ({ mode }) => {
|
|
42
|
-
return mergeConfig(baseConfig({ mode }), {
|
|
43
|
-
plugins,
|
|
44
|
-
});
|
|
45
|
-
};
|
package/dist/helpers/css-tree.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { __dirname } from './project.js';
|
|
3
|
-
export const aliasCssTree = [
|
|
4
|
-
// Node.js built-ins and mdn-data polyfills for css-tree
|
|
5
|
-
{
|
|
6
|
-
find: "module",
|
|
7
|
-
replacement: path.resolve(__dirname, "../polyfills/module.js"),
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
find: "mdn-data/css/properties.json",
|
|
11
|
-
replacement: path.resolve(__dirname, "../polyfills/mdn-data-properties.js"),
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
find: "mdn-data/css/syntaxes.json",
|
|
15
|
-
replacement: path.resolve(__dirname, "../polyfills/mdn-data-syntaxes.js"),
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
find: "mdn-data/css/at-rules.json",
|
|
19
|
-
replacement: path.resolve(__dirname, "../polyfills/mdn-data-at-rules.js"),
|
|
20
|
-
},
|
|
21
|
-
];
|
package/dist/helpers/flavor.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// import { defaultConfigs } from '..';
|
|
2
|
-
import { getAllDependencies } from "./utils.js";
|
|
3
|
-
/**
|
|
4
|
-
* Utility to determine the project flavor based on installed dependencies
|
|
5
|
-
* (vue, angular, react, svelete, typescript, javascript...)
|
|
6
|
-
*/
|
|
7
|
-
export function determineProjectFlavor() {
|
|
8
|
-
const dependencies = getAllDependencies();
|
|
9
|
-
if (dependencies.includes("nativescript-vue")) {
|
|
10
|
-
return "vue";
|
|
11
|
-
}
|
|
12
|
-
if (dependencies.includes("@nativescript/angular")) {
|
|
13
|
-
return "angular";
|
|
14
|
-
}
|
|
15
|
-
if (dependencies.includes("react-nativescript")) {
|
|
16
|
-
return "react";
|
|
17
|
-
}
|
|
18
|
-
if (dependencies.includes("@nativescript-community/solid-js") ||
|
|
19
|
-
dependencies.includes("solid-js")) {
|
|
20
|
-
return "solid";
|
|
21
|
-
}
|
|
22
|
-
if (dependencies.includes("svelte-native") ||
|
|
23
|
-
dependencies.includes("@nativescript-community/svelte-native")) {
|
|
24
|
-
return "svelte";
|
|
25
|
-
}
|
|
26
|
-
// the order is important - angular, react, and svelte also include these deps
|
|
27
|
-
// but should return prior to this condition!
|
|
28
|
-
if (dependencies.includes("@nativescript/core") &&
|
|
29
|
-
dependencies.includes("typescript")) {
|
|
30
|
-
return "typescript";
|
|
31
|
-
}
|
|
32
|
-
if (dependencies.includes("@nativescript/core")) {
|
|
33
|
-
return "javascript";
|
|
34
|
-
}
|
|
35
|
-
console.info(`
|
|
36
|
-
Could not determine project flavor.
|
|
37
|
-
Please use webpack.useConfig('<flavor>') to explicitly set the base config.
|
|
38
|
-
`);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function getGlobalDefines(platform, targetMode) {
|
|
2
|
-
return {
|
|
3
|
-
// Define platform flags for runtime checks
|
|
4
|
-
__ANDROID__: JSON.stringify(platform === "android"),
|
|
5
|
-
__IOS__: JSON.stringify(platform === "ios"),
|
|
6
|
-
__VISIONOS__: JSON.stringify(platform === "visionos"),
|
|
7
|
-
__APPLE__: JSON.stringify(platform === "ios" || platform === "visionos"),
|
|
8
|
-
__DEV__: JSON.stringify(targetMode === "development"),
|
|
9
|
-
__COMMONJS__: false,
|
|
10
|
-
__NS_WEBPACK__: true,
|
|
11
|
-
__NS_ENV_VERBOSE__: !!process.env.verbose,
|
|
12
|
-
__CSS_PARSER__: JSON.stringify("css-tree"),
|
|
13
|
-
__UI_USE_XML_PARSER__: true,
|
|
14
|
-
__UI_USE_EXTERNAL_RENDERER__: false,
|
|
15
|
-
// various ecosystems use this global (react for example)
|
|
16
|
-
__TEST__: false,
|
|
17
|
-
};
|
|
18
|
-
}
|