one 1.1.297 → 1.1.299
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/Root.js.map +1 -1
- package/dist/cjs/Root.native.js.map +1 -1
- package/dist/cjs/cleanUrl.js +9 -2
- package/dist/cjs/cleanUrl.js.map +1 -1
- package/dist/cjs/cleanUrl.native.js +5 -2
- package/dist/cjs/cleanUrl.native.js.map +2 -2
- package/dist/cjs/vite/replaceLoader.js +7 -1
- package/dist/cjs/vite/replaceLoader.js.map +1 -1
- package/dist/cjs/vite/replaceLoader.native.js +7 -1
- package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
- package/dist/esm/Root.js.map +1 -1
- package/dist/esm/Root.mjs.map +1 -1
- package/dist/esm/Root.native.js +110 -104
- package/dist/esm/Root.native.js.map +6 -1
- package/dist/esm/Route.native.js +12 -10
- package/dist/esm/Route.native.js.map +6 -1
- package/dist/esm/cleanUrl.js +9 -2
- package/dist/esm/cleanUrl.js.map +1 -1
- package/dist/esm/cleanUrl.mjs +7 -2
- package/dist/esm/cleanUrl.mjs.map +1 -1
- package/dist/esm/cleanUrl.native.js +16 -13
- package/dist/esm/cleanUrl.native.js.map +6 -1
- package/dist/esm/cli/label-process.native.js +5 -4
- package/dist/esm/cli/label-process.native.js.map +6 -1
- package/dist/esm/cli/main.native.js +8 -13
- package/dist/esm/cli/main.native.js.map +6 -1
- package/dist/esm/cli/prebuild.native.js +5 -5
- package/dist/esm/cli/prebuild.native.js.map +6 -1
- package/dist/esm/cli/run.native.js +21 -28
- package/dist/esm/cli/run.native.js.map +6 -1
- package/dist/esm/cli.native.js +119 -148
- package/dist/esm/cli.native.js.map +6 -1
- package/dist/esm/clientLoaderResolver.native.js +9 -6
- package/dist/esm/clientLoaderResolver.native.js.map +6 -1
- package/dist/esm/config.native.js +12 -11
- package/dist/esm/config.native.js.map +6 -1
- package/dist/esm/constants.native.js +7 -5
- package/dist/esm/constants.native.js.map +6 -1
- package/dist/esm/createApp.native.js +13 -9
- package/dist/esm/createApp.native.js.map +6 -1
- package/dist/esm/createHandleRequest.native.js +55 -64
- package/dist/esm/createHandleRequest.native.js.map +6 -1
- package/dist/esm/createRoute.native.js +16 -16
- package/dist/esm/createRoute.native.js.map +6 -1
- package/dist/esm/fallbackViews/Sitemap.native.js +6 -3
- package/dist/esm/fallbackViews/Sitemap.native.js.map +6 -1
- package/dist/esm/fallbackViews/Unmatched.native.js +5 -3
- package/dist/esm/fallbackViews/Unmatched.native.js.map +6 -1
- package/dist/esm/fork/NavigationContainer.native.js +24 -31
- package/dist/esm/fork/NavigationContainer.native.js.map +6 -1
- package/dist/esm/fork/createMemoryHistory.native.js +99 -115
- package/dist/esm/fork/createMemoryHistory.native.js.map +6 -1
- package/dist/esm/fork/extractPathFromURL.native.js +16 -15
- package/dist/esm/fork/extractPathFromURL.native.js.map +6 -1
- package/dist/esm/fork/findFocusedRoute.native.js +6 -5
- package/dist/esm/fork/findFocusedRoute.native.js.map +6 -1
- package/dist/esm/fork/getPathFromState.native.js +127 -140
- package/dist/esm/fork/getPathFromState.native.js.map +6 -1
- package/dist/esm/fork/getStateFromPath.native.js +292 -288
- package/dist/esm/fork/getStateFromPath.native.js.map +6 -1
- package/dist/esm/fork/useLinking.native.js +70 -61
- package/dist/esm/fork/useLinking.native.js.map +6 -1
- package/dist/esm/fork/validatePathConfig.native.js +15 -9
- package/dist/esm/fork/validatePathConfig.native.js.map +6 -1
- package/dist/esm/getLinkingConfig.native.js +11 -6
- package/dist/esm/getLinkingConfig.native.js.map +6 -1
- package/dist/esm/getReactNavigationConfig.native.js +28 -20
- package/dist/esm/getReactNavigationConfig.native.js.map +6 -1
- package/dist/esm/getRoutes.native.js +249 -229
- package/dist/esm/getRoutes.native.js.map +6 -1
- package/dist/esm/getURL.native.js +4 -4
- package/dist/esm/getURL.native.js.map +6 -1
- package/dist/esm/head/Head.android.js +5 -3
- package/dist/esm/head/Head.android.js.map +6 -1
- package/dist/esm/head/Head.ios.js +144 -132
- package/dist/esm/head/Head.ios.js.map +6 -1
- package/dist/esm/head/Head.native.js +7 -7
- package/dist/esm/head/Head.native.js.map +6 -1
- package/dist/esm/head/HeadModule.native.js +6 -6
- package/dist/esm/head/HeadModule.native.js.map +6 -1
- package/dist/esm/head/index.native.js +2 -2
- package/dist/esm/head/index.native.js.map +6 -1
- package/dist/esm/head/types.native.js +1 -2
- package/dist/esm/head/types.native.js.map +6 -1
- package/dist/esm/head/url.native.js +10 -8
- package/dist/esm/head/url.native.js.map +6 -1
- package/dist/esm/hooks.native.js +53 -34
- package/dist/esm/hooks.native.js.map +6 -1
- package/dist/esm/imperative-api.native.js +9 -6
- package/dist/esm/imperative-api.native.js.map +6 -1
- package/dist/esm/import-mode/index.android.js +4 -3
- package/dist/esm/import-mode/index.android.js.map +6 -1
- package/dist/esm/import-mode/index.ios.js +4 -3
- package/dist/esm/import-mode/index.ios.js.map +6 -1
- package/dist/esm/import-mode/index.native.js +3 -1
- package/dist/esm/import-mode/index.native.js.map +6 -1
- package/dist/esm/index.native.js +65 -27
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/interfaces/router.native.js +4 -2
- package/dist/esm/interfaces/router.native.js.map +6 -1
- package/dist/esm/layouts/Drawer.native.js +7 -6
- package/dist/esm/layouts/Drawer.native.js.map +6 -1
- package/dist/esm/layouts/Stack.native.js +7 -6
- package/dist/esm/layouts/Stack.native.js.map +6 -1
- package/dist/esm/layouts/Tabs.native.js +42 -39
- package/dist/esm/layouts/Tabs.native.js.map +6 -1
- package/dist/esm/layouts/withLayoutContext.native.js +51 -48
- package/dist/esm/layouts/withLayoutContext.native.js.map +6 -1
- package/dist/esm/link/Link.native.js +62 -53
- package/dist/esm/link/Link.native.js.map +6 -1
- package/dist/esm/link/Redirect.native.js +8 -9
- package/dist/esm/link/Redirect.native.js.map +6 -1
- package/dist/esm/link/href.native.js +28 -27
- package/dist/esm/link/href.native.js.map +6 -1
- package/dist/esm/link/linking.native.js +51 -40
- package/dist/esm/link/linking.native.js.map +6 -1
- package/dist/esm/link/path.native.js +28 -19
- package/dist/esm/link/path.native.js.map +6 -1
- package/dist/esm/link/useLinkTo.native.js +22 -20
- package/dist/esm/link/useLinkTo.native.js.map +6 -1
- package/dist/esm/link/useLoadedNavigation.native.js +30 -23
- package/dist/esm/link/useLoadedNavigation.native.js.map +6 -1
- package/dist/esm/matchers.native.js +16 -3
- package/dist/esm/matchers.native.js.map +6 -1
- package/dist/esm/platform.native.js +4 -2
- package/dist/esm/platform.native.js.map +6 -1
- package/dist/esm/polyfills-mobile.native.js +4 -5
- package/dist/esm/polyfills-mobile.native.js.map +6 -1
- package/dist/esm/polyfills-server.native.js +1 -1
- package/dist/esm/polyfills-server.native.js.map +6 -1
- package/dist/esm/render.native.js +3 -1
- package/dist/esm/render.native.js.map +6 -1
- package/dist/esm/router/RouterStore.native.js +1 -2
- package/dist/esm/router/RouterStore.native.js.map +6 -1
- package/dist/esm/router/constants.native.js +4 -2
- package/dist/esm/router/constants.native.js.map +6 -1
- package/dist/esm/router/getNormalizedStatePath.native.js +18 -17
- package/dist/esm/router/getNormalizedStatePath.native.js.map +6 -1
- package/dist/esm/router/lastAction.native.js +10 -9
- package/dist/esm/router/lastAction.native.js.map +6 -1
- package/dist/esm/router/router.native.js +135 -114
- package/dist/esm/router/router.native.js.map +6 -1
- package/dist/esm/router/serverLocationContext.native.js +4 -2
- package/dist/esm/router/serverLocationContext.native.js.map +6 -1
- package/dist/esm/router/useInitializeOneRouter.native.js +8 -5
- package/dist/esm/router/useInitializeOneRouter.native.js.map +6 -1
- package/dist/esm/serve.native.js +77 -104
- package/dist/esm/serve.native.js.map +6 -1
- package/dist/esm/server/createRoutesManifest.native.js +14 -11
- package/dist/esm/server/createRoutesManifest.native.js.map +6 -1
- package/dist/esm/server/getServerManifest.native.js +61 -67
- package/dist/esm/server/getServerManifest.native.js.map +6 -1
- package/dist/esm/server-render.native.js +9 -10
- package/dist/esm/server-render.native.js.map +6 -1
- package/dist/esm/sortRoutes.native.js +27 -17
- package/dist/esm/sortRoutes.native.js.map +6 -1
- package/dist/esm/typed-routes/generateRouteTypes.native.js +10 -11
- package/dist/esm/typed-routes/generateRouteTypes.native.js.map +6 -1
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js +38 -37
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +6 -1
- package/dist/esm/types.native.js +1 -2
- package/dist/esm/types.native.js.map +6 -1
- package/dist/esm/useFocusEffect.native.js +25 -22
- package/dist/esm/useFocusEffect.native.js.map +6 -1
- package/dist/esm/useLoader.native.js +50 -50
- package/dist/esm/useLoader.native.js.map +6 -1
- package/dist/esm/useNavigation.native.js +23 -19
- package/dist/esm/useNavigation.native.js.map +6 -1
- package/dist/esm/useScreens.native.js +143 -160
- package/dist/esm/useScreens.native.js.map +6 -1
- package/dist/esm/useViteRoutes.native.js +25 -28
- package/dist/esm/useViteRoutes.native.js.map +6 -1
- package/dist/esm/utils/assertIsReady.native.js +6 -3
- package/dist/esm/utils/assertIsReady.native.js.map +6 -1
- package/dist/esm/utils/dynamicImport.native.js +5 -3
- package/dist/esm/utils/dynamicImport.native.js.map +6 -1
- package/dist/esm/utils/existsAsync.native.js +6 -4
- package/dist/esm/utils/existsAsync.native.js.map +6 -1
- package/dist/esm/utils/getPageExport.native.js +12 -11
- package/dist/esm/utils/getPageExport.native.js.map +6 -1
- package/dist/esm/utils/globDir.native.js +5 -3
- package/dist/esm/utils/globDir.native.js.map +6 -1
- package/dist/esm/utils/hashString.native.js +4 -2
- package/dist/esm/utils/hashString.native.js.map +6 -1
- package/dist/esm/utils/isResponse.native.js +4 -2
- package/dist/esm/utils/isResponse.native.js.map +6 -1
- package/dist/esm/utils/isStatus.native.js +4 -2
- package/dist/esm/utils/isStatus.native.js.map +6 -1
- package/dist/esm/utils/promiseWithResolvers.native.js +7 -7
- package/dist/esm/utils/promiseWithResolvers.native.js.map +6 -1
- package/dist/esm/utils/rand.native.js +5 -3
- package/dist/esm/utils/rand.native.js.map +6 -1
- package/dist/esm/utils/redirect.native.js +7 -5
- package/dist/esm/utils/redirect.native.js.map +6 -1
- package/dist/esm/utils/removeSearch.native.js +4 -2
- package/dist/esm/utils/removeSearch.native.js.map +6 -1
- package/dist/esm/utils/removeUndefined.native.js +6 -3
- package/dist/esm/utils/removeUndefined.native.js.map +6 -1
- package/dist/esm/utils/requireResolve.native.js +4 -2
- package/dist/esm/utils/requireResolve.native.js.map +6 -1
- package/dist/esm/utils/url.native.js +6 -2
- package/dist/esm/utils/url.native.js.map +6 -1
- package/dist/esm/utils/weakKey.native.js +11 -10
- package/dist/esm/utils/weakKey.native.js.map +6 -1
- package/dist/esm/utils/weakMemo.native.js +8 -8
- package/dist/esm/utils/weakMemo.native.js.map +6 -1
- package/dist/esm/views/EmptyRoute.native.js +5 -3
- package/dist/esm/views/EmptyRoute.native.js.map +6 -1
- package/dist/esm/views/ErrorBoundary.native.js +5 -8
- package/dist/esm/views/ErrorBoundary.native.js.map +6 -1
- package/dist/esm/views/LoadProgressBar.native.js +58 -57
- package/dist/esm/views/LoadProgressBar.native.js.map +6 -1
- package/dist/esm/views/Navigator.native.js +54 -71
- package/dist/esm/views/Navigator.native.js.map +6 -1
- package/dist/esm/views/PreloadLinks.native.js +3 -1
- package/dist/esm/views/PreloadLinks.native.js.map +6 -1
- package/dist/esm/views/RootErrorBoundary.native.js +39 -29
- package/dist/esm/views/RootErrorBoundary.native.js.map +6 -1
- package/dist/esm/views/Screen.native.js +12 -12
- package/dist/esm/views/Screen.native.js.map +6 -1
- package/dist/esm/views/ScrollRestoration.native.js +27 -27
- package/dist/esm/views/ScrollRestoration.native.js.map +6 -1
- package/dist/esm/views/Try.native.js +40 -37
- package/dist/esm/views/Try.native.js.map +6 -1
- package/dist/esm/vite/build.native.js +260 -295
- package/dist/esm/vite/build.native.js.map +6 -1
- package/dist/esm/vite/clientTreeShakePlugin.native.js +34 -33
- package/dist/esm/vite/clientTreeShakePlugin.native.js.map +6 -1
- package/dist/esm/vite/constants.native.js +6 -4
- package/dist/esm/vite/constants.native.js.map +6 -1
- package/dist/esm/vite/createFileSystemRouter.native.js +99 -130
- package/dist/esm/vite/createFileSystemRouter.native.js.map +6 -1
- package/dist/esm/vite/customNodeExternals.native.js +9 -10
- package/dist/esm/vite/customNodeExternals.native.js.map +6 -1
- package/dist/esm/vite/ensureTsConfig.native.js +7 -5
- package/dist/esm/vite/ensureTsConfig.native.js.map +6 -1
- package/dist/esm/vite/findDepsToOptimize.native.js +27 -19
- package/dist/esm/vite/findDepsToOptimize.native.js.map +6 -1
- package/dist/esm/vite/fixDependenciesPlugin.native.js +5 -3
- package/dist/esm/vite/fixDependenciesPlugin.native.js.map +6 -1
- package/dist/esm/vite/generateTypesForRoutes.native.js +9 -9
- package/dist/esm/vite/generateTypesForRoutes.native.js.map +6 -1
- package/dist/esm/vite/getManifest.native.js +6 -4
- package/dist/esm/vite/getManifest.native.js.map +6 -1
- package/dist/esm/vite/headers.native.js +11 -5
- package/dist/esm/vite/headers.native.js.map +6 -1
- package/dist/esm/vite/loadEnv.native.js +7 -6
- package/dist/esm/vite/loadEnv.native.js.map +6 -1
- package/dist/esm/vite/makePluginWebOnly.native.js +9 -5
- package/dist/esm/vite/makePluginWebOnly.native.js.map +6 -1
- package/dist/esm/vite/one.native.js +142 -127
- package/dist/esm/vite/one.native.js.map +6 -1
- package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js +14 -11
- package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js.map +6 -1
- package/dist/esm/vite/replaceLoader.js +7 -1
- package/dist/esm/vite/replaceLoader.js.map +1 -1
- package/dist/esm/vite/replaceLoader.mjs +5 -1
- package/dist/esm/vite/replaceLoader.mjs.map +1 -1
- package/dist/esm/vite/replaceLoader.native.js +13 -10
- package/dist/esm/vite/replaceLoader.native.js.map +6 -1
- package/dist/esm/vite/resolveAPIRequest.native.js +44 -47
- package/dist/esm/vite/resolveAPIRequest.native.js.map +6 -1
- package/dist/esm/vite/server.native.js +5 -4
- package/dist/esm/vite/server.native.js.map +6 -1
- package/dist/esm/vite/types.native.js +1 -2
- package/dist/esm/vite/types.native.js.map +6 -1
- package/dist/esm/vite/virtualEntryPlugin.native.js +21 -16
- package/dist/esm/vite/virtualEntryPlugin.native.js.map +6 -1
- package/dist/esm/vite/vitePluginSsrCss.native.js +61 -50
- package/dist/esm/vite/vitePluginSsrCss.native.js.map +6 -1
- package/dist/esm/vite.native.js +19 -10
- package/dist/esm/vite.native.js.map +6 -1
- package/dist/esm/zero/getQueryKey.native.js +5 -3
- package/dist/esm/zero/getQueryKey.native.js.map +6 -1
- package/dist/esm/zero/isZeroQuery.native.js +4 -2
- package/dist/esm/zero/isZeroQuery.native.js.map +6 -1
- package/dist/esm/zero/resolveQuery.native.js +9 -8
- package/dist/esm/zero/resolveQuery.native.js.map +6 -1
- package/dist/esm/zero/subscribeToQuery.native.js +5 -3
- package/dist/esm/zero/subscribeToQuery.native.js.map +6 -1
- package/dist/esm/zero/types.native.js +1 -2
- package/dist/esm/zero/types.native.js.map +6 -1
- package/dist/esm/zero/useQuery.native.js +12 -12
- package/dist/esm/zero/useQuery.native.js.map +6 -1
- package/dist/esm/zero/useQueryZero.native.js +24 -20
- package/dist/esm/zero/useQueryZero.native.js.map +6 -1
- package/dist/esm/zero.native.js +9 -5
- package/dist/esm/zero.native.js.map +6 -1
- package/package.json +7 -7
- package/src/Root.tsx +20 -16
- package/src/cleanUrl.ts +15 -1
- package/src/vite/replaceLoader.ts +7 -1
- package/types/cleanUrl.d.ts.map +1 -1
- package/types/vite/replaceLoader.d.ts.map +1 -1
@@ -5,83 +5,72 @@ import Path, { join, relative } from "node:path";
|
|
5
5
|
import { nodeExternals } from "rollup-plugin-node-externals";
|
6
6
|
import { mergeConfig, build as viteBuild } from "vite";
|
7
7
|
import { fillOptions, getOptimizeDeps, rollupRemoveUnusedImportsPlugin, build as vxrnBuild } from "vxrn";
|
8
|
-
import { getLoaderPath, getPreloadPath } from "../cleanUrl
|
9
|
-
import { getManifest } from "./getManifest
|
10
|
-
import { loadUserOneOptions } from "./one
|
11
|
-
import { replaceLoader } from "./replaceLoader
|
12
|
-
import { labelProcess } from "../cli/label-process
|
13
|
-
var {
|
14
|
-
|
15
|
-
readFile,
|
16
|
-
outputFile
|
17
|
-
} = FSExtra;
|
18
|
-
process.on("uncaughtException", function (err) {
|
8
|
+
import { getLoaderPath, getPreloadPath } from "../cleanUrl";
|
9
|
+
import { getManifest } from "./getManifest";
|
10
|
+
import { loadUserOneOptions } from "./one";
|
11
|
+
import { replaceLoader } from "./replaceLoader";
|
12
|
+
import { labelProcess } from "../cli/label-process";
|
13
|
+
var { ensureDir, readFile, outputFile } = FSExtra;
|
14
|
+
process.on("uncaughtException", function(err) {
|
19
15
|
console.error(err?.message || err);
|
20
16
|
});
|
21
17
|
async function build(args) {
|
22
18
|
var _userOptions_build_server, _userOptions_build, _userOptions_web, _options_server;
|
23
19
|
labelProcess("build");
|
24
|
-
var userOptions = await loadUserOneOptions("build"),
|
25
|
-
_userOptions_build_server_outputFormat,
|
26
|
-
serverOutputFormat = (_userOptions_build_server_outputFormat = (_userOptions_build = userOptions.build) === null || _userOptions_build === void 0 || (_userOptions_build_server = _userOptions_build.server) === null || _userOptions_build_server === void 0 ? void 0 : _userOptions_build_server.outputFormat) !== null && _userOptions_build_server_outputFormat !== void 0 ? _userOptions_build_server_outputFormat : "esm";
|
20
|
+
var userOptions = await loadUserOneOptions("build"), _userOptions_build_server_outputFormat, serverOutputFormat = (_userOptions_build_server_outputFormat = (_userOptions_build = userOptions.build) === null || _userOptions_build === void 0 || (_userOptions_build_server = _userOptions_build.server) === null || _userOptions_build_server === void 0 ? void 0 : _userOptions_build_server.outputFormat) !== null && _userOptions_build_server_outputFormat !== void 0 ? _userOptions_build_server_outputFormat : "esm";
|
27
21
|
process.env.VXRN_REACT_19 = "1", process.env.ONE_SERVER_URL || console.warn("\u26A0\uFE0F No ONE_SERVER_URL environment set, set it in your .env to your target deploy URL");
|
28
22
|
var vxrnOutput = await vxrnBuild({
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
23
|
+
server: userOptions.server,
|
24
|
+
build: {
|
25
|
+
analyze: !0,
|
26
|
+
server: {
|
27
|
+
outputFormat: serverOutputFormat
|
35
28
|
}
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
manifest = getManifest(),
|
42
|
-
{
|
43
|
-
optimizeDeps
|
44
|
-
} = getOptimizeDeps("build"),
|
45
|
-
apiBuildConfig = mergeConfig(
|
29
|
+
}
|
30
|
+
}, args), options = await fillOptions(vxrnOutput.options), toAbsolute = function(p) {
|
31
|
+
return Path.resolve(options.root, p);
|
32
|
+
}, manifest = getManifest(), { optimizeDeps } = getOptimizeDeps("build"), apiBuildConfig = mergeConfig(
|
46
33
|
// feels like this should build off the *server* build config not web
|
47
|
-
vxrnOutput.webBuildConfig,
|
34
|
+
vxrnOutput.webBuildConfig,
|
35
|
+
{
|
48
36
|
configFile: !1,
|
49
37
|
appType: "custom",
|
50
38
|
optimizeDeps
|
51
|
-
}
|
39
|
+
}
|
40
|
+
);
|
52
41
|
if (manifest.apiRoutes.length) {
|
53
42
|
var _userOptions_build_api, _userOptions_build1, _userOptions_build_api1, _userOptions_build2;
|
54
43
|
console.info(`
|
55
44
|
\u{1F528} build api routes
|
56
45
|
`);
|
57
|
-
var processEnvDefines = Object.fromEntries(Object.entries(process.env).map(function
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
return entries[page.slice(1) + ".js"] = join("app", file), entries;
|
68
|
-
}, {}),
|
69
|
-
_userOptions_build_api_outputFormat,
|
70
|
-
apiOutputFormat = (_userOptions_build_api_outputFormat = userOptions == null || (_userOptions_build1 = userOptions.build) === null || _userOptions_build1 === void 0 || (_userOptions_build_api = _userOptions_build1.api) === null || _userOptions_build_api === void 0 ? void 0 : _userOptions_build_api.outputFormat) !== null && _userOptions_build_api_outputFormat !== void 0 ? _userOptions_build_api_outputFormat : serverOutputFormat,
|
71
|
-
treeshake = userOptions == null || (_userOptions_build2 = userOptions.build) === null || _userOptions_build2 === void 0 || (_userOptions_build_api1 = _userOptions_build2.api) === null || _userOptions_build_api1 === void 0 ? void 0 : _userOptions_build_api1.treeshake;
|
46
|
+
var processEnvDefines = Object.fromEntries(Object.entries(process.env).map(function(param) {
|
47
|
+
var [key, value] = param;
|
48
|
+
return [
|
49
|
+
`process.env.${key}`,
|
50
|
+
JSON.stringify(value)
|
51
|
+
];
|
52
|
+
})), apiRouteExternalRegex = buildRegexExcludingDeps(optimizeDeps.include), apiEntryPoints = manifest.apiRoutes.reduce(function(entries, param) {
|
53
|
+
var { page, file } = param;
|
54
|
+
return entries[page.slice(1) + ".js"] = join("app", file), entries;
|
55
|
+
}, {}), _userOptions_build_api_outputFormat, apiOutputFormat = (_userOptions_build_api_outputFormat = userOptions == null || (_userOptions_build1 = userOptions.build) === null || _userOptions_build1 === void 0 || (_userOptions_build_api = _userOptions_build1.api) === null || _userOptions_build_api === void 0 ? void 0 : _userOptions_build_api.outputFormat) !== null && _userOptions_build_api_outputFormat !== void 0 ? _userOptions_build_api_outputFormat : serverOutputFormat, treeshake = userOptions == null || (_userOptions_build2 = userOptions.build) === null || _userOptions_build2 === void 0 || (_userOptions_build_api1 = _userOptions_build2.api) === null || _userOptions_build_api1 === void 0 ? void 0 : _userOptions_build_api1.treeshake;
|
72
56
|
await viteBuild(mergeConfig(apiBuildConfig, {
|
73
57
|
appType: "custom",
|
74
58
|
configFile: !1,
|
75
|
-
plugins: [
|
76
|
-
|
77
|
-
|
59
|
+
plugins: [
|
60
|
+
nodeExternals({
|
61
|
+
exclude: optimizeDeps.include
|
62
|
+
})
|
63
|
+
],
|
78
64
|
define: {
|
79
65
|
...processEnvDefines
|
80
66
|
},
|
81
67
|
ssr: {
|
82
68
|
noExternal: !0,
|
83
69
|
// we patched them to switch to react 19
|
84
|
-
external: [
|
70
|
+
external: [
|
71
|
+
"react",
|
72
|
+
"react-dom"
|
73
|
+
],
|
85
74
|
optimizeDeps
|
86
75
|
},
|
87
76
|
build: {
|
@@ -95,8 +84,9 @@ async function build(args) {
|
|
95
84
|
moduleSideEffects: !1
|
96
85
|
},
|
97
86
|
plugins: [
|
98
|
-
|
99
|
-
|
87
|
+
// otherwise rollup is leaving commonjs-only top level imports...
|
88
|
+
apiOutputFormat === "esm" ? rollupRemoveUnusedImportsPlugin : null
|
89
|
+
].filter(Boolean),
|
100
90
|
// too many issues
|
101
91
|
// treeshake: {
|
102
92
|
// moduleSideEffects: false,
|
@@ -108,153 +98,148 @@ async function build(args) {
|
|
108
98
|
output: {
|
109
99
|
entryFileNames: "[name]",
|
110
100
|
exports: "auto",
|
111
|
-
...
|
101
|
+
...apiOutputFormat === "esm" ? {
|
112
102
|
format: "esm",
|
113
103
|
esModule: !0
|
114
104
|
} : {
|
115
105
|
format: "cjs",
|
116
106
|
// Preserve folder structure and use .cjs extension
|
117
|
-
entryFileNames: function
|
107
|
+
entryFileNames: function(chunkInfo) {
|
118
108
|
var name = chunkInfo.name.replace(/\.js$/, ".cjs");
|
119
109
|
return name;
|
120
110
|
},
|
121
|
-
chunkFileNames: function
|
122
|
-
var dir = Path.dirname(chunkInfo.name),
|
123
|
-
name = Path.basename(chunkInfo.name, Path.extname(chunkInfo.name));
|
111
|
+
chunkFileNames: function(chunkInfo) {
|
112
|
+
var dir = Path.dirname(chunkInfo.name), name = Path.basename(chunkInfo.name, Path.extname(chunkInfo.name));
|
124
113
|
return Path.join(dir, `${name}-[hash].cjs`);
|
125
114
|
},
|
126
|
-
assetFileNames: function
|
127
|
-
var _assetInfo_name,
|
128
|
-
name = (_assetInfo_name = assetInfo.name) !== null && _assetInfo_name !== void 0 ? _assetInfo_name : "",
|
129
|
-
dir = Path.dirname(name),
|
130
|
-
baseName = Path.basename(name, Path.extname(name)),
|
131
|
-
ext = Path.extname(name);
|
115
|
+
assetFileNames: function(assetInfo) {
|
116
|
+
var _assetInfo_name, name = (_assetInfo_name = assetInfo.name) !== null && _assetInfo_name !== void 0 ? _assetInfo_name : "", dir = Path.dirname(name), baseName = Path.basename(name, Path.extname(name)), ext = Path.extname(name);
|
132
117
|
return Path.join(dir, `${baseName}-[hash]${ext}`);
|
133
118
|
}
|
134
|
-
}
|
119
|
+
}
|
135
120
|
}
|
136
121
|
}
|
137
122
|
}
|
138
123
|
}));
|
139
124
|
}
|
140
125
|
globalThis.require = createRequire(join(import.meta.url, ".."));
|
141
|
-
var assets = [],
|
142
|
-
builtRoutes = [];
|
126
|
+
var assets = [], builtRoutes = [];
|
143
127
|
console.info(`
|
144
128
|
\u{1F528} build static routes
|
145
129
|
`);
|
146
|
-
var render = null,
|
147
|
-
entryServer = vxrnOutput.serverEntry;
|
130
|
+
var render = null, entryServer = vxrnOutput.serverEntry;
|
148
131
|
try {
|
149
|
-
var _serverImport_default_default,
|
150
|
-
serverImport = await import(entryServer);
|
132
|
+
var _serverImport_default_default, serverImport = await import(entryServer);
|
151
133
|
render = serverImport.default.render || ((_serverImport_default_default = serverImport.default.default) === null || _serverImport_default_default === void 0 ? void 0 : _serverImport_default_default.render), typeof render != "function" && (console.error("\u274C Error: didn't find render function in entry", serverImport), process.exit(1));
|
152
134
|
} catch (err) {
|
153
135
|
console.error("\u274C Error importing the root entry:"), console.error(` This error happened in the built file: ${entryServer}`), console.error(err.stack), process.exit(1);
|
154
136
|
}
|
155
|
-
var staticDir = join("dist/static"),
|
156
|
-
clientDir = join("dist/client");
|
137
|
+
var staticDir = join("dist/static"), clientDir = join("dist/client");
|
157
138
|
await ensureDir(staticDir);
|
158
|
-
var outputEntries = [
|
159
|
-
|
160
|
-
|
161
|
-
_iteratorError = void 0;
|
139
|
+
var outputEntries = [
|
140
|
+
...vxrnOutput.serverOutput.entries()
|
141
|
+
], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
162
142
|
try {
|
163
|
-
for (var _loop = async function
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
foundRoute = manifest.pageRoutes.find(findMatchingRoute);
|
184
|
-
if (!foundRoute) return clientManifestKey.startsWith("app") && (console.error(" No html route found!", {
|
143
|
+
for (var _loop = async function() {
|
144
|
+
var [index, output] = _step.value, _vxrnOutput_buildArgs, _foundRoute_layouts, _exported_generateStaticParams;
|
145
|
+
if (output.type === "asset")
|
146
|
+
return assets.push(output), "continue";
|
147
|
+
var id = output.facadeModuleId || "", file = Path.basename(id);
|
148
|
+
if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api") || !id.includes("/app/"))
|
149
|
+
return "continue";
|
150
|
+
var relativeId = relative(process.cwd(), id).replace("app/", "/"), onlyBuild = (_vxrnOutput_buildArgs = vxrnOutput.buildArgs) === null || _vxrnOutput_buildArgs === void 0 ? void 0 : _vxrnOutput_buildArgs.only;
|
151
|
+
if (onlyBuild && !MicroMatch.contains(relativeId, onlyBuild))
|
152
|
+
return "continue";
|
153
|
+
var clientManifestKey = Object.keys(vxrnOutput.clientManifest).find(function(key) {
|
154
|
+
return id.endsWith(key);
|
155
|
+
}) || "";
|
156
|
+
if (!clientManifestKey)
|
157
|
+
return "continue";
|
158
|
+
var clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey], findMatchingRoute = function(route) {
|
159
|
+
return route.file && clientManifestKey.endsWith(route.file.slice(1));
|
160
|
+
}, foundRoute = manifest.pageRoutes.find(findMatchingRoute);
|
161
|
+
if (!foundRoute)
|
162
|
+
return clientManifestKey.startsWith("app") && (console.error(" No html route found!", {
|
185
163
|
id,
|
186
164
|
clientManifestKey
|
187
165
|
}), console.error(" In manifest", manifest), process.exit(1)), "continue";
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
{
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
});
|
201
|
-
})].flat().filter(function (x) {
|
166
|
+
function collectImports(param) {
|
167
|
+
var { imports = [], css } = param, { type = "js" } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
168
|
+
return [
|
169
|
+
...new Set([
|
170
|
+
...type === "js" ? imports : css || [],
|
171
|
+
...imports.flatMap(function(name) {
|
172
|
+
var found = vxrnOutput.clientManifest[name];
|
173
|
+
return found || console.warn("No found imports", name, vxrnOutput.clientManifest), collectImports(found, {
|
174
|
+
type
|
175
|
+
});
|
176
|
+
})
|
177
|
+
].flat().filter(function(x) {
|
202
178
|
return x && (type === "css" || x.endsWith(".js"));
|
203
|
-
}).map(function
|
179
|
+
}).map(function(x) {
|
204
180
|
return type === "css" || x.startsWith("assets/") ? x : `assets/${x.slice(1)}`;
|
205
|
-
}))
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
181
|
+
}))
|
182
|
+
];
|
183
|
+
}
|
184
|
+
clientManifestEntry || console.warn(`No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(vxrnOutput.clientManifest, null, 2)}`);
|
185
|
+
var entryImports = collectImports(clientManifestEntry || {}), _foundRoute_layouts_flatMap, layoutEntries = (_foundRoute_layouts_flatMap = (_foundRoute_layouts = foundRoute.layouts) === null || _foundRoute_layouts === void 0 ? void 0 : _foundRoute_layouts.flatMap(function(layout) {
|
186
|
+
var clientKey = `app${layout.contextKey.slice(1)}`;
|
187
|
+
return vxrnOutput.clientManifest[clientKey];
|
188
|
+
})) !== null && _foundRoute_layouts_flatMap !== void 0 ? _foundRoute_layouts_flatMap : [], layoutImports = layoutEntries.flatMap(function(entry) {
|
189
|
+
return [
|
190
|
+
entry.file,
|
191
|
+
...collectImports(entry)
|
192
|
+
];
|
193
|
+
}), preloadSetupFilePreloads = function() {
|
194
|
+
if (userOptions.setupFile) {
|
195
|
+
var needle = userOptions.setupFile.replace(/^\.\//, "");
|
196
|
+
for (var file2 in vxrnOutput.clientManifest)
|
197
|
+
if (file2 === needle) {
|
198
|
+
var entry = vxrnOutput.clientManifest[file2];
|
199
|
+
return [
|
200
|
+
entry.file
|
201
|
+
];
|
224
202
|
}
|
225
|
-
|
226
|
-
|
227
|
-
|
203
|
+
}
|
204
|
+
return [];
|
205
|
+
}(), preloads = [
|
206
|
+
.../* @__PURE__ */ new Set([
|
207
|
+
...preloadSetupFilePreloads,
|
228
208
|
// add the route entry js (like ./app/index.ts)
|
229
209
|
clientManifestEntry.file,
|
230
210
|
// add the virtual entry
|
231
|
-
vxrnOutput.clientManifest["virtual:one-entry"].file,
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
foundRoute,
|
244
|
-
layoutEntries,
|
245
|
-
allEntries,
|
246
|
-
allCSS
|
211
|
+
vxrnOutput.clientManifest["virtual:one-entry"].file,
|
212
|
+
...entryImports,
|
213
|
+
...layoutImports
|
214
|
+
])
|
215
|
+
].map(function(path2) {
|
216
|
+
return `/${path2}`;
|
217
|
+
}), allEntries = [
|
218
|
+
clientManifestEntry,
|
219
|
+
...layoutEntries
|
220
|
+
], allCSS = allEntries.flatMap(function(entry) {
|
221
|
+
return collectImports(entry, {
|
222
|
+
type: "css"
|
247
223
|
});
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
224
|
+
}).map(function(path2) {
|
225
|
+
return `/${path2}`;
|
226
|
+
});
|
227
|
+
process.env.DEBUG && console.info("[one] building routes", {
|
228
|
+
foundRoute,
|
229
|
+
layoutEntries,
|
230
|
+
allEntries,
|
231
|
+
allCSS
|
232
|
+
});
|
233
|
+
var serverJsPath = toAbsolute(join("dist/server", output.fileName)), exported = void 0;
|
234
|
+
try {
|
235
|
+
exported = await import(serverJsPath);
|
236
|
+
} catch (err) {
|
237
|
+
throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
|
238
|
+
cause: err
|
239
|
+
});
|
240
|
+
}
|
241
|
+
if (foundRoute.type !== "ssr" && !foundRoute.page.includes("+not-found") && !foundRoute.page.includes("_sitemap") && !exported.generateStaticParams && relativeId.includes("["))
|
242
|
+
throw new Error(`[one] Error: Missing generateStaticParams
|
258
243
|
|
259
244
|
Route ${foundRoute.page} of type ${foundRoute.type} must export generateStaticParams so build can complete.
|
260
245
|
|
@@ -262,90 +247,78 @@ async function build(args) {
|
|
262
247
|
https://onestack.dev/docs/routing-exports#generatestaticparams
|
263
248
|
|
264
249
|
`);
|
265
|
-
|
266
|
-
|
267
|
-
|
250
|
+
var _ref, paramsList = (_ref = await ((_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported))) !== null && _ref !== void 0 ? _ref : [
|
251
|
+
{}
|
252
|
+
];
|
253
|
+
console.info(`
|
268
254
|
[build] page ${relativeId} (with ${paramsList.length} routes)
|
269
255
|
`), process.env.DEBUG && console.info("paramsList", JSON.stringify(paramsList, null, 2));
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
htmlOutPath = toAbsolute(join(staticDir, htmlPath)),
|
281
|
-
loaderData = {};
|
282
|
-
try {
|
283
|
-
console.info(` \u21A6 route ${path}`);
|
284
|
-
var cleanPath = path === "/" ? path : removeTrailingSlash(path),
|
285
|
-
preloadPath = getPreloadPath(path);
|
286
|
-
if (await FSExtra.writeFile(join(clientDir, preloadPath), preloads.map(function (preload) {
|
287
|
-
return `import "${preload}"`;
|
288
|
-
}).join(`
|
256
|
+
var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
|
257
|
+
try {
|
258
|
+
for (var _iterator2 = paramsList[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
|
259
|
+
var params = _step1.value, cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""), path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg"), htmlPath = `${path.endsWith("/") ? `${removeTrailingSlash(path)}/index` : path}.html`, clientJsPath = join("dist/client", clientManifestEntry.file), htmlOutPath = toAbsolute(join(staticDir, htmlPath)), loaderData = {};
|
260
|
+
try {
|
261
|
+
console.info(` \u21A6 route ${path}`);
|
262
|
+
var cleanPath = path === "/" ? path : removeTrailingSlash(path), preloadPath = getPreloadPath(path);
|
263
|
+
if (await FSExtra.writeFile(join(clientDir, preloadPath), preloads.map(function(preload) {
|
264
|
+
return `import "${preload}"`;
|
265
|
+
}).join(`
|
289
266
|
`)), builtRoutes.push({
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
267
|
+
type: foundRoute.type,
|
268
|
+
cleanPath,
|
269
|
+
preloadPath,
|
270
|
+
clientJsPath,
|
271
|
+
serverJsPath,
|
272
|
+
htmlPath,
|
273
|
+
loaderData,
|
274
|
+
params,
|
275
|
+
path,
|
276
|
+
preloads
|
277
|
+
}), foundRoute.type !== "ssr") {
|
278
|
+
var _globalThis___vxrnresetState, _globalThis, loaderProps = {
|
298
279
|
path,
|
299
|
-
|
300
|
-
}
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
loaderData
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
}
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
loaderProps,
|
326
|
-
loaderData,
|
327
|
-
css: allCSS
|
328
|
-
});
|
329
|
-
await outputFile(htmlOutPath, html);
|
330
|
-
continue;
|
331
|
-
}
|
332
|
-
foundRoute.type === "spa" && (await outputFile(htmlOutPath, `<html><head>
|
280
|
+
params
|
281
|
+
};
|
282
|
+
if (globalThis.__vxrnLoaderProps__ = loaderProps, (_globalThis___vxrnresetState = (_globalThis = globalThis).__vxrnresetState) === null || _globalThis___vxrnresetState === void 0 || _globalThis___vxrnresetState.call(_globalThis), exported.loader) {
|
283
|
+
var _exported_loader, _ref1;
|
284
|
+
loaderData = (_ref1 = await ((_exported_loader = exported.loader) === null || _exported_loader === void 0 ? void 0 : _exported_loader.call(exported, {
|
285
|
+
path,
|
286
|
+
params
|
287
|
+
}))) !== null && _ref1 !== void 0 ? _ref1 : null;
|
288
|
+
var code = await readFile(clientJsPath, "utf-8"), withLoader = replaceLoader({
|
289
|
+
code,
|
290
|
+
loaderData
|
291
|
+
}), loaderPartialPath = join(clientDir, getLoaderPath(path));
|
292
|
+
await outputFile(loaderPartialPath, withLoader);
|
293
|
+
}
|
294
|
+
if (foundRoute.type === "ssg") {
|
295
|
+
var html = await render({
|
296
|
+
path,
|
297
|
+
preloads,
|
298
|
+
loaderProps,
|
299
|
+
loaderData,
|
300
|
+
css: allCSS
|
301
|
+
});
|
302
|
+
await outputFile(htmlOutPath, html);
|
303
|
+
continue;
|
304
|
+
}
|
305
|
+
foundRoute.type === "spa" && await outputFile(htmlOutPath, `<html><head>
|
333
306
|
<script>globalThis['global'] = globalThis</script>
|
334
307
|
<script>globalThis['__vxrnIsSPA'] = true</script>
|
335
|
-
${preloads.map(function
|
336
|
-
|
337
|
-
|
308
|
+
${preloads.map(function(preload) {
|
309
|
+
return ` <script type="module" src="${preload}"></script>`;
|
310
|
+
}).join(`
|
338
311
|
`)}
|
339
|
-
${allCSS.map(function
|
340
|
-
|
341
|
-
|
312
|
+
${allCSS.map(function(file2) {
|
313
|
+
return ` <link rel="stylesheet" href=${file2} />`;
|
314
|
+
}).join(`
|
342
315
|
`)}
|
343
|
-
</head></html>`)
|
344
|
-
|
345
|
-
|
346
|
-
|
316
|
+
</head></html>`);
|
317
|
+
}
|
318
|
+
} catch (err) {
|
319
|
+
var errMsg = err instanceof Error ? `${err.message}
|
347
320
|
${err.stack}` : `${err}`;
|
348
|
-
|
321
|
+
console.error(`Error building static page at ${path} with id ${relativeId}:
|
349
322
|
|
350
323
|
${errMsg}
|
351
324
|
|
@@ -355,50 +328,45 @@ ${JSON.stringify(loaderData || null, null, 2)}
|
|
355
328
|
params:
|
356
329
|
|
357
330
|
${JSON.stringify(params || null, null, 2)}`), console.error(err), process.exit(1);
|
358
|
-
}
|
359
331
|
}
|
360
|
-
}
|
361
|
-
|
332
|
+
}
|
333
|
+
} catch (err) {
|
334
|
+
_didIteratorError2 = !0, _iteratorError2 = err;
|
335
|
+
} finally {
|
336
|
+
try {
|
337
|
+
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
362
338
|
} finally {
|
363
|
-
|
364
|
-
|
365
|
-
} finally {
|
366
|
-
if (_didIteratorError2) throw _iteratorError2;
|
367
|
-
}
|
339
|
+
if (_didIteratorError2)
|
340
|
+
throw _iteratorError2;
|
368
341
|
}
|
369
|
-
}
|
342
|
+
}
|
343
|
+
}, _iterator = outputEntries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) await _loop();
|
370
344
|
} catch (err) {
|
371
345
|
_didIteratorError = !0, _iteratorError = err;
|
372
346
|
} finally {
|
373
347
|
try {
|
374
348
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
375
349
|
} finally {
|
376
|
-
if (_didIteratorError)
|
350
|
+
if (_didIteratorError)
|
351
|
+
throw _iteratorError;
|
377
352
|
}
|
378
353
|
}
|
379
354
|
await moveAllFiles(staticDir, clientDir), await FSExtra.rm(staticDir, {
|
380
355
|
force: !0,
|
381
356
|
recursive: !0
|
382
357
|
});
|
383
|
-
var routeMap = builtRoutes.reduce(function
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
buildInfoForWriting
|
391
|
-
|
392
|
-
|
393
|
-
},
|
394
|
-
buildInfo = {
|
395
|
-
...buildInfoForWriting,
|
396
|
-
...vxrnOutput
|
397
|
-
};
|
358
|
+
var routeMap = builtRoutes.reduce(function(acc, param) {
|
359
|
+
var { cleanPath, htmlPath } = param;
|
360
|
+
return acc[cleanPath] = htmlPath, acc;
|
361
|
+
}, {}), buildInfoForWriting = {
|
362
|
+
routeMap,
|
363
|
+
builtRoutes
|
364
|
+
}, buildInfo = {
|
365
|
+
...buildInfoForWriting,
|
366
|
+
...vxrnOutput
|
367
|
+
};
|
398
368
|
await FSExtra.writeJSON(toAbsolute("dist/buildInfo.json"), buildInfoForWriting);
|
399
|
-
var postBuildLogs = [],
|
400
|
-
_userOptions_web_deploy,
|
401
|
-
platform = (_userOptions_web_deploy = (_userOptions_web = userOptions.web) === null || _userOptions_web === void 0 ? void 0 : _userOptions_web.deploy) !== null && _userOptions_web_deploy !== void 0 ? _userOptions_web_deploy : (_options_server = options.server) === null || _options_server === void 0 ? void 0 : _options_server.platform;
|
369
|
+
var postBuildLogs = [], _userOptions_web_deploy, platform = (_userOptions_web_deploy = (_userOptions_web = userOptions.web) === null || _userOptions_web === void 0 ? void 0 : _userOptions_web.deploy) !== null && _userOptions_web_deploy !== void 0 ? _userOptions_web_deploy : (_options_server = options.server) === null || _options_server === void 0 ? void 0 : _options_server.platform;
|
402
370
|
if (platform === "vercel" && (await FSExtra.writeFile(join(options.root, "dist", "index.js"), `import { serve } from 'one/serve'
|
403
371
|
const handler = await serve()
|
404
372
|
export const { GET, POST, PUT, PATCH, OPTIONS } = handler`), postBuildLogs.push(`wrote vercel entry to: ${join(".", "dist", "index.js")}`), postBuildLogs.push("point vercel outputDirectory to dist")), userOptions?.afterBuild) {
|
@@ -407,7 +375,7 @@ export const { GET, POST, PUT, PATCH, OPTIONS } = handler`), postBuildLogs.push(
|
|
407
375
|
}
|
408
376
|
process.env.VXRN_ANALYZE_BUNDLE && postBuildLogs.push(`client build report: ${toAbsolute("dist/report.html")}`), postBuildLogs.length && (console.info(`
|
409
377
|
|
410
|
-
`), postBuildLogs.forEach(function
|
378
|
+
`), postBuildLogs.forEach(function(log) {
|
411
379
|
console.info(` \xB7 ${log}`);
|
412
380
|
})), console.info(`
|
413
381
|
|
@@ -429,22 +397,19 @@ async function moveAllFiles(src, dest) {
|
|
429
397
|
}
|
430
398
|
}
|
431
399
|
function getPathnameFromFilePath(path) {
|
432
|
-
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
var found = params[part2.slice(1, part2.length - 1)];
|
446
|
-
if (!found) {
|
447
|
-
if (strict) throw new Error(`[one] Params doesn't fit route:
|
400
|
+
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, strict = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, dirname = Path.dirname(path).replace(/\([^\/]+\)/gi, ""), file = Path.basename(path), fileName = file.replace(/\.[a-z]+$/, ""), nameWithParams = function() {
|
401
|
+
if (fileName === "index")
|
402
|
+
return "/";
|
403
|
+
if (fileName.startsWith("[...")) {
|
404
|
+
var part = fileName.replace("[...", "").replace("]", "");
|
405
|
+
return params[part] || console.warn(`couldn't resolve ${fileName} segment in path ${path}`), `/${params[part]}`;
|
406
|
+
}
|
407
|
+
return `/${fileName.split("/").map(function(part2) {
|
408
|
+
if (part2[0] === "[") {
|
409
|
+
var found = params[part2.slice(1, part2.length - 1)];
|
410
|
+
if (!found) {
|
411
|
+
if (strict)
|
412
|
+
throw new Error(`[one] Params doesn't fit route:
|
448
413
|
|
449
414
|
- path: ${path}
|
450
415
|
- part: ${part2}
|
@@ -452,25 +417,25 @@ function getPathnameFromFilePath(path) {
|
|
452
417
|
- params:
|
453
418
|
|
454
419
|
${JSON.stringify(params, null, 2)}`);
|
455
|
-
|
456
|
-
}
|
457
|
-
return found;
|
420
|
+
return ":" + part2.replace("[", "").replace("]", "");
|
458
421
|
}
|
459
|
-
return
|
460
|
-
}
|
461
|
-
|
422
|
+
return found;
|
423
|
+
}
|
424
|
+
return part2;
|
425
|
+
}).join("/")}`;
|
426
|
+
}();
|
462
427
|
return `${dirname}${nameWithParams}`.replace(/\/\/+/gi, "/");
|
463
428
|
}
|
464
429
|
function escapeRegex(string) {
|
465
430
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
466
431
|
}
|
467
432
|
function buildRegexExcludingDeps(deps) {
|
468
|
-
var sanitizedDeps = deps.map(function
|
469
|
-
|
470
|
-
|
471
|
-
exclusionPattern = sanitizedDeps.join("|"),
|
472
|
-
regexPattern = `node_modules/(?!(${exclusionPattern})).*`;
|
433
|
+
var sanitizedDeps = deps.map(function(dep) {
|
434
|
+
return escapeRegex(dep);
|
435
|
+
}), exclusionPattern = sanitizedDeps.join("|"), regexPattern = `node_modules/(?!(${exclusionPattern})).*`;
|
473
436
|
return new RegExp(regexPattern);
|
474
437
|
}
|
475
|
-
export {
|
476
|
-
|
438
|
+
export {
|
439
|
+
build
|
440
|
+
};
|
441
|
+
//# sourceMappingURL=build.js.map
|