one 1.24.2 → 1.24.4
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/cjs/vite/plugins/fileSystemRouterPlugin.cjs +9 -0
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +9 -0
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +3 -3
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +4 -4
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.cjs +32 -2
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.native.js +38 -2
- package/dist/cjs/vite/plugins/virtualEntryPlugin.test.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +9 -0
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +9 -0
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +3 -3
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +4 -4
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.mjs +32 -2
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.native.js +38 -2
- package/dist/esm/vite/plugins/virtualEntryPlugin.test.native.js.map +1 -1
- package/package.json +9 -9
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +10 -0
- package/src/vite/plugins/virtualEntryPlugin.test.ts +51 -2
- package/src/vite/plugins/virtualEntryPlugin.ts +27 -16
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
|
@@ -228,24 +228,35 @@ export function createVirtualEntry(options: {
|
|
|
228
228
|
? `linking: ${JSON.stringify(options.router.linking)},`
|
|
229
229
|
: ''
|
|
230
230
|
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
// the
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
231
|
+
// the react-refresh preamble has to be installed before the first
|
|
232
|
+
// compiler-wrapped module evaluates, or that module throws "React refresh
|
|
233
|
+
// preamble was not loaded" and client init aborts. /@one/dev.js installs
|
|
234
|
+
// it, but it cannot be relied on to win: it is a DEFERRED module script,
|
|
235
|
+
// so it waits for the document to finish parsing, while the client entry
|
|
236
|
+
// is async and runs the moment it arrives. that race is decided by
|
|
237
|
+
// document size. a SPA shell is a few hundred bytes and dev.js wins; a
|
|
238
|
+
// prerendered +ssg/ssr page is hundreds of KB and the entry regularly
|
|
239
|
+
// wins, throws on the first route module, and leaves the page unhydrated
|
|
240
|
+
// and unthemed on the very same server. bundled dev has no working
|
|
241
|
+
// /@one/dev.js at all, since it imports /@vite/client, which does not
|
|
242
|
+
// exist there.
|
|
243
|
+
// so install it from the entry, whose body is the one point guaranteed to
|
|
244
|
+
// run before the lazily-globbed route modules in every dev client. the
|
|
245
|
+
// !$RefreshReg$ guard makes this a no-op when dev.js already won, and
|
|
246
|
+
// dev.js keeps its own install because injectIntoGlobalHook wants to run
|
|
247
|
+
// before react evaluates. ('one' and /@react-refresh are node_modules /
|
|
248
|
+
// the runtime, so neither is refresh-wrapped, and on the client the setup
|
|
249
|
+
// file is imported lazily rather than statically.)
|
|
250
|
+
// this must stay gated to a dev CLIENT. `isBundled` is true for EVERY
|
|
251
|
+
// environment during build, so it cannot gate this on its own, and a prod
|
|
252
|
+
// build emitting an import of /@react-refresh would reference a module
|
|
253
|
+
// that only exists while serving.
|
|
254
|
+
const isDevClient =
|
|
255
|
+
this.environment.mode === 'dev' && this.environment.name === 'client'
|
|
256
|
+
const refreshPreambleImport = isDevClient
|
|
246
257
|
? `import { injectIntoGlobalHook as __oneInjectRefresh } from '/@react-refresh'`
|
|
247
258
|
: ''
|
|
248
|
-
const refreshPreambleSetup =
|
|
259
|
+
const refreshPreambleSetup = isDevClient
|
|
249
260
|
? `if (typeof window !== 'undefined' && !window.$RefreshReg$) {
|
|
250
261
|
__oneInjectRefresh(window)
|
|
251
262
|
window.$RefreshReg$ = () => {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSystemRouterPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/fileSystemRouterPlugin.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAY1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,kBAAkB,CAAA;AA0BtD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,GAAG,CAAC,aAAa,EAC1B,UAAU,EAAE,UAAU,GACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"fileSystemRouterPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/fileSystemRouterPlugin.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAY1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,kBAAkB,CAAA;AA0BtD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,GAAG,CAAC,aAAa,EAC1B,UAAU,EAAE,UAAU,GACrB,MAAM,CAk3BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualEntryPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/virtualEntryPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AASlC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAsGnC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACpC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAA;IAChB,SAAS,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"virtualEntryPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/virtualEntryPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AASlC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAsGnC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACpC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAA;IAChB,SAAS,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,MAAM,CA+MT"}
|