one 1.1.311 → 1.1.313
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cleanUrl.cjs +3 -8
- package/dist/cjs/cleanUrl.cjs.map +2 -2
- package/dist/cjs/cleanUrl.native.js +5 -8
- package/dist/cjs/cleanUrl.native.js.map +2 -2
- package/dist/cjs/cli.cjs +0 -2
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/cli.native.js +1 -2
- package/dist/cjs/cli.native.js.map +2 -2
- package/dist/cjs/config.cjs +1 -1
- package/dist/cjs/config.native.js +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants.cjs +9 -1
- package/dist/cjs/constants.cjs.map +1 -1
- package/dist/cjs/constants.native.js +9 -1
- package/dist/cjs/constants.native.js.map +2 -2
- package/dist/cjs/createApp.native.cjs +1 -1
- package/dist/cjs/createApp.native.js +1 -1
- package/dist/cjs/createApp.native.js.map +1 -1
- package/dist/cjs/createHandleRequest.cjs +2 -1
- package/dist/cjs/createHandleRequest.cjs.map +1 -1
- package/dist/cjs/createHandleRequest.native.js +2 -2
- package/dist/cjs/createHandleRequest.native.js.map +2 -2
- package/dist/cjs/matchers.cjs +1 -1
- package/dist/cjs/matchers.cjs.map +1 -1
- package/dist/cjs/matchers.native.js +1 -1
- package/dist/cjs/matchers.native.js.map +1 -1
- package/dist/cjs/serve.cjs +36 -22
- package/dist/cjs/serve.cjs.map +2 -2
- package/dist/cjs/serve.native.js +18 -19
- package/dist/cjs/serve.native.js.map +2 -2
- package/dist/cjs/useLoader.cjs +1 -1
- package/dist/cjs/useLoader.native.js +1 -1
- package/dist/cjs/vite/build.cjs +8 -4
- package/dist/cjs/vite/build.cjs.map +1 -1
- package/dist/cjs/vite/build.native.js +5 -2
- package/dist/cjs/vite/build.native.js.map +2 -2
- package/dist/cjs/vite/clientTreeShakePlugin.cjs +1 -1
- package/dist/cjs/vite/clientTreeShakePlugin.native.js +1 -1
- package/dist/cjs/vite/createFileSystemRouter.cjs +1 -1
- package/dist/cjs/vite/createFileSystemRouter.native.js +1 -1
- package/dist/cjs/vite/one.cjs +43 -14
- package/dist/cjs/vite/one.cjs.map +1 -1
- package/dist/cjs/vite/one.native.js +39 -12
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/virtualEntryPlugin.cjs +5 -5
- package/dist/cjs/vite/virtualEntryPlugin.native.js +5 -5
- package/dist/cjs/vite/virtualEntryPlugin.native.js.map +1 -1
- package/dist/cjs/vite/vitePluginSsrCss.cjs +1 -1
- package/dist/cjs/vite/vitePluginSsrCss.native.js +1 -1
- package/dist/esm/cleanUrl.js +10 -9
- package/dist/esm/cleanUrl.js.map +1 -1
- package/dist/esm/cleanUrl.mjs +4 -9
- package/dist/esm/cleanUrl.mjs.map +1 -1
- package/dist/esm/cleanUrl.native.js +5 -9
- package/dist/esm/cleanUrl.native.js.map +2 -2
- package/dist/esm/cli.js +0 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/cli.mjs +0 -2
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/cli.native.js +0 -2
- package/dist/esm/cli.native.js.map +2 -2
- package/dist/esm/config.js +1 -1
- package/dist/esm/config.mjs +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants.js +5 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/constants.mjs +6 -2
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +5 -1
- package/dist/esm/constants.native.js.map +2 -2
- package/dist/esm/createApp.native.js +1 -1
- package/dist/esm/createApp.native.js.map +1 -1
- package/dist/esm/createHandleRequest.js +2 -1
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs +2 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js +2 -1
- package/dist/esm/createHandleRequest.native.js.map +2 -2
- package/dist/esm/matchers.js +1 -1
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/matchers.mjs +1 -1
- package/dist/esm/matchers.mjs.map +1 -1
- package/dist/esm/matchers.native.js +1 -1
- package/dist/esm/matchers.native.js.map +1 -1
- package/dist/esm/serve.js +12 -15
- package/dist/esm/serve.js.map +1 -1
- package/dist/esm/serve.mjs +30 -16
- package/dist/esm/serve.mjs.map +1 -1
- package/dist/esm/serve.native.js +13 -21
- package/dist/esm/serve.native.js.map +2 -2
- package/dist/esm/useLoader.js +1 -1
- package/dist/esm/useLoader.mjs +1 -1
- package/dist/esm/useLoader.native.js +1 -1
- package/dist/esm/vite/build.js +4 -2
- package/dist/esm/vite/build.js.map +1 -1
- package/dist/esm/vite/build.mjs +6 -2
- package/dist/esm/vite/build.mjs.map +1 -1
- package/dist/esm/vite/build.native.js +6 -2
- package/dist/esm/vite/build.native.js.map +2 -2
- package/dist/esm/vite/clientTreeShakePlugin.js +1 -1
- package/dist/esm/vite/clientTreeShakePlugin.mjs +1 -1
- package/dist/esm/vite/clientTreeShakePlugin.native.js +1 -1
- package/dist/esm/vite/createFileSystemRouter.js +1 -1
- package/dist/esm/vite/createFileSystemRouter.mjs +1 -1
- package/dist/esm/vite/createFileSystemRouter.native.js +1 -1
- package/dist/esm/vite/one.js +43 -14
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +43 -14
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +41 -14
- package/dist/esm/vite/one.native.js.map +2 -2
- package/dist/esm/vite/virtualEntryPlugin.js +5 -5
- package/dist/esm/vite/virtualEntryPlugin.mjs +5 -5
- package/dist/esm/vite/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/virtualEntryPlugin.native.js +5 -5
- package/dist/esm/vite/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/vite/vitePluginSsrCss.js +1 -1
- package/dist/esm/vite/vitePluginSsrCss.mjs +1 -1
- package/dist/esm/vite/vitePluginSsrCss.native.js +1 -1
- package/package.json +8 -8
- package/src/cleanUrl.ts +10 -14
- package/src/cli.ts +0 -3
- package/src/config.ts +1 -1
- package/src/constants.ts +6 -0
- package/src/createApp.native.tsx +2 -2
- package/src/createHandleRequest.ts +2 -1
- package/src/matchers.ts +1 -1
- package/src/serve.ts +31 -16
- package/src/useLoader.ts +1 -1
- package/src/vite/build.ts +4 -1
- package/src/vite/clientTreeShakePlugin.ts +1 -1
- package/src/vite/createFileSystemRouter.tsx +1 -1
- package/src/vite/one.ts +44 -11
- package/src/vite/types.ts +5 -1
- package/src/vite/virtualEntryPlugin.ts +5 -5
- package/src/vite/vitePluginSsrCss.ts +1 -1
- package/types/cleanUrl.d.ts.map +1 -1
- package/types/constants.d.ts +4 -0
- package/types/constants.d.ts.map +1 -1
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/serve.d.ts.map +1 -1
- package/types/vite/build.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/types.d.ts +5 -1
- package/types/vite/types.d.ts.map +1 -1
- package/dist/cjs/router/constants.cjs +0 -26
- package/dist/cjs/router/constants.cjs.map +0 -6
- package/dist/cjs/router/constants.native.js +0 -26
- package/dist/cjs/router/constants.native.js.map +0 -6
- package/dist/cjs/vite/loadEnv.cjs +0 -47
- package/dist/cjs/vite/loadEnv.cjs.map +0 -6
- package/dist/cjs/vite/loadEnv.native.js +0 -44
- package/dist/cjs/vite/loadEnv.native.js.map +0 -6
- package/dist/esm/router/constants.js +0 -5
- package/dist/esm/router/constants.js.map +0 -6
- package/dist/esm/router/constants.mjs +0 -3
- package/dist/esm/router/constants.mjs.map +0 -1
- package/dist/esm/router/constants.native.js +0 -5
- package/dist/esm/router/constants.native.js.map +0 -6
- package/dist/esm/vite/loadEnv.js +0 -13
- package/dist/esm/vite/loadEnv.js.map +0 -6
- package/dist/esm/vite/loadEnv.mjs +0 -13
- package/dist/esm/vite/loadEnv.mjs.map +0 -1
- package/dist/esm/vite/loadEnv.native.js +0 -16
- package/dist/esm/vite/loadEnv.native.js.map +0 -6
- package/src/router/constants.ts +0 -4
- package/src/vite/loadEnv.ts +0 -11
- package/types/router/constants.d.ts +0 -2
- package/types/router/constants.d.ts.map +0 -1
- package/types/vite/loadEnv.d.ts +0 -2
- package/types/vite/loadEnv.d.ts.map +0 -1
package/dist/esm/constants.mjs
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
const isWebClient = typeof window < "u",
|
2
2
|
isWebServer = typeof window > "u",
|
3
|
-
isNative = !1
|
4
|
-
|
3
|
+
isNative = !1,
|
4
|
+
CACHE_KEY = `${process.env.ONE_CACHE_KEY ?? Math.round(Math.random() * 1e8)}`,
|
5
|
+
LOADER_JS_POSTFIX_UNCACHED = "_vxrn_loader.js",
|
6
|
+
LOADER_JS_POSTFIX = `_${CACHE_KEY}${LOADER_JS_POSTFIX_UNCACHED}`,
|
7
|
+
PRELOAD_JS_POSTFIX = `_${CACHE_KEY}_preload.js`;
|
8
|
+
export { CACHE_KEY, LOADER_JS_POSTFIX, LOADER_JS_POSTFIX_UNCACHED, PRELOAD_JS_POSTFIX, isNative, isWebClient, isWebServer };
|
5
9
|
//# sourceMappingURL=constants.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isWebClient","window","isWebServer","isNative"],"sources":["../../src/constants.ts"],"sourcesContent":[null],"mappings":"AAAO,MAAMA,WAAA,GAAyD,OAAOC,MAAA,GAAW;EAC3EC,WAAA,GAAyD,OAAOD,MAAA,GAAW;EAC3EE,QAAA,GAAW","ignoreList":[]}
|
1
|
+
{"version":3,"names":["isWebClient","window","isWebServer","isNative","CACHE_KEY","process","env","ONE_CACHE_KEY","Math","round","random","LOADER_JS_POSTFIX_UNCACHED","LOADER_JS_POSTFIX","PRELOAD_JS_POSTFIX"],"sources":["../../src/constants.ts"],"sourcesContent":[null],"mappings":"AAAO,MAAMA,WAAA,GAAyD,OAAOC,MAAA,GAAW;EAC3EC,WAAA,GAAyD,OAAOD,MAAA,GAAW;EAC3EE,QAAA,GAAW;EAEXC,SAAA,GAAY,GAAGC,OAAA,CAAQC,GAAA,CAAIC,aAAA,IAAiBC,IAAA,CAAKC,KAAA,CAAMD,IAAA,CAAKE,MAAA,CAAO,IAAI,GAAW,CAAC;EAEnFC,0BAAA,GAA6B;EAC7BC,iBAAA,GAAoB,IAAIR,SAAS,GAAGO,0BAA0B;EAC9DE,kBAAA,GAAqB,IAAIT,SAAS","ignoreList":[]}
|
@@ -1,5 +1,9 @@
|
|
1
|
-
var isWebClient = !1, isWebServer = !1, isNative = !0
|
1
|
+
var isWebClient = !1, isWebServer = !1, isNative = !0, _process_env_ONE_CACHE_KEY, CACHE_KEY = `${(_process_env_ONE_CACHE_KEY = process.env.ONE_CACHE_KEY) !== null && _process_env_ONE_CACHE_KEY !== void 0 ? _process_env_ONE_CACHE_KEY : Math.round(Math.random() * 1e8)}`, LOADER_JS_POSTFIX_UNCACHED = "_vxrn_loader.js", LOADER_JS_POSTFIX = `_${CACHE_KEY}${LOADER_JS_POSTFIX_UNCACHED}`, PRELOAD_JS_POSTFIX = `_${CACHE_KEY}_preload.js`;
|
2
2
|
export {
|
3
|
+
CACHE_KEY,
|
4
|
+
LOADER_JS_POSTFIX,
|
5
|
+
LOADER_JS_POSTFIX_UNCACHED,
|
6
|
+
PRELOAD_JS_POSTFIX,
|
3
7
|
isNative,
|
4
8
|
isWebClient,
|
5
9
|
isWebServer
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/constants.ts"],
|
4
|
-
"mappings": "AAAO,IAAMA,cAAcC,IACdC,cAAcD,IACdE,WAAWF;",
|
5
|
-
"names": ["isWebClient", "process", "isWebServer", "isNative"]
|
4
|
+
"mappings": "AAAO,IAAMA,cAAcC,IACdC,cAAcD,IACdE,WAAWF,IAEIA,4BAAfG,YAAY,IAAGH,6BAAAA,QAAQI,IAAIC,mBAAa,QAAzBL,+BAAAA,SAAAA,6BAA6BM,KAAKC,MAAMD,KAAKE,OAAM,IAAK,GAAA,CAAA,IAEvEC,6BAA6B,mBAC7BC,oBAAoB,IAAIP,SAAAA,GAAYM,0BAAAA,IACpCE,qBAAqB,IAAIR,SAAAA;",
|
5
|
+
"names": ["isWebClient", "process", "isWebServer", "isNative", "CACHE_KEY", "env", "ONE_CACHE_KEY", "Math", "round", "random", "LOADER_JS_POSTFIX_UNCACHED", "LOADER_JS_POSTFIX", "PRELOAD_JS_POSTFIX"]
|
6
6
|
}
|
@@ -17,7 +17,7 @@ function createApp(options) {
|
|
17
17
|
return App;
|
18
18
|
}), AppRegistry.registerComponent("tamaguikitchensink", function() {
|
19
19
|
return App;
|
20
|
-
}), process.env.
|
20
|
+
}), process.env.ONE_APP_NAME && AppRegistry.registerComponent(process.env.ONE_APP_NAME, function() {
|
21
21
|
return App;
|
22
22
|
});
|
23
23
|
}
|
@@ -2,5 +2,5 @@
|
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/createApp.native.tsx"],
|
4
4
|
"mappings": ";AAAA,OAAO;AACP,SAASA,YAAY;AACrB,SAASC,aAAaC,cAAc;AAKpCA,OAAOC,WAAW;EAAC;CAA0C;AAEtD,SAASC,UAAUC,SAAuB;AAC/C,MAAMC,MAAM,WAAA;WAAM,qBAACN,MAAAA;MAAKO,UAAQ;MAACC,QAAQH,QAAQG;MAAQC,MAAK;;;AAE9DR,cAAYS,kBAAkB,QAAQ,WAAA;WAAMJ;MAG5CL,YAAYS,kBAAkB,sBAAsB,WAAA;WAAMJ;MAEtDK,QAAQC,IAAIC,gBACdZ,YAAYS,kBAAkBC,QAAQC,IAAIC,cAAc,WAAA;WAAMP;;AAElE;",
|
5
|
-
"names": ["Root", "AppRegistry", "LogBox", "ignoreLogs", "createApp", "options", "App", "isClient", "routes", "path", "registerComponent", "process", "env", "
|
5
|
+
"names": ["Root", "AppRegistry", "LogBox", "ignoreLogs", "createApp", "options", "App", "isClient", "routes", "path", "registerComponent", "process", "env", "ONE_APP_NAME"]
|
6
6
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getPathFromLoaderPath } from "./cleanUrl";
|
2
|
+
import { LOADER_JS_POSTFIX_UNCACHED } from "./constants";
|
2
3
|
import { isResponse } from "./utils/isResponse";
|
3
4
|
import { promiseWithResolvers } from "./utils/promiseWithResolvers";
|
4
5
|
import { getManifest } from "./vite/getManifest";
|
@@ -44,7 +45,7 @@ function createHandleRequest(options, handlers) {
|
|
44
45
|
}
|
45
46
|
if (request.method !== "GET")
|
46
47
|
return null;
|
47
|
-
if (handlers.handleLoader && pathname.endsWith(
|
48
|
+
if (handlers.handleLoader && pathname.endsWith(LOADER_JS_POSTFIX_UNCACHED)) {
|
48
49
|
const originalUrl = getPathFromLoaderPath(pathname), finalUrl = new URL(originalUrl, url.origin);
|
49
50
|
for (const route of pageRoutes) {
|
50
51
|
if (route.file === "" || !route.workingRegex.test(finalUrl.pathname))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/createHandleRequest.ts"],
|
4
|
-
"mappings": "AAAA,SAAS,6BAA6B;
|
4
|
+
"mappings": "AAAA,SAAS,6BAA6B;AACtC,SAA4B,kCAAkC;AAE9D,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAYrB,SAAS,oBACd,SACA,UAKA;AACA,QAAM,WAAW,YAAY;AAC7B,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,oBAAoB;AAGtC,QAAM,eACJ,SAAS,UAAU,OAAO,CAAC,KAAK,SAC9B,IAAI,IAAI,IAAI,IAAI,EAAE,GAAG,KAAK,eAAe,IAAI,OAAO,IAAI,UAAU,EAAE,GAC7D,MACN,CAAC,CAAC,GAED,gBAAgB,OAAO,OAAO,YAAY,GAK1C,iBAAiB,CAAC,GAGlB,aAAa,SAAS,WAAW,IAAI,CAAC,WAAW;AAAA,IACrD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IAAI,OAAO,OAAO,YAAY,EAAE,KAAK,IAAI,QAAQ;AAC/D,MAAI,OAAO;AACT,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,MAAM,GAAG;AACvD,YAAM,WAAW,OAAO,UAAU,GAAG;AACrC,aAAO,QAAQ,IAAI;AAAA,IACrB;AAEF,SAAO;AACT;AAGA,SAAS,eAAe,UAAkB,OAA0B;AAElE,QAAM,QADQ,IAAI,OAAO,MAAM,UAAU,EACrB,KAAK,QAAQ;AACjC,SAAK,QACE,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,OAAO,MAAM,SAAS,GAAG,CAAC,CAAC;AAAA,EACpF,IAHmB,CAAC;AAItB;",
|
5
5
|
"names": []
|
6
6
|
}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getPathFromLoaderPath } from "./cleanUrl.mjs";
|
2
|
+
import { LOADER_JS_POSTFIX_UNCACHED } from "./constants.mjs";
|
2
3
|
import { isResponse } from "./utils/isResponse.mjs";
|
3
4
|
import { promiseWithResolvers } from "./utils/promiseWithResolvers.mjs";
|
4
5
|
import { getManifest } from "./vite/getManifest.mjs";
|
@@ -47,7 +48,7 @@ function createHandleRequest(options, handlers) {
|
|
47
48
|
}
|
48
49
|
}
|
49
50
|
if (request.method !== "GET") return null;
|
50
|
-
if (handlers.handleLoader && pathname.endsWith(
|
51
|
+
if (handlers.handleLoader && pathname.endsWith(LOADER_JS_POSTFIX_UNCACHED)) {
|
51
52
|
const originalUrl = getPathFromLoaderPath(pathname),
|
52
53
|
finalUrl = new URL(originalUrl, url.origin);
|
53
54
|
for (const route of pageRoutes) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getPathFromLoaderPath","isResponse","promiseWithResolvers","getManifest","createHandleRequest","options","handlers","manifest","Error","apiRoutesMap","apiRoutes","reduce","acc","cur","page","compiledRegex","RegExp","namedRegex","apiRoutesList","Object","values","activeRequests","pageRoutes","map","route","workingRegex","handler","request","urlString","url","URL","headers","get","pathname","search","process","env","NODE_ENV","startsWith","handleAPI","apiRoute","find","test","params","getRouteParams","loaderProps","path","err","method","handleLoader","endsWith","originalUrl","finalUrl","origin","file","console","info","Headers","set","loaderResponse","getLoaderParams","Response","error","routes","handleSSR","promise","reject","resolve","ssrResponse","config","match","exec","groups","key","value","entries","namedKey","routeKeys","fromEntries"],"sources":["../../src/createHandleRequest.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,qBAAA,QAA6B;
|
1
|
+
{"version":3,"names":["getPathFromLoaderPath","LOADER_JS_POSTFIX_UNCACHED","isResponse","promiseWithResolvers","getManifest","createHandleRequest","options","handlers","manifest","Error","apiRoutesMap","apiRoutes","reduce","acc","cur","page","compiledRegex","RegExp","namedRegex","apiRoutesList","Object","values","activeRequests","pageRoutes","map","route","workingRegex","handler","request","urlString","url","URL","headers","get","pathname","search","process","env","NODE_ENV","startsWith","handleAPI","apiRoute","find","test","params","getRouteParams","loaderProps","path","err","method","handleLoader","endsWith","originalUrl","finalUrl","origin","file","console","info","Headers","set","loaderResponse","getLoaderParams","Response","error","routes","handleSSR","promise","reject","resolve","ssrResponse","config","match","exec","groups","key","value","entries","namedKey","routeKeys","fromEntries"],"sources":["../../src/createHandleRequest.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,qBAAA,QAA6B;AACtC,SAA4BC,0BAAA,QAAkC;AAE9D,SAASC,UAAA,QAAkB;AAC3B,SAASC,oBAAA,QAA4B;AACrC,SAASC,WAAA,QAAmB;AAYrB,SAASC,oBACdC,OAAA,EACAC,QAAA,EAKA;EACA,MAAMC,QAAA,GAAWJ,WAAA,CAAY;EAC7B,IAAI,CAACI,QAAA,EACH,MAAM,IAAIC,KAAA,CAAM,oBAAoB;EAGtC,MAAMC,YAAA,GACJF,QAAA,CAASG,SAAA,CAAUC,MAAA,CAAO,CAACC,GAAA,EAAKC,GAAA,MAC9BD,GAAA,CA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AAQ;EAC/D,IAAIqC,KAAA,EAAOE,MAAA,EACT,WAAW,CAACC,GAAA,EAAKC,KAAK,KAAKvD,MAAA,CAAOwD,OAAA,CAAQL,KAAA,CAAME,MAAM,GAAG;IACvD,MAAMI,QAAA,GAAWP,MAAA,CAAOQ,SAAA,CAAUJ,GAAG;IACrC9B,MAAA,CAAOiC,QAAQ,IAAIF,KAAA;EACrB;EAEF,OAAO/B,MAAA;AACT;AAGA,SAASC,eAAeX,QAAA,EAAkBT,KAAA,EAA0B;EAElE,MAAM8C,KAAA,GADQ,IAAItD,MAAA,CAAOQ,KAAA,CAAMP,UAAU,EACrBsD,IAAA,CAAKtC,QAAQ;EACjC,OAAKqC,KAAA,GACEnD,MAAA,CAAO2D,WAAA,CACZ3D,MAAA,CAAOwD,OAAA,CAAQnD,KAAA,CAAMqD,SAAS,EAAEtD,GAAA,CAAI,CAAC,CAACkD,GAAA,EAAKC,KAAK,MAAM,CAACA,KAAA,EAAOJ,KAAA,CAAME,MAAA,GAASC,GAAG,CAAC,CAAC,CACpF,IAHmB,CAAC;AAItB","ignoreList":[]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { getPathFromLoaderPath } from "./cleanUrl";
|
2
|
+
import { LOADER_JS_POSTFIX_UNCACHED } from "./constants";
|
2
3
|
import { isResponse } from "./utils/isResponse";
|
3
4
|
import { promiseWithResolvers } from "./utils/promiseWithResolvers";
|
4
5
|
import { getManifest } from "./vite/getManifest";
|
@@ -52,7 +53,7 @@ function createHandleRequest(options, handlers) {
|
|
52
53
|
if (request.method !== "GET")
|
53
54
|
return null;
|
54
55
|
if (handlers.handleLoader) {
|
55
|
-
var isClientRequestingNewRoute = pathname.endsWith(
|
56
|
+
var isClientRequestingNewRoute = pathname.endsWith(LOADER_JS_POSTFIX_UNCACHED);
|
56
57
|
if (isClientRequestingNewRoute) {
|
57
58
|
var originalUrl = getPathFromLoaderPath(pathname), finalUrl = new URL(originalUrl, url.origin), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
58
59
|
try {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/createHandleRequest.ts"],
|
4
|
-
"mappings": "AAAA,SAASA,6BAA6B;
|
5
|
-
"names": ["getPathFromLoaderPath", "isResponse", "promiseWithResolvers", "getManifest", "createHandleRequest", "options", "handlers", "manifest", "Error", "apiRoutesMap", "apiRoutes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "originalUrl", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]
|
4
|
+
"mappings": "AAAA,SAASA,6BAA6B;AACtC,SAA4BC,kCAAkC;AAE9D,SAASC,kBAAkB;AAC3B,SAASC,4BAA4B;AACrC,SAASC,mBAAmB;AAYrB,SAASC,oBACdC,SACAC,UAIC;AAED,MAAMC,WAAWJ,YAAAA;AACjB,MAAI,CAACI;AACH,UAAM,IAAIC,MAAM,oBAAoB;AAGtC,MAAMC,eACJF,SAASG,UAAUC,OAAO,SAACC,KAAKC,KAAAA;AAC9BD,eAAIC,IAAIC,IAAI,IAAI;MAAE,GAAGD;MAAKE,eAAe,IAAIC,OAAOH,IAAII,UAAU;IAAE,GAC7DL;EACT,GAAG,CAAC,CAAA,GAEAM,gBAAgBC,OAAOC,OAAOX,YAAAA,GAK9BY,iBAAiB,CAAC,GAGlBC,aAAaf,SAASe,WAAWC,IAAI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uC,QACErD,OAAO6D,YACZ7D,OAAOwD,QAAQnD,MAAMuD,SAAS,EAAExD,IAAI,SAAA,OAAA;QAAC,CAACqD,KAAKC,KAAAA,IAAM,OAAaL;WAAR;MAACK;OAAOL,gBAAAA,MAAME,YAAM,QAAZF,kBAAAA,SAAAA,SAAAA,cAAeI,GAAAA;;QAF5D,CAAC;AAItB;",
|
5
|
+
"names": ["getPathFromLoaderPath", "LOADER_JS_POSTFIX_UNCACHED", "isResponse", "promiseWithResolvers", "getManifest", "createHandleRequest", "options", "handlers", "manifest", "Error", "apiRoutesMap", "apiRoutes", "reduce", "acc", "cur", "page", "compiledRegex", "RegExp", "namedRegex", "apiRoutesList", "Object", "values", "activeRequests", "pageRoutes", "map", "route", "workingRegex", "handler", "request", "urlString", "url", "URL", "headers", "get", "pathname", "search", "process", "env", "NODE_ENV", "startsWith", "handleAPI", "apiRoute", "find", "regex", "test", "params", "getRouteParams", "loaderProps", "path", "err", "method", "handleLoader", "isClientRequestingNewRoute", "endsWith", "originalUrl", "finalUrl", "origin", "file", "console", "info", "Headers", "set", "loaderResponse", "getLoaderParams", "Response", "error", "routes", "handleSSR", "promise", "reject", "resolve", "ssrResponse", "config", "match", "exec", "groups", "entries", "key", "value", "namedKey", "routeKeys", "fromEntries"]
|
6
6
|
}
|
package/dist/esm/matchers.js
CHANGED
@@ -11,7 +11,7 @@ function matchGroupName(name) {
|
|
11
11
|
return name.match(/^(?:[^\\(\\)])*?\(([^\\/]+)\).*?$/)?.[1];
|
12
12
|
}
|
13
13
|
function matchArrayGroupName(name) {
|
14
|
-
return name.match(/(?:[^\\(\\)])*?\(([
|
14
|
+
return name.match(/(?:[^\\(\\)])*?\(?([^\\/\(\)]+,[^\\/\(\)]+)\)?.*?$/)?.[1];
|
15
15
|
}
|
16
16
|
function getNameFromFilePath(name) {
|
17
17
|
return removeSupportedExtensions(removeFileSystemDots(name));
|
package/dist/esm/matchers.js.map
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{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M,GAAG,EACT,OAAO,CAAC,KAAK,OACR,eAAe,CAAC,KAAK,QACvB,IAAI,KAAK,CAAC,GAEL,MACN,CAAC,CAAa,EAChB,KAAK,GAAG;AACb;AAEO,SAAS,+BAA+B,MAAsB;AACnE,SAAO,2BAA2B,IAAI,EAAE,QAAQ,aAAa,EAAE;AACjE;AAOO,SAAS,aAAa,MAAc;AACzC,SAAO,CAAC,KAAK,WAAW,GAAG,KAAK,KAAK,MAAM,oCAAoC,MAAM;AACvF;",
|
5
5
|
"names": []
|
6
6
|
}
|
package/dist/esm/matchers.mjs
CHANGED
@@ -11,7 +11,7 @@ function matchGroupName(name) {
|
|
11
11
|
return name.match(/^(?:[^\\(\\)])*?\(([^\\/]+)\).*?$/)?.[1];
|
12
12
|
}
|
13
13
|
function matchArrayGroupName(name) {
|
14
|
-
return name.match(/(?:[^\\(\\)])*?\(([
|
14
|
+
return name.match(/(?:[^\\(\\)])*?\(?([^\\/\(\)]+,[^\\/\(\)]+)\)?.*?$/)?.[1];
|
15
15
|
}
|
16
16
|
function getNameFromFilePath(name) {
|
17
17
|
return removeSupportedExtensions(removeFileSystemDots(name));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["matchDynamicName","name","match","matchDeepDynamicRouteName","testNotFound","test","matchGroupName","matchArrayGroupName","getNameFromFilePath","removeSupportedExtensions","removeFileSystemDots","getContextKey","normal","endsWith","replace","filePath","stripGroupSegmentsFromPath","path","split","reduce","acc","v","push","join","stripInvisibleSegmentsFromPath","isTypedRoute","startsWith"],"sources":["../../src/matchers.ts"],"sourcesContent":[null],"mappings":"AACO,SAASA,iBAAiBC,IAAA,EAAkC;EAGjE,OAAOA,IAAA,CAAKC,KAAA,CAAM,4BAA4B,IAAI,CAAC;AACrD;AAGO,SAASC,0BAA0BF,IAAA,EAAkC;EAC1E,OAAOA,IAAA,CAAKC,KAAA,CAAM,sBAAsB,IAAI,CAAC;AAC/C;AAGO,SAASE,aAAaH,IAAA,EAAuB;EAClD,OAAO,eAAeI,IAAA,CAAKJ,IAAI;AACjC;AAGO,SAASK,eAAeL,IAAA,EAAkC;EAC/D,OAAOA,IAAA,CAAKC,KAAA,CAAM,mCAAmC,IAAI,CAAC;AAC5D;AAGO,SAASK,oBAAoBN,IAAA,EAAc;EAChD,OAAOA,IAAA,CAAKC,KAAA,CAAM,
|
1
|
+
{"version":3,"names":["matchDynamicName","name","match","matchDeepDynamicRouteName","testNotFound","test","matchGroupName","matchArrayGroupName","getNameFromFilePath","removeSupportedExtensions","removeFileSystemDots","getContextKey","normal","endsWith","replace","filePath","stripGroupSegmentsFromPath","path","split","reduce","acc","v","push","join","stripInvisibleSegmentsFromPath","isTypedRoute","startsWith"],"sources":["../../src/matchers.ts"],"sourcesContent":[null],"mappings":"AACO,SAASA,iBAAiBC,IAAA,EAAkC;EAGjE,OAAOA,IAAA,CAAKC,KAAA,CAAM,4BAA4B,IAAI,CAAC;AACrD;AAGO,SAASC,0BAA0BF,IAAA,EAAkC;EAC1E,OAAOA,IAAA,CAAKC,KAAA,CAAM,sBAAsB,IAAI,CAAC;AAC/C;AAGO,SAASE,aAAaH,IAAA,EAAuB;EAClD,OAAO,eAAeI,IAAA,CAAKJ,IAAI;AACjC;AAGO,SAASK,eAAeL,IAAA,EAAkC;EAC/D,OAAOA,IAAA,CAAKC,KAAA,CAAM,mCAAmC,IAAI,CAAC;AAC5D;AAGO,SAASK,oBAAoBN,IAAA,EAAc;EAChD,OAAOA,IAAA,CAAKC,KAAA,CAAM,oDAAoD,IAAI,CAAC;AAC7E;AAEO,SAASM,oBAAoBP,IAAA,EAAsB;EACxD,OAAOQ,yBAAA,CAA0BC,oBAAA,CAAqBT,IAAI,CAAC;AAC7D;AAEO,SAASU,cAAcV,IAAA,EAAsB;EAGlD,MAAMW,MAAA,GAAS,MAAMJ,mBAAA,CAAoBP,IAAI;EAC7C,OAAKW,MAAA,CAAOC,QAAA,CAAS,SAAS,IAGvBD,MAAA,CAAOE,OAAA,CAAQ,eAAe,EAAE,IAF9BF,MAAA;AAGX;AAGO,SAASH,0BAA0BR,IAAA,EAAsB;EAC9D,OAAOA,IAAA,CAAKa,OAAA,CAAQ,qCAAqC,EAAE;AAC7D;AAGO,SAASJ,qBAAqBK,QAAA,EAA0B;EAC7D,OAAOA,QAAA,CAASD,OAAA,CAAQ,kBAAkB,EAAE;AAC9C;AAEO,SAASE,2BAA2BC,IAAA,EAAsB;EAC/D,OAAOA,IAAA,CACJC,KAAA,CAAM,GAAG,EACTC,MAAA,CAAO,CAACC,GAAA,EAAKC,CAAA,MACRf,cAAA,CAAee,CAAC,KAAK,QACvBD,GAAA,CAAIE,IAAA,CAAKD,CAAC,GAELD,GAAA,GACN,EAAc,EAChBG,IAAA,CAAK,GAAG;AACb;AAEO,SAASC,+BAA+BP,IAAA,EAAsB;EACnE,OAAOD,0BAAA,CAA2BC,IAAI,EAAEH,OAAA,CAAQ,aAAa,EAAE;AACjE;AAOO,SAASW,aAAaxB,IAAA,EAAc;EACzC,OAAO,CAACA,IAAA,CAAKyB,UAAA,CAAW,GAAG,KAAKzB,IAAA,CAAKC,KAAA,CAAM,oCAAoC,MAAM;AACvF","ignoreList":[]}
|
@@ -15,7 +15,7 @@ function matchGroupName(name) {
|
|
15
15
|
}
|
16
16
|
function matchArrayGroupName(name) {
|
17
17
|
var _name_match;
|
18
|
-
return (_name_match = name.match(/(?:[^\\(\\)])*?\(([
|
18
|
+
return (_name_match = name.match(/(?:[^\\(\\)])*?\(?([^\\/\(\)]+,[^\\/\(\)]+)\)?.*?$/)) === null || _name_match === void 0 ? void 0 : _name_match[1];
|
19
19
|
}
|
20
20
|
function getNameFromFilePath(name) {
|
21
21
|
return removeSupportedExtensions(removeFileSystemDots(name));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/Users/n8/one/packages/one/src/matchers.ts"],
|
4
|
-
"mappings": "AACO,SAASA,iBAAiBC,MAAY;MAGpCA;AAAP,UAAOA,cA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AAoBP,IAAAA;AACzC,SAAKW,OAAOC,SAAS,SAAA,IAGdD,OAAOE,QAAQ,eAAe,EAAA,IAF5BF;AAGX;AAGO,SAASH,0BAA0BR,MAAY;AACpD,SAAOA,KAAKa,QAAQ,qCAAqC,EAAA;AAC3D;AAGO,SAASJ,qBAAqBK,UAAgB;AACnD,SAAOA,SAASD,QAAQ,kBAAkB,EAAA;AAC5C;AAEO,SAASE,2BAA2BC,MAAY;AACrD,SAAOA,KACJC,MAAM,GAAA,EACNC,OAAO,SAACC,KAAKC,GAAAA;AACZ,WAAIf,eAAee,CAAAA,KAAM,QACvBD,IAAIE,KAAKD,CAAAA,GAEJD;EACT,GAAG,CAAA,CAAE,EACJG,KAAK,GAAA;AACV;AAEO,SAASC,+BAA+BP,MAAY;AACzD,SAAOD,2BAA2BC,IAAAA,EAAMH,QAAQ,aAAa,EAAA;AAC/D;AAOO,SAASW,aAAaxB,MAAY;AACvC,SAAO,CAACA,KAAKyB,WAAW,GAAA,KAAQzB,KAAKC,MAAM,oCAAA,MAA0C;AACvF;",
|
5
5
|
"names": ["matchDynamicName", "name", "match", "matchDeepDynamicRouteName", "testNotFound", "test", "matchGroupName", "matchArrayGroupName", "getNameFromFilePath", "removeSupportedExtensions", "removeFileSystemDots", "getContextKey", "normal", "endsWith", "replace", "filePath", "stripGroupSegmentsFromPath", "path", "split", "reduce", "acc", "v", "push", "join", "stripInvisibleSegmentsFromPath", "isTypedRoute", "startsWith"]
|
6
6
|
}
|
package/dist/esm/serve.js
CHANGED
@@ -1,19 +1,15 @@
|
|
1
1
|
import "./polyfills-server";
|
2
2
|
import FSExtra from "fs-extra";
|
3
|
-
import
|
4
|
-
import { getServerEntry, serve as vxrnServe } from "vxrn";
|
5
|
-
import { createHandleRequest } from "./createHandleRequest";
|
6
|
-
import { isResponse } from "./utils/isResponse";
|
7
|
-
import { isStatusRedirect } from "./utils/isStatus";
|
8
|
-
import { removeUndefined } from "./utils/removeUndefined";
|
9
|
-
import { resolveAPIRequest } from "./vite/resolveAPIRequest";
|
10
|
-
import { loadUserOneOptions } from "./vite/one";
|
11
|
-
import { labelProcess } from "./cli/label-process";
|
3
|
+
import { join } from "node:path";
|
4
|
+
import { getServerEntry, loadEnv, serve as vxrnServe } from "vxrn";
|
12
5
|
process.on("uncaughtException", (err) => {
|
13
6
|
console.error("[one] Uncaught exception", err?.stack || err);
|
14
7
|
});
|
15
8
|
async function serve(args = {}) {
|
16
|
-
|
9
|
+
const buildInfo = await FSExtra.readJSON("dist/buildInfo.json");
|
10
|
+
process.env.ONE_CACHE_KEY = buildInfo.constants.CACHE_KEY;
|
11
|
+
const { labelProcess } = await import("./cli/label-process"), { removeUndefined } = await import("./utils/removeUndefined"), { loadUserOneOptions } = await import("./vite/one");
|
12
|
+
labelProcess("serve"), loadEnv("production");
|
17
13
|
const oneOptions = await loadUserOneOptions("serve");
|
18
14
|
return process.env.VXRN_REACT_19 = "1", await vxrnServe({
|
19
15
|
server: {
|
@@ -28,13 +24,13 @@ async function serve(args = {}) {
|
|
28
24
|
cacheHeaders: args.cacheHeaders
|
29
25
|
}),
|
30
26
|
async beforeStart(options, app) {
|
31
|
-
await oneOptions.server?.beforeStart?.(options, app), await oneServe(oneOptions, options, app);
|
27
|
+
await oneOptions.server?.beforeStart?.(options, app), await oneServe(oneOptions, options, buildInfo, app);
|
32
28
|
}
|
33
29
|
}
|
34
30
|
});
|
35
31
|
}
|
36
|
-
async function oneServe(options, vxrnOptions, app) {
|
37
|
-
const
|
32
|
+
async function oneServe(options, vxrnOptions, buildInfo, app) {
|
33
|
+
const { createHandleRequest } = await import("./createHandleRequest"), { isResponse } = await import("./utils/isResponse"), { isStatusRedirect } = await import("./utils/isStatus"), { resolveAPIRequest } = await import("./vite/resolveAPIRequest"), isAPIRequest = /* @__PURE__ */ new WeakMap(), root = vxrnOptions.root || ".", redirects = options.web?.redirects;
|
38
34
|
if (redirects)
|
39
35
|
for (const redirect of redirects)
|
40
36
|
app.get(redirect.source, (context) => {
|
@@ -44,7 +40,6 @@ async function oneServe(options, vxrnOptions, app) {
|
|
44
40
|
});
|
45
41
|
return context.redirect(destinationUrl, redirect.permanent ? 301 : 302);
|
46
42
|
});
|
47
|
-
const buildInfo = await FSExtra.readJSON(toAbsolute("dist/buildInfo.json"));
|
48
43
|
if (!buildInfo)
|
49
44
|
throw new Error("No build info found, have you run build?");
|
50
45
|
const { routeMap, builtRoutes } = buildInfo, routeToBuildInfo = {};
|
@@ -91,7 +86,9 @@ async function oneServe(options, vxrnOptions, app) {
|
|
91
86
|
if (route.type === "ssr") {
|
92
87
|
const buildInfo2 = routeToBuildInfo[route.page];
|
93
88
|
if (!buildInfo2)
|
94
|
-
throw new Error(
|
89
|
+
throw new Error(
|
90
|
+
`No buildinfo found for ${url}, route: ${route.page}, in keys: ${Object.keys(routeToBuildInfo)}`
|
91
|
+
);
|
95
92
|
try {
|
96
93
|
const loaderData = await (await import(buildInfo2.serverJsPath)).loader?.(loaderProps), preloads = buildInfo2.preloads, headers = new Headers();
|
97
94
|
return headers.set("content-type", "text/html"), new Response(
|
package/dist/esm/serve.js.map
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/serve.ts"],
|
4
|
-
"mappings": "AAAA,OAAO;AAEP,OAAO,aAAa;AAEpB,
|
4
|
+
"mappings": "AAAA,OAAO;AAEP,OAAO,aAAa;AAEpB,SAAS,YAAY;AAErB,SAAS,gBAAgB,SAAS,SAAS,iBAAiB;AAK5D,QAAQ,GAAG,qBAAqB,CAAC,QAAQ;AACvC,UAAQ,MAAM,4BAA4B,KAAK,SAAS,GAAG;AAC7D,CAAC;AAED,eAAsB,MAAM,OAA8B,CAAC,GAAG;AAC5D,QAAM,YAAa,MAAM,QAAQ,SAAS,qBAAqB;AAG/D,UAAQ,IAAI,gBAAgB,UAAU,UAAU;AAGhD,QAAM,EAAE,aAAa,IAAI,MAAM,OAAO,qBAAqB,GACrD,EAAE,gBAAgB,IA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,cACF;AAAA,YACF;AAGF,iBAAO;AAAA,QACT;AAEA,eAAO,QAAQ;AAAA,UACb;AAAA,UACA;AAAA,UACA,aAAa,IAAI,OAAO,IACpB;AAAA,YACE,iBAAiB;AAAA,UACnB,IACA;AAAA,QACN;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM,kCAAmC,IAAY,KAAQ,EAAE;AAAA,IACzE;AAEA,UAAM,KAAK;AAAA,EACb,CAAC;AACH;",
|
5
5
|
"names": ["buildInfo"]
|
6
6
|
}
|
package/dist/esm/serve.mjs
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
import "./polyfills-server.mjs";
|
2
2
|
import FSExtra from "fs-extra";
|
3
|
-
import
|
4
|
-
import { getServerEntry, serve as vxrnServe } from "vxrn";
|
5
|
-
import { createHandleRequest } from "./createHandleRequest.mjs";
|
6
|
-
import { isResponse } from "./utils/isResponse.mjs";
|
7
|
-
import { isStatusRedirect } from "./utils/isStatus.mjs";
|
8
|
-
import { removeUndefined } from "./utils/removeUndefined.mjs";
|
9
|
-
import { resolveAPIRequest } from "./vite/resolveAPIRequest.mjs";
|
10
|
-
import { loadUserOneOptions } from "./vite/one.mjs";
|
11
|
-
import { labelProcess } from "./cli/label-process.mjs";
|
3
|
+
import { join } from "node:path";
|
4
|
+
import { getServerEntry, loadEnv, serve as vxrnServe } from "vxrn";
|
12
5
|
process.on("uncaughtException", err => {
|
13
6
|
console.error("[one] Uncaught exception", err?.stack || err);
|
14
7
|
});
|
15
8
|
async function serve(args = {}) {
|
16
|
-
|
9
|
+
const buildInfo = await FSExtra.readJSON("dist/buildInfo.json");
|
10
|
+
process.env.ONE_CACHE_KEY = buildInfo.constants.CACHE_KEY;
|
11
|
+
const {
|
12
|
+
labelProcess
|
13
|
+
} = await import("./cli/label-process.mjs"),
|
14
|
+
{
|
15
|
+
removeUndefined
|
16
|
+
} = await import("./utils/removeUndefined.mjs"),
|
17
|
+
{
|
18
|
+
loadUserOneOptions
|
19
|
+
} = await import("./vite/one.mjs");
|
20
|
+
labelProcess("serve"), loadEnv("production");
|
17
21
|
const oneOptions = await loadUserOneOptions("serve");
|
18
22
|
return process.env.VXRN_REACT_19 = "1", await vxrnServe({
|
19
23
|
server: {
|
@@ -28,15 +32,26 @@ async function serve(args = {}) {
|
|
28
32
|
cacheHeaders: args.cacheHeaders
|
29
33
|
}),
|
30
34
|
async beforeStart(options, app) {
|
31
|
-
await oneOptions.server?.beforeStart?.(options, app), await oneServe(oneOptions, options, app);
|
35
|
+
await oneOptions.server?.beforeStart?.(options, app), await oneServe(oneOptions, options, buildInfo, app);
|
32
36
|
}
|
33
37
|
}
|
34
38
|
});
|
35
39
|
}
|
36
|
-
async function oneServe(options, vxrnOptions, app) {
|
37
|
-
const
|
40
|
+
async function oneServe(options, vxrnOptions, buildInfo, app) {
|
41
|
+
const {
|
42
|
+
createHandleRequest
|
43
|
+
} = await import("./createHandleRequest.mjs"),
|
44
|
+
{
|
45
|
+
isResponse
|
46
|
+
} = await import("./utils/isResponse.mjs"),
|
47
|
+
{
|
48
|
+
isStatusRedirect
|
49
|
+
} = await import("./utils/isStatus.mjs"),
|
50
|
+
{
|
51
|
+
resolveAPIRequest
|
52
|
+
} = await import("./vite/resolveAPIRequest.mjs"),
|
38
53
|
isAPIRequest = /* @__PURE__ */new WeakMap(),
|
39
|
-
|
54
|
+
root = vxrnOptions.root || ".",
|
40
55
|
redirects = options.web?.redirects;
|
41
56
|
if (redirects) for (const redirect of redirects) app.get(redirect.source, context => {
|
42
57
|
const destinationUrl = redirect.destination.replace(/:\w+/g, param => {
|
@@ -45,7 +60,6 @@ async function oneServe(options, vxrnOptions, app) {
|
|
45
60
|
});
|
46
61
|
return context.redirect(destinationUrl, redirect.permanent ? 301 : 302);
|
47
62
|
});
|
48
|
-
const buildInfo = await FSExtra.readJSON(toAbsolute("dist/buildInfo.json"));
|
49
63
|
if (!buildInfo) throw new Error("No build info found, have you run build?");
|
50
64
|
const {
|
51
65
|
routeMap,
|
@@ -93,7 +107,7 @@ async function oneServe(options, vxrnOptions, app) {
|
|
93
107
|
}) {
|
94
108
|
if (route.type === "ssr") {
|
95
109
|
const buildInfo2 = routeToBuildInfo[route.page];
|
96
|
-
if (!buildInfo2) throw new Error(`No buildinfo found for ${url}, route: ${route.page}`);
|
110
|
+
if (!buildInfo2) throw new Error(`No buildinfo found for ${url}, route: ${route.page}, in keys: ${Object.keys(routeToBuildInfo)}`);
|
97
111
|
try {
|
98
112
|
const loaderData = await (await import(buildInfo2.serverJsPath)).loader?.(loaderProps),
|
99
113
|
preloads = buildInfo2.preloads,
|
package/dist/esm/serve.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["FSExtra","
|
1
|
+
{"version":3,"names":["FSExtra","join","getServerEntry","loadEnv","serve","vxrnServe","process","on","err","console","error","stack","args","buildInfo","readJSON","env","ONE_CACHE_KEY","constants","CACHE_KEY","labelProcess","removeUndefined","loadUserOneOptions","oneOptions","VXRN_REACT_19","server","port","host","compress","platform","cacheHeaders","beforeStart","options","app","oneServe","vxrnOptions","createHandleRequest","isResponse","isStatusRedirect","resolveAPIRequest","isAPIRequest","WeakMap","root","redirects","web","redirect","get","source","context","destinationUrl","destination","replace","param","paramName","substring","req","permanent","Error","routeMap","builtRoutes","routeToBuildInfo","route","cleanPath","serverOptions","render","default","apiCJS","build","api","outputFormat","handleRequest","handleAPI","request","loaderProps","apiFile","cwd","page","set","params","handleSSR","url","type","buildInfo2","Object","keys","loaderData","serverJsPath","loader","preloads","headers","Headers","Response","path","htmlFiles","key","readFile","use","next","html","raw","response","handler","status","location","info","json"],"sources":["../../src/serve.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,OAAOA,OAAA,MAAa;AAEpB,SAASC,IAAA,QAAY;AAErB,SAASC,cAAA,EAAgBC,OAAA,EAASC,KAAA,IAASC,SAAA,QAAiB;AAK5DC,OAAA,CAAQC,EAAA,CAAG,qBAAsBC,GAAA,IAAQ;EAC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AA,CAAQH,QAAA,CAAS0D,QAAA,EAAUH,QAAA,CAASE,MAAM;UACnD;UAEA,IAAI9D,YAAA,CAAaM,GAAA,CAAI0B,OAAO,GAC1B,IAAI;YAEF4B,QAAA,CAASX,OAAA,CAAQZ,GAAA,CAAI,iBAAiB,UAAU;UAClD,SAASpE,GAAA,EAAK;YACZC,OAAA,CAAQ8F,IAAA,CACN,6CACExD,OAAA,CAAQO,GAAA,CAAIqC,IACd,wBAAwBQ,QAAA,CAASX,OAAA,CAAQ3C,GAAA,CAAI,eAAe,CAAC,cAC7DrC,GACF;UACF;UAGF,OAAO2F,QAAA;QACT;QAEA,OAAOpD,OAAA,CAAQyD,IAAA,CACbL,QAAA,EACA,KACA5D,YAAA,CAAaM,GAAA,CAAI0B,OAAO,IACpB;UACE,iBAAiB;QACnB,IACA,MACN;MACF;IACF,SAAS/D,GAAA,EAAK;MACZC,OAAA,CAAQC,KAAA,CAAM,kCAAmCF,GAAA,CAAYG,KAAQ,EAAE;IACzE;IAEA,MAAMqF,IAAA,CAAK;EACb,CAAC;AACH","ignoreList":[]}
|
package/dist/esm/serve.native.js
CHANGED
@@ -1,20 +1,15 @@
|
|
1
1
|
import "./polyfills-server";
|
2
2
|
import FSExtra from "fs-extra";
|
3
|
-
import
|
4
|
-
import { getServerEntry, serve as vxrnServe } from "vxrn";
|
5
|
-
import { createHandleRequest } from "./createHandleRequest";
|
6
|
-
import { isResponse } from "./utils/isResponse";
|
7
|
-
import { isStatusRedirect } from "./utils/isStatus";
|
8
|
-
import { removeUndefined } from "./utils/removeUndefined";
|
9
|
-
import { resolveAPIRequest } from "./vite/resolveAPIRequest";
|
10
|
-
import { loadUserOneOptions } from "./vite/one";
|
11
|
-
import { labelProcess } from "./cli/label-process";
|
3
|
+
import { join } from "node:path";
|
4
|
+
import { getServerEntry, loadEnv, serve as vxrnServe } from "vxrn";
|
12
5
|
process.on("uncaughtException", function(err) {
|
13
6
|
console.error("[one] Uncaught exception", err?.stack || err);
|
14
7
|
});
|
15
8
|
async function serve() {
|
16
|
-
var args = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
17
|
-
|
9
|
+
var args = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, buildInfo = await FSExtra.readJSON("dist/buildInfo.json");
|
10
|
+
process.env.ONE_CACHE_KEY = buildInfo.constants.CACHE_KEY;
|
11
|
+
var { labelProcess } = await import("./cli/label-process"), { removeUndefined } = await import("./utils/removeUndefined"), { loadUserOneOptions } = await import("./vite/one");
|
12
|
+
labelProcess("serve"), loadEnv("production");
|
18
13
|
var oneOptions = await loadUserOneOptions("serve");
|
19
14
|
return process.env.VXRN_REACT_19 = "1", await vxrnServe({
|
20
15
|
server: {
|
@@ -30,15 +25,13 @@ async function serve() {
|
|
30
25
|
}),
|
31
26
|
async beforeStart(options, app) {
|
32
27
|
var _oneOptions_server_beforeStart, _oneOptions_server;
|
33
|
-
await ((_oneOptions_server = oneOptions.server) === null || _oneOptions_server === void 0 || (_oneOptions_server_beforeStart = _oneOptions_server.beforeStart) === null || _oneOptions_server_beforeStart === void 0 ? void 0 : _oneOptions_server_beforeStart.call(_oneOptions_server, options, app)), await oneServe(oneOptions, options, app);
|
28
|
+
await ((_oneOptions_server = oneOptions.server) === null || _oneOptions_server === void 0 || (_oneOptions_server_beforeStart = _oneOptions_server.beforeStart) === null || _oneOptions_server_beforeStart === void 0 ? void 0 : _oneOptions_server_beforeStart.call(_oneOptions_server, options, app)), await oneServe(oneOptions, options, buildInfo, app);
|
34
29
|
}
|
35
30
|
}
|
36
31
|
});
|
37
32
|
}
|
38
|
-
async function oneServe(options, vxrnOptions, app) {
|
39
|
-
var _options_web, _options_build_api, _options_build,
|
40
|
-
return Path.resolve(root, p);
|
41
|
-
}, redirects = (_options_web = options.web) === null || _options_web === void 0 ? void 0 : _options_web.redirects;
|
33
|
+
async function oneServe(options, vxrnOptions, buildInfo, app) {
|
34
|
+
var _options_web, _options_build_api, _options_build, { createHandleRequest } = await import("./createHandleRequest"), { isResponse } = await import("./utils/isResponse"), { isStatusRedirect } = await import("./utils/isStatus"), { resolveAPIRequest } = await import("./vite/resolveAPIRequest"), isAPIRequest = /* @__PURE__ */ new WeakMap(), root = vxrnOptions.root || ".", redirects = (_options_web = options.web) === null || _options_web === void 0 ? void 0 : _options_web.redirects;
|
42
35
|
if (redirects) {
|
43
36
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
44
37
|
try {
|
@@ -63,7 +56,6 @@ async function oneServe(options, vxrnOptions, app) {
|
|
63
56
|
}
|
64
57
|
}
|
65
58
|
}
|
66
|
-
var buildInfo = await FSExtra.readJSON(toAbsolute("dist/buildInfo.json"));
|
67
59
|
if (!buildInfo)
|
68
60
|
throw new Error("No build info found, have you run build?");
|
69
61
|
var { routeMap, builtRoutes } = buildInfo, routeToBuildInfo = {}, _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0;
|
@@ -111,11 +103,11 @@ async function oneServe(options, vxrnOptions, app) {
|
|
111
103
|
async handleSSR(param) {
|
112
104
|
var { route: route2, url, loaderProps } = param;
|
113
105
|
if (route2.type === "ssr") {
|
114
|
-
var
|
115
|
-
if (!
|
116
|
-
throw new Error(`No buildinfo found for ${url}, route: ${route2.page}`);
|
106
|
+
var _$buildInfo = routeToBuildInfo[route2.page];
|
107
|
+
if (!_$buildInfo)
|
108
|
+
throw new Error(`No buildinfo found for ${url}, route: ${route2.page}, in keys: ${Object.keys(routeToBuildInfo)}`);
|
117
109
|
try {
|
118
|
-
var _exported_loader, exported = await import(
|
110
|
+
var _exported_loader, exported = await import(_$buildInfo.serverJsPath), loaderData = await ((_exported_loader = exported.loader) === null || _exported_loader === void 0 ? void 0 : _exported_loader.call(exported, loaderProps)), preloads = _$buildInfo.preloads, headers = new Headers();
|
119
111
|
return headers.set("content-type", "text/html"), new Response(await render({
|
120
112
|
loaderData,
|
121
113
|
loaderProps,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
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GAAW;AACxB,cAAIjE,iBAAiBiE,SAASE,MAAM,GAAG;AACrC,gBAAMC,WAAW,GAAGH,SAASZ,QAAQ7C,IAAI,UAAA,KAAe,EAAA;AACxD,mBAAOE,QAAQH,SAAS6D,UAAUH,SAASE,MAAM;UACnD;AAEA,cAAIjE,aAAaM,IAAI4B,OAAAA;AACnB,gBAAI;AAEF6B,uBAASZ,QAAQZ,IAAI,iBAAiB,UAAA;YACxC,SAASvE,KAAK;AACZC,sBAAQwF,KACN,6CACEjD,QAAQO,IAAIuC,IAAI,wBACMS,SAASZ,QAAQ7C,IAAI,eAAA,CAAA,cAC7CtC,GAAAA;YAEJ;AAGF,iBAAO+F;QACT;AAEA,eAAOvD,QAAQ2D,KACbJ,UACA,KACA/D,aAAaM,IAAI4B,OAAAA,IACb;UACE,iBAAiB;QACnB,IACAhD,MAAAA;MAER;IACF,SAASlB,KAAK;AACZC,cAAQC,MAAM,kCAAmCF,IAAY,KAAQ,EAAE;IACzE;AAEA,UAAM4F,KAAAA;EACR,CAAA;AACF;",
|
5
|
+
"names": ["FSExtra", "join", "getServerEntry", "loadEnv", "serve", "vxrnServe", "process", "on", "err", "console", "error", "stack", "args", "buildInfo", "readJSON", "env", "ONE_CACHE_KEY", "constants", "CACHE_KEY", "labelProcess", "removeUndefined", "loadUserOneOptions", "oneOptions", "VXRN_REACT_19", "server", "port", "undefined", "host", "compress", "platform", "cacheHeaders", "beforeStart", "options", "app", "oneServe", "vxrnOptions", "createHandleRequest", "isResponse", "isStatusRedirect", "resolveAPIRequest", "isAPIRequest", "WeakMap", "root", "redirects", "web", "redirect", "get", "source", "context", "destinationUrl", "destination", "replace", "param", "paramName", "substring", "req", "permanent", "Error", "routeMap", "builtRoutes", "routeToBuildInfo", "route", "cleanPath", "serverOptions", "entryServer", "entry", "render", "default", "apiCJS", "build", "api", "outputFormat", "handleRequest", "handleAPI", "request", "loaderProps", "apiFile", "cwd", "page", "set", "params", "handleSSR", "url", "type", "Object", "keys", "exported", "serverJsPath", "loaderData", "loader", "preloads", "headers", "Headers", "Response", "path", "htmlFiles", "key", "info", "readFile", "use", "next", "html", "raw", "response", "handler", "status", "location", "json"]
|
6
6
|
}
|