@gjsify/nativescript-vite 0.4.40 → 0.4.41
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/lib/index.d.ts +5 -4
- package/lib/index.js +24 -4
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -32,9 +32,10 @@ export type UserConfigInput = UserConfig | ((env: ConfigEnv) => UserConfig | Pro
|
|
|
32
32
|
export declare function defineNativescriptConfig(options?: GjsifyNativescriptViteOptions, userConfig?: UserConfigInput): (env: ConfigEnv) => Promise<UserConfig>;
|
|
33
33
|
export default defineNativescriptConfig;
|
|
34
34
|
/**
|
|
35
|
-
* Apply the
|
|
36
|
-
* config: drop function-replacement aliases
|
|
37
|
-
*
|
|
38
|
-
* `plugins` — the input is not
|
|
35
|
+
* Apply the Vite 8 / Rolldown + type-check fixes to a returned `@nativescript/vite`
|
|
36
|
+
* config: drop function-replacement aliases, the explicit `@rollup/plugin-commonjs`,
|
|
37
|
+
* and the vite-side `ns-typescript-check` (gjsify type-checks via `gjsify tsc`).
|
|
38
|
+
* Returns a shallow copy with the fixed `resolve` and `plugins` — the input is not
|
|
39
|
+
* mutated.
|
|
39
40
|
*/
|
|
40
41
|
export declare function applyVite8Fixes(config: UserConfig): UserConfig;
|
package/lib/index.js
CHANGED
|
@@ -104,11 +104,14 @@ async function loadUpstreamConfig(env) {
|
|
|
104
104
|
throw new Error('@gjsify/nativescript-vite requires the optional peer "@nativescript/vite" exporting `typescriptConfig` ' +
|
|
105
105
|
'(install it alongside @nativescript/core in your NativeScript app).', { cause: lastError });
|
|
106
106
|
}
|
|
107
|
+
/** Upstream `@nativescript/vite` TypeScript-check plugin name (see `helpers/typescript-check.js`). */
|
|
108
|
+
const TS_CHECK_PLUGIN = 'ns-typescript-check';
|
|
107
109
|
/**
|
|
108
|
-
* Apply the
|
|
109
|
-
* config: drop function-replacement aliases
|
|
110
|
-
*
|
|
111
|
-
* `plugins` — the input is not
|
|
110
|
+
* Apply the Vite 8 / Rolldown + type-check fixes to a returned `@nativescript/vite`
|
|
111
|
+
* config: drop function-replacement aliases, the explicit `@rollup/plugin-commonjs`,
|
|
112
|
+
* and the vite-side `ns-typescript-check` (gjsify type-checks via `gjsify tsc`).
|
|
113
|
+
* Returns a shallow copy with the fixed `resolve` and `plugins` — the input is not
|
|
114
|
+
* mutated.
|
|
112
115
|
*/
|
|
113
116
|
export function applyVite8Fixes(config) {
|
|
114
117
|
const out = { ...config };
|
|
@@ -130,6 +133,23 @@ export function applyVite8Fixes(config) {
|
|
|
130
133
|
'if your @nativescript/vite version renamed/wrapped @rollup/plugin-commonjs, the Rolldown ' +
|
|
131
134
|
'CommonJS fix may not have applied.');
|
|
132
135
|
}
|
|
136
|
+
// Drop the vite-side `ns-typescript-check` plugin. A bundler should bundle,
|
|
137
|
+
// not type-check — gjsify defers the authoritative TypeScript gate to
|
|
138
|
+
// `gjsify tsc` / the app's own `check` script (the same separation Vite's
|
|
139
|
+
// esbuild/SWC pipeline already makes). The vite-side check additionally runs
|
|
140
|
+
// a SEPARATE program that loads the full `@nativescript/types` android
|
|
141
|
+
// globals and, under TS 6+, fails the build on the *standard* NativeScript
|
|
142
|
+
// `createNativeView(): android.view.View` override — a covariance the app's
|
|
143
|
+
// own `tsc --noEmit` accepts. Removing it (not silencing it) keeps the build
|
|
144
|
+
// honest; type errors surface in `gjsify tsc`, the real gate.
|
|
145
|
+
const tsCheckBefore = countPluginByName(out.plugins, TS_CHECK_PLUGIN);
|
|
146
|
+
out.plugins = stripPluginByName(out.plugins, TS_CHECK_PLUGIN);
|
|
147
|
+
if (tsCheckBefore > 0) {
|
|
148
|
+
console.warn(`[@gjsify/nativescript-vite] removed the vite-side "${TS_CHECK_PLUGIN}" plugin — gjsify defers ` +
|
|
149
|
+
"TypeScript checking to `gjsify tsc` / the app's own `check` script (the vite-side check fails " +
|
|
150
|
+
'the build on the standard NativeScript `createNativeView` override under TS 6+, which the ' +
|
|
151
|
+
"app's own tsc accepts). Run `gjsify tsc` for the authoritative type gate.");
|
|
152
|
+
}
|
|
133
153
|
}
|
|
134
154
|
return out;
|
|
135
155
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/nativescript-vite",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.41",
|
|
4
4
|
"description": "Vite 8 / Rolldown compatibility + gjsify transforms for building NativeScript apps — composes @nativescript/vite and fixes the pieces Rolldown rejects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@gjsify/vite-plugin-gjsify": "^0.4.
|
|
41
|
+
"@gjsify/vite-plugin-gjsify": "^0.4.41"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@nativescript/canvas": "*",
|