sku 16.5.0 → 16.6.0
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/CHANGELOG.md +31 -0
- package/dist/@loadable/component.mjs +1 -2
- package/dist/_virtual/_rolldown/runtime.mjs +2 -3
- package/dist/bin/sku.mjs +1 -2
- package/dist/config/babel.mjs +1 -2
- package/dist/config/eslint/ignores.mjs +1 -2
- package/dist/config/eslint/importOrder.mjs +1 -2
- package/dist/config/eslint/jsonFiles.mjs +1 -2
- package/dist/config/eslint/plugins/package-json.mjs +1 -2
- package/dist/config/eslint.d.mts +0 -2
- package/dist/config/eslint.mjs +2 -3
- package/dist/config/fileResolutionExtensions.mjs +1 -2
- package/dist/config/prettier.d.mts +0 -2
- package/dist/config/prettier.mjs +1 -2
- package/dist/config/storybook/viteConfig.d.mts +0 -2
- package/dist/config/storybook/viteConfig.mjs +1 -2
- package/dist/config/storybook/webpackConfig.d.mts +0 -2
- package/dist/config/storybook/webpackConfig.mjs +3 -4
- package/dist/config/targets.mjs +1 -2
- package/dist/context/cjsInteropDeps.mjs +1 -2
- package/dist/context/configPath.mjs +1 -2
- package/dist/context/configSchema.mjs +2 -2
- package/dist/context/createSkuContext.mjs +4 -3
- package/dist/context/defaultClientEntry.mjs +1 -2
- package/dist/context/defaultCompilePackages.mjs +1 -2
- package/dist/context/defaultSkuConfig.mjs +2 -2
- package/dist/context/getSiteForHost.mjs +1 -2
- package/dist/context/hosts.mjs +3 -4
- package/dist/context/hostsFile.mjs +2 -3
- package/dist/context/resolveEnvironment.mjs +1 -2
- package/dist/context/validateConfig.mjs +10 -4
- package/dist/context/validatePathAliases.mjs +1 -2
- package/dist/entries/ssr-client.dev.mjs +1 -2
- package/dist/entries/ssr-client.mjs +1 -2
- package/dist/entries/ssr-server.d.mts +0 -2
- package/dist/entries/ssr-server.mjs +2 -3
- package/dist/entries/vite-client.mjs +1 -2
- package/dist/entries/vite-render.d.mts +0 -2
- package/dist/entries/vite-render.mjs +1 -2
- package/dist/jest/file-mock.d.mts +0 -2
- package/dist/jest/file-mock.mjs +1 -2
- package/dist/jest/js-transform.d.mts +0 -2
- package/dist/jest/js-transform.mjs +1 -2
- package/dist/jest/ts-transform.d.mts +0 -2
- package/dist/jest/ts-transform.mjs +1 -2
- package/dist/jest-preset.d.mts +0 -2
- package/dist/jest-preset.mjs +1 -2
- package/dist/node_modules/.pnpm/ansi-regex@6.5.0/node_modules/ansi-regex/index.mjs +9 -0
- package/dist/node_modules/.pnpm/ansi-styles@6.2.3/node_modules/ansi-styles/index.mjs +1 -2
- package/dist/node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.mjs +1 -2
- package/dist/node_modules/.pnpm/{get-east-asian-width@1.6.0 → get-east-asian-width@1.7.0}/node_modules/get-east-asian-width/index.mjs +3 -4
- package/dist/node_modules/.pnpm/{get-east-asian-width@1.6.0 → get-east-asian-width@1.7.0}/node_modules/get-east-asian-width/lookup-data.mjs +18 -13
- package/dist/node_modules/.pnpm/{get-east-asian-width@1.6.0 → get-east-asian-width@1.7.0}/node_modules/get-east-asian-width/lookup.mjs +3 -4
- package/dist/node_modules/.pnpm/{get-east-asian-width@1.6.0 → get-east-asian-width@1.7.0}/node_modules/get-east-asian-width/utilities.mjs +1 -2
- package/dist/node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.mjs +1 -2
- package/dist/node_modules/.pnpm/package-manager-detector@0.2.11/node_modules/package-manager-detector/dist/commands.mjs +1 -2
- package/dist/node_modules/.pnpm/package-manager-detector@0.2.11/node_modules/package-manager-detector/dist/constants.mjs +1 -2
- package/dist/node_modules/.pnpm/package-manager-detector@0.2.11/node_modules/package-manager-detector/dist/detect.mjs +2 -3
- package/dist/node_modules/.pnpm/quansync@0.2.11/node_modules/quansync/dist/index.mjs +1 -2
- package/dist/node_modules/.pnpm/quansync@0.2.11/node_modules/quansync/dist/macro.mjs +1 -2
- package/dist/node_modules/.pnpm/{rolldown@1.2.2 → rolldown@1.2.16}/node_modules/rolldown/dist/filter-index.mjs +1 -2
- package/dist/node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.mjs +2 -3
- package/dist/node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.mjs +2 -3
- package/dist/node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.mjs +2 -3
- package/dist/openBrowser.mjs +2 -3
- package/dist/package.mjs +1 -2
- package/dist/packages/sku/package.mjs +2 -3
- package/dist/private/utils/src/console/banner.mjs +2 -3
- package/dist/private/utils/src/console/styles.mjs +1 -2
- package/dist/private/utils/src/filesystem/cwd.mjs +1 -2
- package/dist/private/utils/src/filesystem/index.mjs +1 -2
- package/dist/private/utils/src/packageManager/index.mjs +1 -2
- package/dist/private/utils/src/packageManager/packageManager.mjs +1 -2
- package/dist/private/utils/src/packageManager/skuPackageManager.mjs +0 -1
- package/dist/private/utils/src/path/toPosixPath.mjs +1 -2
- package/dist/private/utils/src/serverUrls.mjs +1 -2
- package/dist/program/commands/build/build.action.mjs +1 -2
- package/dist/program/commands/build/build.command.mjs +1 -2
- package/dist/program/commands/build/vite-build-handler.mjs +6 -7
- package/dist/program/commands/build/webpack-build-handler.mjs +18 -10
- package/dist/program/commands/build-ssr/build-ssr.action.mjs +14 -7
- package/dist/program/commands/build-ssr/build-ssr.command.mjs +1 -2
- package/dist/program/commands/configure/configure.action.mjs +1 -2
- package/dist/program/commands/configure/configure.command.mjs +1 -2
- package/dist/program/commands/format/format.action.mjs +3 -4
- package/dist/program/commands/format/format.command.mjs +1 -2
- package/dist/program/commands/index.mjs +1 -2
- package/dist/program/commands/lint/lint.action.mjs +5 -6
- package/dist/program/commands/lint/lint.command.mjs +1 -2
- package/dist/program/commands/serve/serve.action.mjs +42 -18
- package/dist/program/commands/serve/serve.command.mjs +1 -2
- package/dist/program/commands/setup-hosts/setup-hosts.action.mjs +2 -3
- package/dist/program/commands/setup-hosts/setup-hosts.command.mjs +1 -2
- package/dist/program/commands/start/start.action.mjs +5 -6
- package/dist/program/commands/start/start.command.mjs +2 -3
- package/dist/program/commands/start/vite-start-handler.mjs +2 -3
- package/dist/program/commands/start/webpack-start-handler.mjs +6 -7
- package/dist/program/commands/start-ssr/start-ssr.action.mjs +1 -2
- package/dist/program/commands/start-ssr/start-ssr.command.mjs +1 -2
- package/dist/program/commands/start-ssr/webpack-start-ssr-handler.mjs +8 -9
- package/dist/program/commands/test/jest-test-handler.mjs +1 -2
- package/dist/program/commands/test/test.action.mjs +1 -2
- package/dist/program/commands/test/test.command.mjs +1 -2
- package/dist/program/commands/test/vitest-test-handler.mjs +2 -3
- package/dist/program/commands/translations/commands/compile/compile.action.mjs +3 -4
- package/dist/program/commands/translations/commands/compile/compile.command.mjs +1 -2
- package/dist/program/commands/translations/commands/index.mjs +1 -2
- package/dist/program/commands/translations/commands/pull/pull.action.mjs +3 -4
- package/dist/program/commands/translations/commands/pull/pull.command.mjs +1 -2
- package/dist/program/commands/translations/commands/push/auto-translate.option.mjs +1 -2
- package/dist/program/commands/translations/commands/push/delete-unused-keys.option.mjs +1 -2
- package/dist/program/commands/translations/commands/push/push.action.mjs +3 -4
- package/dist/program/commands/translations/commands/push/push.command.mjs +1 -2
- package/dist/program/commands/translations/commands/validate/validate.action.mjs +3 -4
- package/dist/program/commands/translations/commands/validate/validate.command.mjs +1 -2
- package/dist/program/commands/translations/helpers/translation-helpers.mjs +1 -2
- package/dist/program/commands/translations/translations.command.mjs +1 -2
- package/dist/program/hooks/preAction/preAction.hook.mjs +1 -2
- package/dist/program/index.mjs +2 -3
- package/dist/program/options/config.option.mjs +1 -2
- package/dist/program/options/convertLoadable.option.mjs +1 -2
- package/dist/program/options/debug.option.mjs +1 -2
- package/dist/program/options/environment.option.mjs +1 -2
- package/dist/program/options/list-urls.mjs +1 -2
- package/dist/program/options/port.option.mjs +1 -2
- package/dist/program/options/site.option.mjs +1 -2
- package/dist/program/options/stats.option.mjs +0 -1
- package/dist/program/options/watch.option.mjs +1 -2
- package/dist/runtime.d.mts +1 -1
- package/dist/services/bundlerConstants.mjs +1 -2
- package/dist/services/eslint/lint.mjs +1 -2
- package/dist/services/eslint/runESLint.mjs +2 -3
- package/dist/services/packageManager/getPnpmConfigDependencies.mjs +1 -2
- package/dist/services/packageManager/pnpmConfig.mjs +1 -2
- package/dist/services/prettier.mjs +4 -5
- package/dist/services/serverManager.mjs +1 -2
- package/dist/services/telemetry/index.mjs +1 -2
- package/dist/services/telemetry/metricsMeasurers.mjs +1 -2
- package/dist/services/telemetry/provider.mjs +1 -2
- package/dist/services/typescript/runTsc.mjs +2 -3
- package/dist/services/typescript/tsconfig.mjs +35 -26
- package/dist/services/vite/helpers/allocateClientPort.mjs +1 -2
- package/dist/services/vite/helpers/browserslist-to-esbuild.mjs +1 -2
- package/dist/services/vite/helpers/bundleConfig.mjs +11 -6
- package/dist/services/vite/helpers/config/createConfig.mjs +1 -2
- package/dist/services/vite/helpers/config/dependencyGraph.mjs +1 -2
- package/dist/services/vite/helpers/html/createPreRenderedHtml.mjs +1 -2
- package/dist/services/vite/helpers/makePluginName.mjs +1 -2
- package/dist/services/vite/helpers/prerender/prerenderConcurrently.mjs +15 -8
- package/dist/services/vite/helpers/printServerUrls.mjs +2 -3
- package/dist/services/vite/helpers/resolveManifestModuleId.mjs +1 -2
- package/dist/services/vite/helpers/serializeConfig.mjs +1 -2
- package/dist/services/vite/index.mjs +1 -2
- package/dist/services/vite/plugins/build.mjs +11 -9
- package/dist/services/vite/plugins/bundleAnalyzer.mjs +1 -2
- package/dist/services/vite/plugins/config.mjs +2 -3
- package/dist/services/vite/plugins/dangerouslySetViteConfig.mjs +1 -2
- package/dist/services/vite/plugins/devServer.mjs +2 -3
- package/dist/services/vite/plugins/entrySideEffects.mjs +2 -3
- package/dist/services/vite/plugins/esbuild/convertLoadableDepOptimizePlugin.mjs +2 -3
- package/dist/services/vite/plugins/esbuild/fixViteVanillaExtractDepScanPlugin.mjs +1 -2
- package/dist/services/vite/plugins/httpsDevServer.mjs +1 -2
- package/dist/services/vite/plugins/lazyRouteModuleId/injectLazyRouteModuleId.mjs +1 -2
- package/dist/services/vite/plugins/lazyRouteModuleId/lazyRouteModuleIdPlugin.mjs +1 -2
- package/dist/services/vite/plugins/middleware.mjs +4 -5
- package/dist/services/vite/plugins/polyfills.mjs +2 -3
- package/dist/services/vite/plugins/preloadPlugin/helpers/constants.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/helpers/convertWebpackToViteImport.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/helpers/getViteLoadableSpecifierName.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/helpers/getWebpackLoadableSpecifierName.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/helpers/injectModuleID.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/helpers/rewriteWebpackLoadableImports.mjs +1 -2
- package/dist/services/vite/plugins/preloadPlugin/preloadPlugin.mjs +2 -3
- package/dist/services/vite/plugins/setNoExternal.mjs +2 -3
- package/dist/services/vite/plugins/ssr.mjs +10 -8
- package/dist/services/vite/plugins/ssrCss/collect.mjs +1 -2
- package/dist/services/vite/plugins/ssrCss/constants.mjs +1 -2
- package/dist/services/vite/plugins/ssrCss/plugin.mjs +2 -3
- package/dist/services/vite/plugins/static.mjs +8 -6
- package/dist/services/vite/plugins/stripServerConfig.mjs +1 -2
- package/dist/services/vite/plugins/telemetry.mjs +2 -3
- package/dist/services/vite/plugins/telemetryClients.mjs +2 -3
- package/dist/services/vite/plugins/telemetryEvents.mjs +1 -2
- package/dist/services/vite/skuPlugin.mjs +1 -2
- package/dist/services/vite/ssr/abortReason.mjs +1 -2
- package/dist/services/vite/ssr/bindCommit.mjs +1 -2
- package/dist/services/vite/ssr/bootstrap.mjs +1 -2
- package/dist/services/vite/ssr/build.mjs +8 -6
- package/dist/services/vite/ssr/buildSiteRouteTrees.mjs +1 -2
- package/dist/services/vite/ssr/buildSiteStaticHandlers.mjs +1 -2
- package/dist/services/vite/ssr/clientManifestPath.mjs +3 -4
- package/dist/services/vite/ssr/collectRouteHeaders.mjs +1 -2
- package/dist/services/vite/ssr/createDevSsrServer.mjs +3 -4
- package/dist/services/vite/ssr/createDocumentAttempt.mjs +1 -2
- package/dist/services/vite/ssr/createHtmlRenderMiddleware.mjs +2 -3
- package/dist/services/vite/ssr/createInsertHtmlTransform.mjs +1 -2
- package/dist/services/vite/ssr/createSsrRequestContextStore.mjs +1 -2
- package/dist/services/vite/ssr/createWebRequest.mjs +1 -2
- package/dist/services/vite/ssr/csp.mjs +1 -2
- package/dist/services/vite/ssr/defineEntry.d.mts +0 -2
- package/dist/services/vite/ssr/defineEntry.mjs +1 -2
- package/dist/services/vite/ssr/documentAssets.d.mts +0 -2
- package/dist/services/vite/ssr/documentAssets.mjs +1 -2
- package/dist/services/vite/ssr/entryTypeExtractors.d.mts +0 -2
- package/dist/services/vite/ssr/getModuleIds.mjs +1 -2
- package/dist/services/vite/ssr/getStaticContextFromError.mjs +1 -2
- package/dist/services/vite/ssr/insertHtml.d.mts +0 -2
- package/dist/services/vite/ssr/insertHtml.mjs +1 -2
- package/dist/services/vite/ssr/installSsrRequestContextStorage.mjs +1 -2
- package/dist/services/vite/ssr/listen.mjs +1 -2
- package/dist/services/vite/ssr/normaliseClientContext.mjs +1 -2
- package/dist/services/vite/ssr/preloadRoute.d.mts +0 -2
- package/dist/services/vite/ssr/preloadRoute.mjs +1 -2
- package/dist/services/vite/ssr/readRoutesEntry.mjs +1 -2
- package/dist/services/vite/ssr/render.mjs +2 -3
- package/dist/services/vite/ssr/requestContext.d.mts +0 -2
- package/dist/services/vite/ssr/requestContext.mjs +1 -2
- package/dist/services/vite/ssr/resolveAssets.d.mts +0 -2
- package/dist/services/vite/ssr/resolveAssets.mjs +2 -3
- package/dist/services/vite/ssr/resolveConfigSiteNames.mjs +1 -2
- package/dist/services/vite/ssr/selectForSite.mjs +1 -2
- package/dist/services/vite/ssr/sendResponse.mjs +1 -2
- package/dist/services/vite/ssr/skuContext.d.mts +0 -2
- package/dist/services/vite/ssr/skuContext.mjs +1 -2
- package/dist/services/vite/ssr/ssrRequestContextMiddleware.mjs +1 -2
- package/dist/services/vite/ssr/ssrServerShared.mjs +0 -1
- package/dist/services/vite/ssr/start.mjs +1 -2
- package/dist/services/vite/ssr/startProductionSsrServer.mjs +2 -3
- package/dist/services/vite/ssr/streamDocument.mjs +1 -2
- package/dist/services/vite/ssr/types.d.mts +1 -3
- package/dist/services/vite/ssr/wrapPipeWithInsertHtml.mjs +1 -2
- package/dist/services/vite/static/build.mjs +18 -6
- package/dist/services/vite/static/start.mjs +2 -3
- package/dist/services/vocab/config.mjs +1 -2
- package/dist/services/vocab/runVocab.mjs +1 -2
- package/dist/services/webpack/config/cache.mjs +1 -2
- package/dist/services/webpack/config/plugins/bundleAnalyzer.mjs +1 -2
- package/dist/services/webpack/config/plugins/createHtmlRenderPlugin.mjs +8 -4
- package/dist/services/webpack/config/plugins/metricsPlugin.mjs +1 -2
- package/dist/services/webpack/config/plugins/validateOptions.d.mts +0 -2
- package/dist/services/webpack/config/plugins/validateOptions.mjs +1 -2
- package/dist/services/webpack/config/resolveModules.mjs +1 -2
- package/dist/services/webpack/config/sourceMaps.mjs +1 -2
- package/dist/services/webpack/config/statsConfig.mjs +1 -2
- package/dist/services/webpack/config/utils/index.mjs +1 -2
- package/dist/services/webpack/config/utils/loaders.mjs +1 -2
- package/dist/services/webpack/config/utils/resolvePackage.mjs +1 -2
- package/dist/services/webpack/config/webpack.config.mjs +12 -8
- package/dist/services/webpack/config/webpack.config.ssr.mjs +15 -11
- package/dist/services/webpack/entry/csp.mjs +1 -2
- package/dist/services/webpack/entry/makeExtractor.mjs +1 -2
- package/dist/services/webpack/entry/render/render-to-string.mjs +1 -2
- package/dist/services/webpack/entry/server/server.mjs +2 -3
- package/dist/services/webpack/runWebpack.mjs +1 -2
- package/dist/types/types.d.mts +18 -3
- package/dist/utils/allocatePort.mjs +1 -2
- package/dist/utils/buildFileUtils.mjs +17 -7
- package/dist/utils/certificate.mjs +2 -3
- package/dist/utils/configure.mjs +3 -4
- package/dist/utils/configureApp.mjs +3 -4
- package/dist/utils/constants/clientContextKey.mjs +1 -2
- package/dist/utils/copyDirContents.mjs +1 -2
- package/dist/utils/coverageFolder.mjs +3 -0
- package/dist/utils/createServer.mjs +1 -2
- package/dist/utils/csp.mjs +1 -2
- package/dist/utils/debug.mjs +1 -2
- package/dist/utils/detectUnnecessaryPolyfillsFromConfig.mjs +1 -2
- package/dist/utils/detectUnnecessaryPolyfillsFromDependencies.mjs +1 -2
- package/dist/utils/distDirectories.mjs +17 -0
- package/dist/utils/error-guards.mjs +1 -2
- package/dist/utils/execAsync.mjs +1 -2
- package/dist/utils/exists.mjs +1 -2
- package/dist/utils/formatMs.mjs +1 -2
- package/dist/utils/isCI.mjs +1 -2
- package/dist/utils/language-utils.mjs +6 -5
- package/dist/utils/pathAliasImports.mjs +2 -3
- package/dist/utils/polyfillDetector.mjs +1 -2
- package/dist/utils/polyfillRegistry.mjs +1 -2
- package/dist/utils/polyfillWarnings.mjs +3 -4
- package/dist/utils/resolvePolyfills.mjs +1 -2
- package/dist/utils/routeMatcher.mjs +1 -2
- package/dist/utils/runBin.mjs +1 -2
- package/dist/utils/runLintChecks.mjs +1 -2
- package/dist/utils/suggestScript.mjs +1 -2
- package/dist/utils/validatePeerDeps.mjs +1 -2
- package/dist/utils/validateSkuConfigFormat.mjs +1 -2
- package/dist/utils/warnOnLegacyReact.mjs +1 -2
- package/dist/vite/prerender-worker.mjs +8 -6
- package/dist/webpack/client.mjs +1 -2
- package/dist/webpack/library-render.d.mts +0 -2
- package/dist/webpack/library-render.mjs +1 -2
- package/dist/webpack/render.d.mts +0 -2
- package/dist/webpack/render.mjs +3 -4
- package/dist/webpack/server.mjs +1 -2
- package/dist/webpack-plugin.d.mts +0 -2
- package/dist/webpack-plugin.mjs +3 -4
- package/package.json +2 -2
- package/dist/node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.mjs +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
|
|
3
|
+
// src/services/vite/ssr/skuContext.tsx
|
|
4
4
|
const SkuProviderContext = createContext(null);
|
|
5
5
|
const SkuProvider = ({ site, clientContext, reactContext, children }) => /* @__PURE__ */ jsx(SkuProviderContext.Provider, {
|
|
6
6
|
value: {
|
|
@@ -31,5 +31,4 @@ function createSkuContexts() {
|
|
|
31
31
|
useReactContext: () => useSkuProviderContext().reactContext
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { SkuProvider, createSkuContexts };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSsrRequestContextStore } from "./createSsrRequestContextStore.mjs";
|
|
2
|
-
|
|
2
|
+
// src/services/vite/ssr/ssrRequestContextMiddleware.ts
|
|
3
3
|
const stores = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
/**
|
|
5
5
|
* Lazily attaches request-scoped SSR context before consumer middleware:
|
|
@@ -14,5 +14,4 @@ const createSsrRequestContextMiddleware = () => (req, _res, next) => {
|
|
|
14
14
|
next();
|
|
15
15
|
};
|
|
16
16
|
const getRequestContextStore = (req) => stores.get(req);
|
|
17
|
-
//#endregion
|
|
18
17
|
export { createSsrRequestContextMiddleware, getRequestContextStore };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "./createWebRequest.mjs";
|
|
2
|
-
import "./sendResponse.mjs";
|
|
3
2
|
import { createHtmlRenderMiddleware } from "./createHtmlRenderMiddleware.mjs";
|
|
4
3
|
import { listen, mountConsumerMiddleware, resolveBoundPort } from "./listen.mjs";
|
|
5
4
|
export { createHtmlRenderMiddleware, listen, mountConsumerMiddleware, resolveBoundPort };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { allocateClientPort } from "../helpers/allocateClientPort.mjs";
|
|
2
2
|
import { printServerUrls } from "../helpers/printServerUrls.mjs";
|
|
3
3
|
import { createDevSsrServer } from "./createDevSsrServer.mjs";
|
|
4
|
-
|
|
4
|
+
// src/services/vite/ssr/start.ts
|
|
5
5
|
const startSsr = async ({ skuContext, environment }) => {
|
|
6
6
|
const { skuContext: skuContextOverride, port } = await allocateClientPort(skuContext);
|
|
7
7
|
const { vite } = await createDevSsrServer({
|
|
@@ -14,5 +14,4 @@ const startSsr = async ({ skuContext, environment }) => {
|
|
|
14
14
|
});
|
|
15
15
|
vite.bindCLIShortcuts({ print: true });
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { startSsr };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { findEntryChunk, joinPublicPath } from "./resolveAssets.mjs";
|
|
2
1
|
import exists from "../../../utils/exists.mjs";
|
|
3
2
|
import { CLIENT_MANIFEST_RELATIVE_PATH } from "./clientManifestPath.mjs";
|
|
3
|
+
import { findEntryChunk, joinPublicPath } from "./resolveAssets.mjs";
|
|
4
4
|
import { listen } from "./listen.mjs";
|
|
5
5
|
import "./ssrServerShared.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { readFile } from "node:fs/promises";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
|
|
9
|
+
// src/services/vite/ssr/startProductionSsrServer.ts
|
|
10
10
|
const startProductionSsrServer = async ({ middleware, onListen, render }) => {
|
|
11
11
|
const serverDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
12
12
|
const bakedManifestPath = path.join(serverDirectory, CLIENT_MANIFEST_RELATIVE_PATH);
|
|
@@ -43,5 +43,4 @@ const startProductionSsrServer = async ({ middleware, onListen, render }) => {
|
|
|
43
43
|
cspReportOnlyReportTo: csp.reportOnlyReportTo
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { startProductionSsrServer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { abortReason } from "./abortReason.mjs";
|
|
2
2
|
import { createDocumentAttempt } from "./createDocumentAttempt.mjs";
|
|
3
3
|
import { getStaticContextFromError } from "./getStaticContextFromError.mjs";
|
|
4
|
-
|
|
4
|
+
// src/services/vite/ssr/streamDocument.tsx
|
|
5
5
|
const DOCUMENT_RENDER_TIMEOUT_MS = 1e4;
|
|
6
6
|
const isTimeoutError = (error) => error instanceof DOMException && error.name === "TimeoutError";
|
|
7
7
|
const onDestinationEnd = (destination, listener) => {
|
|
@@ -64,5 +64,4 @@ const streamDocument = async ({ timeoutMs, ...attemptArgs }) => {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
//#endregion
|
|
68
67
|
export { DOCUMENT_RENDER_TIMEOUT_MS, streamDocument };
|
|
@@ -6,7 +6,6 @@ import { ClientInstrumentation, HydrationState, RouteObject, RouterContextProvid
|
|
|
6
6
|
import { Server } from "node:http";
|
|
7
7
|
import { Server as Server$1 } from "node:https";
|
|
8
8
|
import { Express, Request as Request$1, RequestHandler } from "express";
|
|
9
|
-
//#region src/services/vite/ssr/types.d.ts
|
|
10
9
|
interface DocumentAssets {
|
|
11
10
|
css: string[];
|
|
12
11
|
modulePreloads: string[];
|
|
@@ -202,5 +201,4 @@ declare module 'express-serve-static-core' {
|
|
|
202
201
|
getCspNonce?: () => string;
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
|
-
|
|
206
|
-
export { CommitDocument, CommitDocumentOptions, DocumentAssets, DocumentDestination, JsonValue, MapRoutePath, MapRoutePathArgs, RenderAssets, RenderManifest, RenderOptions, RenderResult, RenderSuccess, type SiteOf, SkuClientEntry, SkuClientGetReactContext, SkuClientGetRouterContext, SkuGetLanguage, SkuGetSite, SkuMiddleware, SkuOnHydrate, SkuOnListen, SkuRouteObject, SkuServerEntry, SkuServerGetReactContext, SkuServerGetRouterContext };
|
|
204
|
+
export { CommitDocument, DocumentAssets, DocumentDestination, JsonValue, MapRoutePath, MapRoutePathArgs, RenderAssets, RenderManifest, RenderOptions, RenderResult, RenderSuccess, type SiteOf, SkuClientEntry, SkuMiddleware, SkuOnHydrate, SkuOnListen, SkuRouteObject, SkuServerEntry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInsertHtmlTransform } from "./createInsertHtmlTransform.mjs";
|
|
2
|
-
|
|
2
|
+
// src/services/vite/ssr/wrapPipeWithInsertHtml.ts
|
|
3
3
|
const wrapPipeWithInsertHtml = (pipe, queue, abort) => {
|
|
4
4
|
const wrappedPipe = (destination) => {
|
|
5
5
|
const transform = createInsertHtmlTransform(queue);
|
|
@@ -14,5 +14,4 @@ const wrapPipeWithInsertHtml = (pipe, queue, abort) => {
|
|
|
14
14
|
};
|
|
15
15
|
return wrappedPipe;
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { wrapPipeWithInsertHtml };
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
+
import { assertNoPublicHtmlFiles, cleanTargetDirectory, copyPublicFiles, ensureTargetDirectory } from "../../../utils/buildFileUtils.mjs";
|
|
1
2
|
import { createOutDir } from "../helpers/bundleConfig.mjs";
|
|
2
|
-
import { cleanTargetDirectory, copyPublicFiles } from "../../../utils/buildFileUtils.mjs";
|
|
3
3
|
import { createConfig } from "../helpers/config/createConfig.mjs";
|
|
4
4
|
import { prerenderConcurrently } from "../helpers/prerender/prerenderConcurrently.mjs";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import { createBuilder } from "vite";
|
|
6
|
-
|
|
7
|
+
// src/services/vite/static/build.ts
|
|
7
8
|
const buildStatic = async (skuContext) => {
|
|
8
|
-
const
|
|
9
|
+
const { distSubfolders } = skuContext;
|
|
10
|
+
const outDir = createOutDir({
|
|
11
|
+
targetPath: skuContext.paths.target,
|
|
12
|
+
useSubfolders: distSubfolders
|
|
13
|
+
});
|
|
14
|
+
if (distSubfolders) {
|
|
15
|
+
await assertNoPublicHtmlFiles(skuContext);
|
|
16
|
+
await ensureTargetDirectory(skuContext.paths.target);
|
|
17
|
+
await cleanTargetDirectory(skuContext.paths.target);
|
|
18
|
+
}
|
|
9
19
|
await (await createBuilder(createConfig(skuContext))).buildApp();
|
|
10
20
|
if (skuContext.routes) await prerenderConcurrently(skuContext);
|
|
11
21
|
await cleanTargetDirectory(outDir.ssg, true);
|
|
12
|
-
await cleanTargetDirectory(
|
|
13
|
-
await copyPublicFiles(
|
|
22
|
+
await cleanTargetDirectory(path.join(outDir.distClient, ".vite"), true);
|
|
23
|
+
await copyPublicFiles({
|
|
24
|
+
paths: skuContext.paths,
|
|
25
|
+
destination: outDir.distClient
|
|
26
|
+
});
|
|
14
27
|
};
|
|
15
|
-
//#endregion
|
|
16
28
|
export { buildStatic };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createConfig } from "../helpers/config/createConfig.mjs";
|
|
2
1
|
import { allocateClientPort } from "../helpers/allocateClientPort.mjs";
|
|
2
|
+
import { createConfig } from "../helpers/config/createConfig.mjs";
|
|
3
3
|
import { printServerUrls } from "../helpers/printServerUrls.mjs";
|
|
4
4
|
import { createServer } from "vite";
|
|
5
|
-
|
|
5
|
+
// src/services/vite/static/start.ts
|
|
6
6
|
const startStatic = async ({ skuContext, environment }) => {
|
|
7
7
|
const { skuContext: skuContextOverride, port } = await allocateClientPort(skuContext);
|
|
8
8
|
const viteServer = await createServer(createConfig(skuContextOverride, environment));
|
|
@@ -13,5 +13,4 @@ const startStatic = async ({ skuContext, environment }) => {
|
|
|
13
13
|
});
|
|
14
14
|
viteServer.bindCLIShortcuts({ print: true });
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
export { startStatic };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createDebug } from "obug";
|
|
2
2
|
import { generator } from "@vocab/pseudo-localize";
|
|
3
|
-
|
|
3
|
+
// src/services/vocab/config.ts
|
|
4
4
|
const log = createDebug("sku:vocab:config");
|
|
5
5
|
const getVocabConfig = ({ languages }) => {
|
|
6
6
|
if (!languages) {
|
|
@@ -20,5 +20,4 @@ const getVocabConfig = ({ languages }) => {
|
|
|
20
20
|
log("Using Vocab options:", result);
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
|
-
//#endregion
|
|
24
23
|
export { getVocabConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getVocabConfig } from "./config.mjs";
|
|
2
2
|
import { compile } from "@vocab/core";
|
|
3
|
-
|
|
3
|
+
// src/services/vocab/runVocab.ts
|
|
4
4
|
const runVocabCompile = async (skuContext) => {
|
|
5
5
|
const vocabConfig = getVocabConfig(skuContext);
|
|
6
6
|
if (vocabConfig) {
|
|
@@ -15,5 +15,4 @@ const watchVocabCompile = async (skuContext) => {
|
|
|
15
15
|
await compile({ watch: true }, vocabConfig);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { runVocabCompile, watchVocabCompile };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isCI_default from "../../../utils/isCI.mjs";
|
|
2
|
-
|
|
2
|
+
// src/services/webpack/config/cache.ts
|
|
3
3
|
const disableCacheOverride = Boolean(process.env.SKU_DISABLE_CACHE);
|
|
4
4
|
function getWebpackCacheSettings({ isDevServer, paths }) {
|
|
5
5
|
if (isDevServer && !isCI_default && !disableCacheOverride) return {
|
|
@@ -8,5 +8,4 @@ function getWebpackCacheSettings({ isDevServer, paths }) {
|
|
|
8
8
|
};
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { getWebpackCacheSettings as default };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { getPathFromCwd } from "../../../../private/utils/src/filesystem/cwd.mjs";
|
|
2
2
|
import "../../../../private/utils/src/index.mjs";
|
|
3
3
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/config/plugins/bundleAnalyzer.ts
|
|
5
5
|
const bundleReportFolder = "report";
|
|
6
6
|
const bundleAnalyzerPlugin = ({ name }) => new BundleAnalyzerPlugin({
|
|
7
7
|
analyzerMode: "static",
|
|
8
8
|
openAnalyzer: false,
|
|
9
9
|
reportFilename: getPathFromCwd(`${bundleReportFolder}/${name}.html`)
|
|
10
10
|
});
|
|
11
|
-
//#endregion
|
|
12
11
|
export { bundleAnalyzerPlugin, bundleReportFolder };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getRouteWithLanguage, getValidLanguagesForRoute } from "../../../../utils/language-utils.mjs";
|
|
2
|
+
import { getDistDirectories } from "../../../../utils/distDirectories.mjs";
|
|
2
3
|
import { createDebug } from "obug";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import memoize from "memoize";
|
|
5
6
|
import { HtmlRenderPlugin } from "html-render-webpack-plugin";
|
|
6
|
-
|
|
7
|
+
// src/services/webpack/config/plugins/createHtmlRenderPlugin.ts
|
|
7
8
|
const log = createDebug("sku:html-render-plugin");
|
|
8
9
|
const getClientStats = (webpackStats) => webpackStats.toJson();
|
|
9
10
|
const getCachedClientStats = memoize(getClientStats);
|
|
@@ -83,7 +84,7 @@ const getBuildRoutes = ({ sites, routes, languages: skuLanguages, environments }
|
|
|
83
84
|
};
|
|
84
85
|
const startTransformPath = ({ site = "", route = "" }) => join(site, route);
|
|
85
86
|
const createHtmlRenderPlugin = ({ isStartScript, skuContext }) => {
|
|
86
|
-
const { paths, routes, environments, sites, transformOutputPath, publicPath, languages } = skuContext;
|
|
87
|
+
const { paths, routes, environments, sites, transformOutputPath, publicPath, languages, distSubfolders } = skuContext;
|
|
87
88
|
const allRoutes = isStartScript ? getStartRoutes({
|
|
88
89
|
sites,
|
|
89
90
|
routes,
|
|
@@ -95,8 +96,12 @@ const createHtmlRenderPlugin = ({ isStartScript, skuContext }) => {
|
|
|
95
96
|
environments,
|
|
96
97
|
languages
|
|
97
98
|
});
|
|
99
|
+
const { distRendered } = getDistDirectories({
|
|
100
|
+
targetPath: paths.target,
|
|
101
|
+
useSubfolders: distSubfolders && !isStartScript
|
|
102
|
+
});
|
|
98
103
|
return new HtmlRenderPlugin({
|
|
99
|
-
renderDirectory:
|
|
104
|
+
renderDirectory: distRendered,
|
|
100
105
|
routes: allRoutes,
|
|
101
106
|
skipAssets: isStartScript,
|
|
102
107
|
transformFilePath: isStartScript ? startTransformPath : transformOutputPath,
|
|
@@ -104,5 +109,4 @@ const createHtmlRenderPlugin = ({ isStartScript, skuContext }) => {
|
|
|
104
109
|
extraGlobals: { Date }
|
|
105
110
|
});
|
|
106
111
|
};
|
|
107
|
-
//#endregion
|
|
108
112
|
export { createHtmlRenderPlugin as default, getBuildRoutes };
|
|
@@ -2,7 +2,7 @@ import telemetry_default from "../../../telemetry/index.mjs";
|
|
|
2
2
|
import { formatMs } from "../../../../utils/formatMs.mjs";
|
|
3
3
|
import { createDebug } from "obug";
|
|
4
4
|
import { performance } from "node:perf_hooks";
|
|
5
|
-
|
|
5
|
+
// src/services/webpack/config/plugins/metricsPlugin.ts
|
|
6
6
|
const log = createDebug("sku:metrics");
|
|
7
7
|
const smp = "sku-metrics-plugin";
|
|
8
8
|
var MetricsPlugin = class {
|
|
@@ -39,5 +39,4 @@ var MetricsPlugin = class {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
//#endregion
|
|
43
42
|
export { MetricsPlugin };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/services/webpack/config/plugins/validateOptions.d.ts
|
|
2
1
|
type SkuWebpackPluginOptions = {
|
|
3
2
|
target: 'node' | 'browser';
|
|
4
3
|
MiniCssExtractPlugin: any;
|
|
@@ -12,5 +11,4 @@ type SkuWebpackPluginOptions = {
|
|
|
12
11
|
browserslist?: string[];
|
|
13
12
|
displayNamesProd?: boolean;
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
14
|
export { SkuWebpackPluginOptions };
|
|
@@ -4,7 +4,7 @@ import "../../../../private/utils/src/console/index.mjs";
|
|
|
4
4
|
import browserslist from "browserslist";
|
|
5
5
|
import { closest } from "fastest-levenshtein";
|
|
6
6
|
import Validator from "fastest-validator";
|
|
7
|
-
|
|
7
|
+
// src/services/webpack/config/plugins/validateOptions.ts
|
|
8
8
|
const validator = new Validator();
|
|
9
9
|
const exitWithErrors = async (errors) => {
|
|
10
10
|
console.log(strong(critical("SkuWebpackPlugin: Invalid options")));
|
|
@@ -82,5 +82,4 @@ const validateOptions = (options) => {
|
|
|
82
82
|
}
|
|
83
83
|
if (errors.length > 0) exitWithErrors(errors);
|
|
84
84
|
};
|
|
85
|
-
//#endregion
|
|
86
85
|
export { validateOptions };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/services/webpack/config/resolveModules.ts
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
5
|
const modules = ["node_modules"];
|
|
6
6
|
try {
|
|
7
7
|
const skuPath = require.resolve("sku/package.json");
|
|
8
8
|
if (skuPath.includes(".pnpm")) modules.push(join(skuPath, "../.."));
|
|
9
9
|
} catch {}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { modules as default };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/services/webpack/config/sourceMaps.ts
|
|
2
2
|
function getSourceMapSetting({ isDevServer, sourceMapsProd }) {
|
|
3
3
|
if (isDevServer) return "eval-cheap-module-source-map";
|
|
4
4
|
return sourceMapsProd ? "source-map" : false;
|
|
5
5
|
}
|
|
6
|
-
//#endregion
|
|
7
6
|
export { getSourceMapSetting as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isCI_default from "../../../utils/isCI.mjs";
|
|
2
|
-
|
|
2
|
+
// src/services/webpack/config/statsConfig.ts
|
|
3
3
|
const getStatsConfig = ({ stats, isStartScript = false } = {}) => {
|
|
4
4
|
return {
|
|
5
5
|
colors: !isCI_default,
|
|
@@ -8,5 +8,4 @@ const getStatsConfig = ({ stats, isStartScript = false } = {}) => {
|
|
|
8
8
|
errors: true
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { getStatsConfig as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extensions } from "../../../../config/fileResolutionExtensions.mjs";
|
|
2
2
|
import { makeExternalCssLoaders, makeJsLoaders, makeSvgLoaders } from "./loaders.mjs";
|
|
3
3
|
import { resolvePackage } from "./resolvePackage.mjs";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/config/utils/index.ts
|
|
5
5
|
const TYPESCRIPT = new RegExp(`\.(${extensions.ts.join("|")})$`);
|
|
6
6
|
const JAVASCRIPT = new RegExp(`\.(${extensions.js.join("|")})$`);
|
|
7
7
|
const IMAGE = [
|
|
@@ -13,5 +13,4 @@ const IMAGE = [
|
|
|
13
13
|
/\.avif$/
|
|
14
14
|
];
|
|
15
15
|
const SVG = /\.svg$/;
|
|
16
|
-
//#endregion
|
|
17
16
|
export { IMAGE, JAVASCRIPT, SVG, TYPESCRIPT, makeExternalCssLoaders, makeJsLoaders, makeSvgLoaders, resolvePackage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import babel_default from "../../../../config/babel.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import lightningcssPlugin from "postcss-lightningcss";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/config/utils/loaders.ts
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const makeJsLoaders = (options) => [{
|
|
7
7
|
loader: require.resolve("babel-loader"),
|
|
@@ -35,5 +35,4 @@ const makeSvgLoaders = () => [{
|
|
|
35
35
|
params: { attributes: [{ focusable: false }] }
|
|
36
36
|
}] }
|
|
37
37
|
}];
|
|
38
|
-
//#endregion
|
|
39
38
|
export { makeExternalCssLoaders, makeJsLoaders, makeSvgLoaders };
|
|
@@ -6,7 +6,7 @@ import { createDebug } from "obug";
|
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import memoize from "memoize";
|
|
9
|
-
|
|
9
|
+
// src/services/webpack/config/utils/resolvePackage.ts
|
|
10
10
|
const log = createDebug("sku:resolvePackage");
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
12
|
function getProjectDependencies(readFileSync) {
|
|
@@ -53,5 +53,4 @@ const createPackageResolver = (fs, resolve) => {
|
|
|
53
53
|
return memoize(resolvePackage);
|
|
54
54
|
};
|
|
55
55
|
const resolvePackage = createPackageResolver(fs, require.resolve);
|
|
56
|
-
//#endregion
|
|
57
56
|
export { createPackageResolver, resolvePackage };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { cwd } from "../../../private/utils/src/filesystem/cwd.mjs";
|
|
2
|
-
import "../../../private/utils/src/index.mjs";
|
|
3
2
|
import { bundleAnalyzerPlugin } from "./plugins/bundleAnalyzer.mjs";
|
|
4
|
-
import { resolvePackage } from "./utils/resolvePackage.mjs";
|
|
5
|
-
import { JAVASCRIPT } from "./utils/index.mjs";
|
|
6
|
-
import { browserslistNodeTarget } from "../../../config/targets.mjs";
|
|
7
3
|
import { SkuWebpackPlugin } from "../../../webpack-plugin.mjs";
|
|
4
|
+
import { resolvePackage } from "./utils/resolvePackage.mjs";
|
|
8
5
|
import { MetricsPlugin } from "./plugins/metricsPlugin.mjs";
|
|
6
|
+
import { JAVASCRIPT } from "./utils/index.mjs";
|
|
7
|
+
import "../../../private/utils/src/index.mjs";
|
|
9
8
|
import { getVocabConfig } from "../../vocab/config.mjs";
|
|
10
9
|
import getStatsConfig from "./statsConfig.mjs";
|
|
11
10
|
import getSourceMapSetting from "./sourceMaps.mjs";
|
|
12
11
|
import getWebpackCacheSettings from "./cache.mjs";
|
|
13
12
|
import modules from "./resolveModules.mjs";
|
|
13
|
+
import { browserslistNodeTarget } from "../../../config/targets.mjs";
|
|
14
14
|
import { resolvePolyfills } from "../../../utils/resolvePolyfills.mjs";
|
|
15
|
+
import { getDistDirectories } from "../../../utils/distDirectories.mjs";
|
|
15
16
|
import { createRequire } from "node:module";
|
|
16
17
|
import path, { dirname } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
@@ -22,14 +23,18 @@ import LoadablePlugin from "@loadable/webpack-plugin";
|
|
|
22
23
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
23
24
|
import TerserPlugin from "terser-webpack-plugin";
|
|
24
25
|
import { VocabWebpackPlugin } from "@vocab/webpack";
|
|
25
|
-
|
|
26
|
+
// src/services/webpack/config/webpack.config.ts
|
|
26
27
|
const require = createRequire(import.meta.url);
|
|
27
28
|
const renderEntry = require.resolve("#webpack/render");
|
|
28
29
|
const libraryRenderEntry = require.resolve("#webpack/library-render");
|
|
29
30
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
30
31
|
const makeWebpackConfig = async ({ isIntegration = false, isDevServer = false, htmlRenderPlugin, metrics = false, hot = false, isStartScript = false, stats, skuContext }) => {
|
|
31
|
-
const { paths, webpackDecorator, polyfills, isLibrary, libraryName, libraryFile, supportedBrowsers, displayNamesProd, cspEnabled, cspExtraScriptSrcHosts, skipPackageCompatibilityCompilation, externalizeNodeModules, sourceMapsProd } = skuContext;
|
|
32
|
+
const { paths, webpackDecorator, polyfills, isLibrary, libraryName, libraryFile, supportedBrowsers, displayNamesProd, cspEnabled, cspExtraScriptSrcHosts, skipPackageCompatibilityCompilation, externalizeNodeModules, sourceMapsProd, distSubfolders } = skuContext;
|
|
32
33
|
const isProductionBuild = process.env.NODE_ENV === "production";
|
|
34
|
+
const { distClient } = getDistDirectories({
|
|
35
|
+
targetPath: paths.target,
|
|
36
|
+
useSubfolders: distSubfolders && !isStartScript
|
|
37
|
+
});
|
|
33
38
|
const webpackMode = isProductionBuild ? "production" : "development";
|
|
34
39
|
const vocabOptions = getVocabConfig(skuContext);
|
|
35
40
|
const resolvedPolyfills = resolvePolyfills(polyfills);
|
|
@@ -56,7 +61,7 @@ const makeWebpackConfig = async ({ isIntegration = false, isDevServer = false, h
|
|
|
56
61
|
sourceMapsProd
|
|
57
62
|
}),
|
|
58
63
|
output: {
|
|
59
|
-
path:
|
|
64
|
+
path: distClient,
|
|
60
65
|
publicPath: isStartScript ? "/" : paths.publicPath,
|
|
61
66
|
filename: jsFileMask,
|
|
62
67
|
chunkFilename: jsChunkFileMask,
|
|
@@ -215,5 +220,4 @@ const makeWebpackConfig = async ({ isIntegration = false, isDevServer = false, h
|
|
|
215
220
|
infrastructureLogging: { level: "error" }
|
|
216
221
|
}].map(webpackDecorator);
|
|
217
222
|
};
|
|
218
|
-
//#endregion
|
|
219
223
|
export { makeWebpackConfig };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { requireFromCwd } from "../../../private/utils/src/filesystem/cwd.mjs";
|
|
2
|
-
import "../../../private/utils/src/index.mjs";
|
|
3
|
-
import { bundleAnalyzerPlugin } from "./plugins/bundleAnalyzer.mjs";
|
|
4
|
-
import { resolvePackage } from "./utils/resolvePackage.mjs";
|
|
5
|
-
import { JAVASCRIPT } from "./utils/index.mjs";
|
|
6
|
-
import { browserslistNodeTarget } from "../../../config/targets.mjs";
|
|
7
2
|
import { SkuWebpackPlugin } from "../../../webpack-plugin.mjs";
|
|
8
3
|
import { MetricsPlugin } from "./plugins/metricsPlugin.mjs";
|
|
4
|
+
import { resolvePackage } from "./utils/resolvePackage.mjs";
|
|
5
|
+
import { bundleAnalyzerPlugin } from "./plugins/bundleAnalyzer.mjs";
|
|
6
|
+
import { JAVASCRIPT } from "./utils/index.mjs";
|
|
7
|
+
import "../../../private/utils/src/index.mjs";
|
|
9
8
|
import { getVocabConfig } from "../../vocab/config.mjs";
|
|
10
9
|
import getStatsConfig from "./statsConfig.mjs";
|
|
11
10
|
import getSourceMapSetting from "./sourceMaps.mjs";
|
|
12
11
|
import getWebpackCacheSettings from "./cache.mjs";
|
|
13
12
|
import modules from "./resolveModules.mjs";
|
|
13
|
+
import { browserslistNodeTarget } from "../../../config/targets.mjs";
|
|
14
14
|
import { resolvePolyfills } from "../../../utils/resolvePolyfills.mjs";
|
|
15
|
+
import { getDistDirectories } from "../../../utils/distDirectories.mjs";
|
|
15
16
|
import { createRequire } from "node:module";
|
|
16
17
|
import { dirname, join, sep } from "node:path";
|
|
17
18
|
import * as find from "empathic/find";
|
|
@@ -23,12 +24,16 @@ import LoadablePlugin from "@loadable/webpack-plugin";
|
|
|
23
24
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
24
25
|
import TerserPlugin from "terser-webpack-plugin";
|
|
25
26
|
import { VocabWebpackPlugin } from "@vocab/webpack";
|
|
26
|
-
|
|
27
|
+
// src/services/webpack/config/webpack.config.ssr.ts
|
|
27
28
|
const require = createRequire(import.meta.url);
|
|
28
29
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
29
30
|
const makeWebpackConfig = async ({ serverPort, isDevServer = false, hot = false, isStartScript = false, stats, skuContext }) => {
|
|
30
|
-
const { paths, webpackDecorator, polyfills, supportedBrowsers, displayNamesProd, cspEnabled, cspExtraScriptSrcHosts, httpsDevServer, skipPackageCompatibilityCompilation, externalizeNodeModules, sourceMapsProd } = skuContext;
|
|
31
|
+
const { paths, webpackDecorator, polyfills, supportedBrowsers, displayNamesProd, cspEnabled, cspExtraScriptSrcHosts, httpsDevServer, skipPackageCompatibilityCompilation, externalizeNodeModules, sourceMapsProd, distSubfolders } = skuContext;
|
|
31
32
|
const isProductionBuild = process.env.NODE_ENV === "production";
|
|
33
|
+
const { distClient, distServer } = getDistDirectories({
|
|
34
|
+
targetPath: paths.target,
|
|
35
|
+
useSubfolders: distSubfolders && !isStartScript
|
|
36
|
+
});
|
|
32
37
|
const webpackMode = isProductionBuild ? "production" : "development";
|
|
33
38
|
const vocabOptions = getVocabConfig(skuContext);
|
|
34
39
|
const internalInclude = [join(__dirname, "../entry"), ...paths.src];
|
|
@@ -49,7 +54,7 @@ const makeWebpackConfig = async ({ serverPort, isDevServer = false, hot = false,
|
|
|
49
54
|
sourceMapsProd
|
|
50
55
|
}),
|
|
51
56
|
output: {
|
|
52
|
-
path:
|
|
57
|
+
path: distClient,
|
|
53
58
|
publicPath,
|
|
54
59
|
filename: `${fileMask}.js`,
|
|
55
60
|
chunkFilename: `${fileMask}.js`
|
|
@@ -105,7 +110,7 @@ const makeWebpackConfig = async ({ serverPort, isDevServer = false, hot = false,
|
|
|
105
110
|
plugins: [
|
|
106
111
|
new LoadablePlugin({
|
|
107
112
|
filename: webpackStatsFilename,
|
|
108
|
-
writeToDisk:
|
|
113
|
+
writeToDisk: { filename: distServer },
|
|
109
114
|
outputAsset: false
|
|
110
115
|
}),
|
|
111
116
|
new MiniCssExtractPlugin({
|
|
@@ -151,7 +156,7 @@ const makeWebpackConfig = async ({ serverPort, isDevServer = false, hot = false,
|
|
|
151
156
|
target: "node",
|
|
152
157
|
node: { __dirname: false },
|
|
153
158
|
output: {
|
|
154
|
-
path:
|
|
159
|
+
path: distServer,
|
|
155
160
|
publicPath,
|
|
156
161
|
filename: `server.${type === "module" ? "c" : ""}js`,
|
|
157
162
|
hotUpdateChunkFilename: `[id].[fullhash].hot-update.${type === "module" ? "c" : ""}js`,
|
|
@@ -199,5 +204,4 @@ const makeWebpackConfig = async ({ serverPort, isDevServer = false, hot = false,
|
|
|
199
204
|
})] : [])
|
|
200
205
|
}].map(webpackDecorator);
|
|
201
206
|
};
|
|
202
|
-
//#endregion
|
|
203
207
|
export { makeWebpackConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomBytes } from "node:crypto";
|
|
2
2
|
import { URL } from "node:url";
|
|
3
3
|
import { parse, valid } from "node-html-parser";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/entry/csp.ts
|
|
5
5
|
const scriptTypeIgnoreList = ["application/json", "application/ld+json"];
|
|
6
6
|
const defaultBaseName = "http://relative-url";
|
|
7
7
|
const hashScriptContents = (scriptContents) => createHash("sha256").update(scriptContents).digest("base64");
|
|
@@ -93,5 +93,4 @@ function createCSPHandler({ extraHosts = [], reportTo, reportOnlyExtraHosts = []
|
|
|
93
93
|
handleHtml
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
//#endregion
|
|
97
96
|
export { createCSPHandler as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import defaultClientEntry_default from "../../../context/defaultClientEntry.mjs";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ChunkExtractor, ChunkExtractorManager } from "@loadable/server";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/entry/makeExtractor.tsx
|
|
5
5
|
const getNewTags = ({ before, after }) => {
|
|
6
6
|
const beforeArr = before.split("\n");
|
|
7
7
|
return after.split("\n").filter((tag) => !beforeArr.includes(tag)).join("\n");
|
|
@@ -58,5 +58,4 @@ var makeExtractor_default = (stats, publicPath, csp) => {
|
|
|
58
58
|
extractor
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
//#endregion
|
|
62
61
|
export { makeExtractor_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createDebug } from "obug";
|
|
2
2
|
import { Writable } from "node:stream";
|
|
3
3
|
import { renderToPipeableStream } from "react-dom/server";
|
|
4
|
-
|
|
4
|
+
// src/services/webpack/entry/render/render-to-string.ts
|
|
5
5
|
const RENDER_TIMEOUT_MS = 5e3;
|
|
6
6
|
const log = createDebug("sku:render:renderToStringAsync");
|
|
7
7
|
/**
|
|
@@ -58,5 +58,4 @@ function renderToStringAsync(reactNode) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { renderToStringAsync };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import createCSPHandler from "../csp.mjs";
|
|
2
1
|
import makeExtractor_default from "../makeExtractor.mjs";
|
|
2
|
+
import createCSPHandler from "../csp.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import serverExports from "__sku_alias__serverEntry";
|
|
6
6
|
import { getChunkName } from "@vocab/webpack/chunk-name";
|
|
7
7
|
import express, { static as static$1 } from "express";
|
|
8
8
|
import webpackStats from "__sku_alias__webpackStats";
|
|
9
|
-
|
|
9
|
+
// src/services/webpack/entry/server/server.ts
|
|
10
10
|
const publicPath = __SKU_PUBLIC_PATH__;
|
|
11
11
|
const csp = __SKU_CSP__;
|
|
12
12
|
const { middleware, onStart, renderCallback } = serverExports({ publicPath });
|
|
@@ -41,5 +41,4 @@ app.get("*", (...args) => {
|
|
|
41
41
|
createUnsafeNonce: cspHandler ? cspHandler.createUnsafeNonce : void 0
|
|
42
42
|
}, ...args);
|
|
43
43
|
});
|
|
44
|
-
//#endregion
|
|
45
44
|
export { app, onStart };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import getStatsConfig from "./config/statsConfig.mjs";
|
|
2
|
-
|
|
2
|
+
// src/services/webpack/runWebpack.ts
|
|
3
3
|
const run = async (compiler, { stats: statsOption } = {}) => new Promise((resolve, reject) => {
|
|
4
4
|
compiler.run((err, stats) => {
|
|
5
5
|
if (err) reject(err);
|
|
@@ -8,5 +8,4 @@ const run = async (compiler, { stats: statsOption } = {}) => new Promise((resolv
|
|
|
8
8
|
resolve();
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
|
-
//#endregion
|
|
12
11
|
export { run };
|