@base44-preview/vite-plugin 1.0.52-pr.148.ed1fce6 → 1.0.52-pr.150.911b6c2
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 +33 -7
- package/dist/hidden-source-maps-plugin.d.ts +39 -0
- package/dist/hidden-source-maps-plugin.d.ts.map +1 -0
- package/dist/hidden-source-maps-plugin.js +70 -0
- package/dist/hidden-source-maps-plugin.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/hidden-source-maps-plugin.ts +102 -0
- package/src/index.ts +7 -0
- package/src/utils.ts +6 -1
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ The plugin registers these sub-plugins when running in a sandbox (`MODAL_SANDBOX
|
|
|
47
47
|
4. **html-injections** — Injects sandbox-side scripts into the HTML while serving. Under bundled dev mode its sibling **html-injections-bundled** injects them instead, before the HTML is bundled.
|
|
48
48
|
5. **html-injections-production** — Injects the analytics tracker into production builds.
|
|
49
49
|
|
|
50
|
+
In or out of a sandbox, `base44-hidden-source-maps` joins any build run with `BASE44_HIDDEN_SOURCE_MAPS=1` (see [Hidden source maps](#hidden-source-maps-base44-builds)).
|
|
51
|
+
|
|
50
52
|
Dev and production are told apart by the Vite command (`serve` vs `build`), not by the presence of a dev server in the HTML transform context — bundled dev runs the HTML through the build-shaped transform, where no server is passed.
|
|
51
53
|
|
|
52
54
|
Outside a sandbox, only the core plugin runs (with optional API proxy support via `VITE_BASE44_APP_BASE_URL`).
|
|
@@ -136,6 +138,37 @@ read `ok: true`. That window is already covered server-side by the existing
|
|
|
136
138
|
`dev_server_error_classifier` (install / start failures surface as `409`). This
|
|
137
139
|
endpoint's job is **post-load HMR / compile errors**, not cold-start failures.
|
|
138
140
|
|
|
141
|
+
### Hidden source maps (Base44 builds)
|
|
142
|
+
|
|
143
|
+
A Base44 platform option, set by Base44's build environment rather than by the
|
|
144
|
+
app. When `vite build` runs with
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
BASE44_HIDDEN_SOURCE_MAPS=1
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
the `base44-hidden-source-maps` sub-plugin gives the browser build source maps
|
|
151
|
+
that the platform stores privately and uses to map browser stack traces to the
|
|
152
|
+
app's own files:
|
|
153
|
+
|
|
154
|
+
- **Hidden.** `build.sourcemap: "hidden"`: `.map` files are emitted, but no
|
|
155
|
+
bundle file carries a `sourceMappingURL` comment, so browsers never fetch them.
|
|
156
|
+
- **No source text.** `sourcemapExcludeSources` is set on every output (under
|
|
157
|
+
`build.rollupOptions.output` before Vite 8, `build.rolldownOptions.output` on
|
|
158
|
+
Vite 8), so a map holds file names and positions only.
|
|
159
|
+
- **The app's choice wins.** If `build.sourcemap` is already set, by the app's
|
|
160
|
+
config or by another plugin, to any value including `false`, source maps are
|
|
161
|
+
left exactly as configured.
|
|
162
|
+
- **Browser build only.** With Vite environments (6+) only the client
|
|
163
|
+
environment changes; an SSR or Worker build keeps its own config. A Vite 5
|
|
164
|
+
`vite build --ssr` is left alone too.
|
|
165
|
+
- **Build only.** The dev server and `vite preview` are untouched.
|
|
166
|
+
|
|
167
|
+
Like `BASE44_BUILD_STATUS_ENABLED`, the variable is read when the plugin
|
|
168
|
+
assembles its plugin list, so the app's `vite.config.js` does not change. Unset,
|
|
169
|
+
or set to anything other than `1`, the sub-plugin is not added and the build
|
|
170
|
+
output is byte-identical to a build without it.
|
|
171
|
+
|
|
139
172
|
### Route request logs (full-stack apps)
|
|
140
173
|
|
|
141
174
|
Dev-only. While a Nitro server route serves a request that carries
|
|
@@ -214,13 +247,6 @@ npm run build # TypeScript compilation (plugin)
|
|
|
214
247
|
npm run build:bridge # tsup bundle (bridge ES module for browsers)
|
|
215
248
|
```
|
|
216
249
|
|
|
217
|
-
## Testing
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm run test:unit # unit tests (vitest)
|
|
221
|
-
npm run validate-exports # checks every path in the package.json export map exists; run after both builds
|
|
222
|
-
```
|
|
223
|
-
|
|
224
250
|
## Server-side static-egress TCP
|
|
225
251
|
|
|
226
252
|
The server-only `base44:runtime` module exports `staticEgress.connect(address,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BuildEnvironmentOptions, Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Hidden source maps for the browser build, for Base44's build environment.
|
|
4
|
+
*
|
|
5
|
+
* `index.ts` adds this plugin only when `BASE44_HIDDEN_SOURCE_MAPS=1`. It sets
|
|
6
|
+
* `build.sourcemap: "hidden"`, so the bundle carries no `sourceMappingURL`
|
|
7
|
+
* comment, and leaves the source text out of the maps. The platform keeps the
|
|
8
|
+
* maps private and uses them to map browser stack traces to the app's files.
|
|
9
|
+
*
|
|
10
|
+
* - Build only (`apply: "build"`): the dev server and `vite preview` never see it.
|
|
11
|
+
* - Browser build only: under Vite's environments (6+) only the client
|
|
12
|
+
* environment changes, so an SSR or Worker build keeps its own config.
|
|
13
|
+
* - The app's choice wins: a `build.sourcemap` already set, `false` included,
|
|
14
|
+
* leaves source maps exactly as configured.
|
|
15
|
+
*/
|
|
16
|
+
type RollupOutput = Record<string, unknown>;
|
|
17
|
+
type BuildOptions = BuildEnvironmentOptions & {
|
|
18
|
+
rolldownOptions?: {
|
|
19
|
+
output?: RollupOutput | RollupOutput[];
|
|
20
|
+
} & Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export interface HiddenSourceMapsOptions {
|
|
23
|
+
/** Whether bundler options live under `rolldownOptions`. Defaults to the installed Vite's. */
|
|
24
|
+
rolldown?: boolean;
|
|
25
|
+
/** Whether Vite has environments (`configEnvironment`). Defaults to the installed Vite's. */
|
|
26
|
+
environments?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The build options with hidden, sourceless maps, or `null` when the app chose
|
|
30
|
+
* its own `sourcemap`. Builds new objects all the way down: Vite shares nested
|
|
31
|
+
* build objects between the top-level config and every environment, so editing
|
|
32
|
+
* one in place would leak into the SSR build.
|
|
33
|
+
*/
|
|
34
|
+
export declare function withHiddenSourceMaps(build: BuildOptions | undefined, { rolldown }: {
|
|
35
|
+
rolldown: boolean;
|
|
36
|
+
}): BuildOptions | null;
|
|
37
|
+
export declare function hiddenSourceMapsPlugin({ rolldown, environments, }?: HiddenSourceMapsOptions): Plugin;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=hidden-source-maps-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-source-maps-plugin.d.ts","sourceRoot":"","sources":["../src/hidden-source-maps-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG5D;;;;;;;;;;;;;GAaG;AAEH,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,KAAK,YAAY,GAAG,uBAAuB,GAAG;IAE5C,eAAe,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxF,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAOD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,YAAY,GAAG,SAAS,EAC/B,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAClC,YAAY,GAAG,IAAI,CAmBrB;AAED,wBAAgB,sBAAsB,CAAC,EACrC,QAAyB,EACzB,YAA6B,GAC9B,GAAE,uBAA4B,GAAG,MAAM,CAgCvC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isVite6OrLater, isVite8OrLater } from "./utils.js";
|
|
2
|
+
const excludeSources = (output) => ({
|
|
3
|
+
...output,
|
|
4
|
+
sourcemapExcludeSources: true,
|
|
5
|
+
});
|
|
6
|
+
/**
|
|
7
|
+
* The build options with hidden, sourceless maps, or `null` when the app chose
|
|
8
|
+
* its own `sourcemap`. Builds new objects all the way down: Vite shares nested
|
|
9
|
+
* build objects between the top-level config and every environment, so editing
|
|
10
|
+
* one in place would leak into the SSR build.
|
|
11
|
+
*/
|
|
12
|
+
export function withHiddenSourceMaps(build, { rolldown }) {
|
|
13
|
+
if (build?.sourcemap !== undefined)
|
|
14
|
+
return null;
|
|
15
|
+
// Vite 8 aliases `rollupOptions` to `rolldownOptions` with a getter. Read
|
|
16
|
+
// either, write only the one this Vite reads, and drop the other so the two
|
|
17
|
+
// never disagree.
|
|
18
|
+
const { rollupOptions, rolldownOptions, ...rest } = (build ?? {});
|
|
19
|
+
const bundlerOptions = (rolldown ? rolldownOptions ?? rollupOptions : rollupOptions) ?? {};
|
|
20
|
+
const { output } = bundlerOptions;
|
|
21
|
+
return {
|
|
22
|
+
...rest,
|
|
23
|
+
sourcemap: "hidden",
|
|
24
|
+
[rolldown ? "rolldownOptions" : "rollupOptions"]: {
|
|
25
|
+
...bundlerOptions,
|
|
26
|
+
// An app may build several outputs; each one leaves its sources out.
|
|
27
|
+
output: Array.isArray(output) ? output.map(excludeSources) : excludeSources(output),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function hiddenSourceMapsPlugin({ rolldown = isVite8OrLater, environments = isVite6OrLater, } = {}) {
|
|
32
|
+
return {
|
|
33
|
+
name: "base44-hidden-source-maps",
|
|
34
|
+
apply: "build",
|
|
35
|
+
// Run after other plugins' config hooks, so a source-map choice made by a
|
|
36
|
+
// framework plugin counts as the app's own.
|
|
37
|
+
config: {
|
|
38
|
+
order: "post",
|
|
39
|
+
handler(config, env) {
|
|
40
|
+
// Vite 6+ is handled per environment below: the top-level build
|
|
41
|
+
// options feed the SSR environment too.
|
|
42
|
+
if (environments)
|
|
43
|
+
return;
|
|
44
|
+
// Vite 5 runs an SSR build as its own `vite build --ssr`.
|
|
45
|
+
if (config.build?.ssr || env.isSsrBuild)
|
|
46
|
+
return;
|
|
47
|
+
const build = withHiddenSourceMaps(config.build, { rolldown });
|
|
48
|
+
if (build)
|
|
49
|
+
config.build = build;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
configEnvironment: {
|
|
53
|
+
order: "post",
|
|
54
|
+
handler(name, config) {
|
|
55
|
+
if (!environments)
|
|
56
|
+
return;
|
|
57
|
+
const consumer = config.consumer ?? (name === "client" ? "client" : "server");
|
|
58
|
+
if (consumer !== "client")
|
|
59
|
+
return;
|
|
60
|
+
const build = withHiddenSourceMaps(config.build, { rolldown });
|
|
61
|
+
// Assigned rather than returned: Vite merges a returned config into the
|
|
62
|
+
// existing one, which would append to an `output` array instead of
|
|
63
|
+
// updating each entry.
|
|
64
|
+
if (build)
|
|
65
|
+
config.build = build;
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=hidden-source-maps-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-source-maps-plugin.js","sourceRoot":"","sources":["../src/hidden-source-maps-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA8B5D,MAAM,cAAc,GAAG,CAAC,MAAgC,EAAgB,EAAE,CAAC,CAAC;IAC1E,GAAG,MAAM;IACT,uBAAuB,EAAE,IAAI;CAC9B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAA+B,EAC/B,EAAE,QAAQ,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AE,QAAQ,EAAE,CAAC,CAAC;gBAC/D,IAAI,KAAK;oBAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;YAClC,CAAC;SACF;QACD,iBAAiB,EAAE;YACjB,KAAK,EAAE,MAAM;YACb,OAAO,CAAC,IAAI,EAAE,MAAM;gBAClB,IAAI,CAAC,YAAY;oBAAE,OAAO;gBAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAC9E,IAAI,QAAQ,KAAK,QAAQ;oBAAE,OAAO;gBAClC,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC/D,wEAAwE;gBACxE,mEAAmE;gBACnE,uBAAuB;gBACvB,IAAI,KAAK;oBAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;YAClC,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAC;AAY/C,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmBlD,eAAO,MAAM,uBAAuB,UAWnC,CAAC;AAeF,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,IAAI,GAAE;IACJ,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACvB,iBAqQP"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { base44RuntimePlugin } from "./base44-runtime-plugin.js";
|
|
|
9
9
|
import { workerdCompatPlugin } from "./workerd-compat-plugin.js";
|
|
10
10
|
import { privateDataSourcesPlugin } from "./private-data-sources-plugin.js";
|
|
11
11
|
import { routeRequestLogPlugin } from "./route-request-log/vite-plugin.js";
|
|
12
|
+
import { hiddenSourceMapsPlugin } from "./hidden-source-maps-plugin.js";
|
|
12
13
|
const PLATFORM_API_PROXY_PATH = "^/api/(apps|app-logs)([/?]|$)";
|
|
13
14
|
const isRunningInSandbox = !!process.env.MODAL_SANDBOX_ID;
|
|
14
15
|
// Both optimizer spellings mean the same thing here: treat .js files as JSX,
|
|
@@ -241,6 +242,12 @@ export default function vitePlugin(opts = {}) {
|
|
|
241
242
|
// because Nitro runs dev routes in a worker whose console the Vite process
|
|
242
243
|
// never sees. Inert for apps without Nitro and for requests without the id.
|
|
243
244
|
routeRequestLogPlugin(),
|
|
245
|
+
// Base44's build environment sets BASE44_HIDDEN_SOURCE_MAPS=1 to get private
|
|
246
|
+
// source maps for the browser build. Gated here, like build-status, so an
|
|
247
|
+
// unset flag leaves the pipeline and the build output exactly as before.
|
|
248
|
+
...(process.env.BASE44_HIDDEN_SOURCE_MAPS === "1"
|
|
249
|
+
? [hiddenSourceMapsPlugin()]
|
|
250
|
+
: []),
|
|
244
251
|
];
|
|
245
252
|
}
|
|
246
253
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2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kB;SAChC,CAAC;QACF,yEAAyE;QACzE,iEAAiE;QACjE,sEAAsE;QACtE,wEAAwE;QACxE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG;YACjD,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACvB,CAAC,CAAC,EAAE,CAAC;QACP,yEAAyE;QACzE,2EAA2E;QAC3E,yEAAyE;QACzE,iEAAiE;QACjE,mBAAmB,EAAE;QACrB,+EAA+E;QAC/E,wEAAwE;QACxE,mBAAmB,EAAE;QACrB,kEAAkE;QAClE,wBAAwB,EAAE;QAC1B,wEAAwE;QACxE,wEAAwE;QACxE,2EAA2E;QAC3E,4EAA4E;QAC5E,qBAAqB,EAAE;QACvB,6EAA6E;QAC7E,0EAA0E;QAC1E,yEAAyE;QACzE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,KAAK,GAAG;YAC/C,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC;YAC5B,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,SAAiB,CAAC;AAI7C,eAAO,MAAM,cAAc,SAAiB,CAAC;AAc7C,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,EAAE,MAAM,GACX,MAAM,EAAE,CAmBV"}
|
package/dist/utils.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { version as viteVersion } from "vite";
|
|
4
|
+
const viteMajor = Number(viteVersion.split(".")[0]);
|
|
5
|
+
// Vite 6 added environments (`environments`, `configEnvironment`).
|
|
6
|
+
export const isVite6OrLater = viteMajor >= 6;
|
|
4
7
|
// Vite 8 pre-bundles deps with Rolldown instead of esbuild and deprecates
|
|
5
8
|
// `optimizeDeps.esbuildOptions`.
|
|
6
|
-
export const isVite8OrLater =
|
|
9
|
+
export const isVite8OrLater = viteMajor >= 8;
|
|
7
10
|
/**
|
|
8
11
|
* The package that owns an optimizeDeps entry. Deep entries like
|
|
9
12
|
* `react-dom/client` are separate entries to Vite's optimizer but are declared
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAE9C,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAE9C,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpD,mEAAmE;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,IAAI,CAAC,CAAC;AAE7C,0EAA0E;AAC1E,iCAAiC;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,IAAI,CAAC,CAAC;AAE7C;;;;GAIG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAC1B,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,QAAkB,EAClB,IAAY;IAEZ,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,MAAM,OAAO,GAAG;YACd,GAAG,WAAW,CAAC,YAAY;YAC3B,GAAG,WAAW,CAAC,eAAe;YAC9B,GAAG,WAAW,CAAC,gBAAgB;SAChC,CAAC;QAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { BuildEnvironmentOptions, Plugin } from "vite";
|
|
2
|
+
import { isVite6OrLater, isVite8OrLater } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hidden source maps for the browser build, for Base44's build environment.
|
|
6
|
+
*
|
|
7
|
+
* `index.ts` adds this plugin only when `BASE44_HIDDEN_SOURCE_MAPS=1`. It sets
|
|
8
|
+
* `build.sourcemap: "hidden"`, so the bundle carries no `sourceMappingURL`
|
|
9
|
+
* comment, and leaves the source text out of the maps. The platform keeps the
|
|
10
|
+
* maps private and uses them to map browser stack traces to the app's files.
|
|
11
|
+
*
|
|
12
|
+
* - Build only (`apply: "build"`): the dev server and `vite preview` never see it.
|
|
13
|
+
* - Browser build only: under Vite's environments (6+) only the client
|
|
14
|
+
* environment changes, so an SSR or Worker build keeps its own config.
|
|
15
|
+
* - The app's choice wins: a `build.sourcemap` already set, `false` included,
|
|
16
|
+
* leaves source maps exactly as configured.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
type RollupOutput = Record<string, unknown>;
|
|
20
|
+
type BuildOptions = BuildEnvironmentOptions & {
|
|
21
|
+
// Vite 8's spelling. Vite 7's types do not know it.
|
|
22
|
+
rolldownOptions?: { output?: RollupOutput | RollupOutput[] } & Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface HiddenSourceMapsOptions {
|
|
26
|
+
/** Whether bundler options live under `rolldownOptions`. Defaults to the installed Vite's. */
|
|
27
|
+
rolldown?: boolean;
|
|
28
|
+
/** Whether Vite has environments (`configEnvironment`). Defaults to the installed Vite's. */
|
|
29
|
+
environments?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const excludeSources = (output: RollupOutput | undefined): RollupOutput => ({
|
|
33
|
+
...output,
|
|
34
|
+
sourcemapExcludeSources: true,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The build options with hidden, sourceless maps, or `null` when the app chose
|
|
39
|
+
* its own `sourcemap`. Builds new objects all the way down: Vite shares nested
|
|
40
|
+
* build objects between the top-level config and every environment, so editing
|
|
41
|
+
* one in place would leak into the SSR build.
|
|
42
|
+
*/
|
|
43
|
+
export function withHiddenSourceMaps(
|
|
44
|
+
build: BuildOptions | undefined,
|
|
45
|
+
{ rolldown }: { rolldown: boolean }
|
|
46
|
+
): BuildOptions | null {
|
|
47
|
+
if (build?.sourcemap !== undefined) return null;
|
|
48
|
+
|
|
49
|
+
// Vite 8 aliases `rollupOptions` to `rolldownOptions` with a getter. Read
|
|
50
|
+
// either, write only the one this Vite reads, and drop the other so the two
|
|
51
|
+
// never disagree.
|
|
52
|
+
const { rollupOptions, rolldownOptions, ...rest } = (build ?? {}) as BuildOptions;
|
|
53
|
+
const bundlerOptions = (rolldown ? rolldownOptions ?? rollupOptions : rollupOptions) ?? {};
|
|
54
|
+
const { output } = bundlerOptions as { output?: RollupOutput | RollupOutput[] };
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
...rest,
|
|
58
|
+
sourcemap: "hidden",
|
|
59
|
+
[rolldown ? "rolldownOptions" : "rollupOptions"]: {
|
|
60
|
+
...bundlerOptions,
|
|
61
|
+
// An app may build several outputs; each one leaves its sources out.
|
|
62
|
+
output: Array.isArray(output) ? output.map(excludeSources) : excludeSources(output),
|
|
63
|
+
},
|
|
64
|
+
} as BuildOptions;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function hiddenSourceMapsPlugin({
|
|
68
|
+
rolldown = isVite8OrLater,
|
|
69
|
+
environments = isVite6OrLater,
|
|
70
|
+
}: HiddenSourceMapsOptions = {}): Plugin {
|
|
71
|
+
return {
|
|
72
|
+
name: "base44-hidden-source-maps",
|
|
73
|
+
apply: "build",
|
|
74
|
+
// Run after other plugins' config hooks, so a source-map choice made by a
|
|
75
|
+
// framework plugin counts as the app's own.
|
|
76
|
+
config: {
|
|
77
|
+
order: "post",
|
|
78
|
+
handler(config, env) {
|
|
79
|
+
// Vite 6+ is handled per environment below: the top-level build
|
|
80
|
+
// options feed the SSR environment too.
|
|
81
|
+
if (environments) return;
|
|
82
|
+
// Vite 5 runs an SSR build as its own `vite build --ssr`.
|
|
83
|
+
if (config.build?.ssr || env.isSsrBuild) return;
|
|
84
|
+
const build = withHiddenSourceMaps(config.build, { rolldown });
|
|
85
|
+
if (build) config.build = build;
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
configEnvironment: {
|
|
89
|
+
order: "post",
|
|
90
|
+
handler(name, config) {
|
|
91
|
+
if (!environments) return;
|
|
92
|
+
const consumer = config.consumer ?? (name === "client" ? "client" : "server");
|
|
93
|
+
if (consumer !== "client") return;
|
|
94
|
+
const build = withHiddenSourceMaps(config.build, { rolldown });
|
|
95
|
+
// Assigned rather than returned: Vite merges a returned config into the
|
|
96
|
+
// existing one, which would append to an `output` array instead of
|
|
97
|
+
// updating each entry.
|
|
98
|
+
if (build) config.build = build;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { base44RuntimePlugin } from "./base44-runtime-plugin.js";
|
|
|
10
10
|
import { workerdCompatPlugin } from "./workerd-compat-plugin.js";
|
|
11
11
|
import { privateDataSourcesPlugin } from "./private-data-sources-plugin.js";
|
|
12
12
|
import { routeRequestLogPlugin } from "./route-request-log/vite-plugin.js";
|
|
13
|
+
import { hiddenSourceMapsPlugin } from "./hidden-source-maps-plugin.js";
|
|
13
14
|
export type { DocumentScript } from "./consts.js";
|
|
14
15
|
|
|
15
16
|
const PLATFORM_API_PROXY_PATH = "^/api/(apps|app-logs)([/?]|$)";
|
|
@@ -316,5 +317,11 @@ export default function vitePlugin(
|
|
|
316
317
|
// because Nitro runs dev routes in a worker whose console the Vite process
|
|
317
318
|
// never sees. Inert for apps without Nitro and for requests without the id.
|
|
318
319
|
routeRequestLogPlugin(),
|
|
320
|
+
// Base44's build environment sets BASE44_HIDDEN_SOURCE_MAPS=1 to get private
|
|
321
|
+
// source maps for the browser build. Gated here, like build-status, so an
|
|
322
|
+
// unset flag leaves the pipeline and the build output exactly as before.
|
|
323
|
+
...(process.env.BASE44_HIDDEN_SOURCE_MAPS === "1"
|
|
324
|
+
? [hiddenSourceMapsPlugin()]
|
|
325
|
+
: []),
|
|
319
326
|
];
|
|
320
327
|
}
|
package/src/utils.ts
CHANGED
|
@@ -2,9 +2,14 @@ import { readFileSync, existsSync } from "fs";
|
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { version as viteVersion } from "vite";
|
|
4
4
|
|
|
5
|
+
const viteMajor = Number(viteVersion.split(".")[0]);
|
|
6
|
+
|
|
7
|
+
// Vite 6 added environments (`environments`, `configEnvironment`).
|
|
8
|
+
export const isVite6OrLater = viteMajor >= 6;
|
|
9
|
+
|
|
5
10
|
// Vite 8 pre-bundles deps with Rolldown instead of esbuild and deprecates
|
|
6
11
|
// `optimizeDeps.esbuildOptions`.
|
|
7
|
-
export const isVite8OrLater =
|
|
12
|
+
export const isVite8OrLater = viteMajor >= 8;
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* The package that owns an optimizeDeps entry. Deep entries like
|