vinext 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -22
- package/THIRD_PARTY_LICENSES.md +47 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -2
- package/dist/build/prerender.js +4 -3
- package/dist/build/report.d.ts +0 -14
- package/dist/build/report.js +1 -51
- package/dist/check.js +4 -7
- package/dist/cli.js +3 -0
- package/dist/client/dev-error-overlay-store.d.ts +1 -0
- package/dist/client/dev-error-overlay.d.ts +2 -0
- package/dist/client/dev-error-overlay.js +20 -4
- package/dist/client/navigation-runtime.d.ts +13 -1
- package/dist/client/navigation-runtime.js +1 -1
- package/dist/config/config-matchers.js +2 -0
- package/dist/config/destination-params.d.ts +2 -1
- package/dist/config/destination-params.js +52 -2
- package/dist/config/next-config.d.ts +25 -0
- package/dist/config/next-config.js +82 -4
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-codec.js +327 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/dbcs-data.js +123 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/index.js +29 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/internal.js +134 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-codec.js +50 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data-generated.js +455 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/sbcs-data.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/big5-added.json.js +169 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp936.json.js +2584 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp949.json.js +2220 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/cp950.json.js +227 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/eucjp.json.js +425 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gb18030-ranges.json.js +427 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/gbk-added.json.js +229 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/tables/shiftjis.json.js +292 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf16.js +106 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/encodings/utf7.js +182 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/bom-handling.js +42 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/extend-node.js +147 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/index.js +94 -0
- package/dist/deps/.pnpm/iconv-lite@0.4.24/deps/iconv-lite/lib/streams.js +95 -0
- package/dist/deps/.pnpm/safer-buffer@2.1.2/deps/safer-buffer/safer.js +45 -0
- package/dist/entries/app-rsc-entry.js +17 -49
- package/dist/entries/app-rsc-manifest.js +3 -4
- package/dist/entries/app-ssr-entry.js +1 -0
- package/dist/entries/pages-server-entry.js +36 -9
- package/dist/index.js +112 -90
- package/dist/init-cloudflare.d.ts +1 -3
- package/dist/init-cloudflare.js +10 -48
- package/dist/init-platform.d.ts +2 -0
- package/dist/init-platform.js +4 -0
- package/dist/plugins/extensionless-dynamic-import.js +6 -2
- package/dist/plugins/next-intl-catalog.d.ts +12 -0
- package/dist/plugins/next-intl-catalog.js +85 -0
- package/dist/plugins/pages-node-externals.d.ts +1 -0
- package/dist/plugins/pages-node-externals.js +1 -1
- package/dist/plugins/strip-server-exports.js +2 -1
- package/dist/plugins/use-cache-callable.d.ts +1 -1
- package/dist/plugins/use-cache-callable.js +136 -94
- package/dist/routing/app-route-graph.d.ts +6 -0
- package/dist/routing/app-route-graph.js +9 -1
- package/dist/server/api-handler.js +21 -5
- package/dist/server/app-bfcache-identity.js +1 -1
- package/dist/server/app-browser-entry.js +86 -66
- package/dist/server/app-browser-history-controller.d.ts +5 -4
- package/dist/server/app-browser-history-controller.js +93 -15
- package/dist/server/app-browser-navigation-controller.d.ts +2 -2
- package/dist/server/app-browser-navigation-controller.js +1 -2
- package/dist/server/app-browser-rsc-redirect.js +7 -7
- package/dist/server/app-browser-server-action-client.d.ts +2 -0
- package/dist/server/app-browser-server-action-client.js +5 -4
- package/dist/server/app-browser-state.d.ts +2 -4
- package/dist/server/app-browser-state.js +9 -4
- package/dist/server/app-browser-supplemental-refresh.js +16 -1
- package/dist/server/app-browser-visible-commit.d.ts +1 -1
- package/dist/server/app-browser-visible-commit.js +4 -14
- package/dist/server/app-elements-wire.d.ts +6 -38
- package/dist/server/app-elements-wire.js +4 -41
- package/dist/server/app-elements.d.ts +2 -2
- package/dist/server/app-elements.js +2 -2
- package/dist/server/app-history-state.d.ts +2 -2
- package/dist/server/app-history-state.js +5 -2
- package/dist/server/app-mounted-layouts.d.ts +21 -0
- package/dist/server/app-mounted-layouts.js +67 -0
- package/dist/server/app-optimistic-routing.d.ts +19 -1
- package/dist/server/app-optimistic-routing.js +43 -4
- package/dist/server/app-page-boundary-render.js +10 -14
- package/dist/server/app-page-boundary.js +2 -2
- package/dist/server/app-page-cache-finalizer.d.ts +12 -1
- package/dist/server/app-page-cache-finalizer.js +70 -29
- package/dist/server/app-page-cache.d.ts +13 -1
- package/dist/server/app-page-cache.js +31 -9
- package/dist/server/app-page-dispatch.d.ts +5 -11
- package/dist/server/app-page-dispatch.js +84 -155
- package/dist/server/app-page-element-builder.d.ts +2 -2
- package/dist/server/app-page-element-builder.js +13 -12
- package/dist/server/app-page-execution.d.ts +17 -52
- package/dist/server/app-page-execution.js +102 -95
- package/dist/server/app-page-head.d.ts +13 -0
- package/dist/server/app-page-head.js +44 -16
- package/dist/server/app-page-http-access-fallback-metadata.d.ts +1 -0
- package/dist/server/app-page-http-access-fallback-metadata.js +2 -2
- package/dist/server/app-page-layout-gate.d.ts +35 -0
- package/dist/server/app-page-layout-gate.js +50 -0
- package/dist/server/app-page-params.d.ts +0 -1
- package/dist/server/app-page-params.js +1 -14
- package/dist/server/app-page-probe.d.ts +3 -21
- package/dist/server/app-page-probe.js +4 -37
- package/dist/server/app-page-render.d.ts +2 -13
- package/dist/server/app-page-render.js +103 -234
- package/dist/server/app-page-request.d.ts +1 -3
- package/dist/server/app-page-request.js +1 -1
- package/dist/server/app-page-response.js +3 -3
- package/dist/server/app-page-route-wiring.d.ts +13 -6
- package/dist/server/app-page-route-wiring.js +86 -63
- package/dist/server/app-page-rsc-render-status.d.ts +27 -1
- package/dist/server/app-page-rsc-render-status.js +121 -13
- package/dist/server/app-page-stream.d.ts +12 -8
- package/dist/server/app-page-stream.js +4 -3
- package/dist/server/app-pages-bridge.d.ts +4 -0
- package/dist/server/app-pages-bridge.js +7 -3
- package/dist/server/app-render-dependency.d.ts +11 -4
- package/dist/server/app-render-dependency.js +86 -38
- package/dist/server/app-request-stage-dispatch.js +1 -1
- package/dist/server/app-request-stage-independent-entry.js +1 -1
- package/dist/server/app-route-handler-cache.js +2 -2
- package/dist/server/app-route-handler-dispatch.js +14 -9
- package/dist/server/app-route-handler-execution.js +11 -5
- package/dist/server/app-route-handler-policy.d.ts +1 -1
- package/dist/server/app-route-handler-policy.js +3 -3
- package/dist/server/app-route-handler-response.js +1 -1
- package/dist/server/app-route-handler-runtime.d.ts +1 -1
- package/dist/server/app-route-handler-runtime.js +28 -11
- package/dist/server/app-router-entry.js +1 -1
- package/dist/server/app-rsc-cache-busting.d.ts +12 -12
- package/dist/server/app-rsc-cache-busting.js +31 -72
- package/dist/server/app-rsc-error-handler.d.ts +2 -1
- package/dist/server/app-rsc-error-handler.js +10 -2
- package/dist/server/app-rsc-errors.d.ts +8 -0
- package/dist/server/app-rsc-errors.js +11 -1
- package/dist/server/app-rsc-handler.d.ts +5 -5
- package/dist/server/app-rsc-handler.js +80 -83
- package/dist/server/app-rsc-request-normalization.d.ts +10 -16
- package/dist/server/app-rsc-request-normalization.js +12 -18
- package/dist/server/app-rsc-response-finalizer.js +2 -2
- package/dist/server/app-rsc-response-stage.js +9 -15
- package/dist/server/app-server-action-execution.d.ts +3 -1
- package/dist/server/app-server-action-execution.js +15 -8
- package/dist/server/app-ssr-entry.d.ts +8 -0
- package/dist/server/app-ssr-entry.js +22 -16
- package/dist/server/app-ssr-stream.js +1 -1
- package/dist/server/app-visited-response-cache.d.ts +36 -1
- package/dist/server/app-visited-response-cache.js +46 -5
- package/dist/server/app-worker-stages.d.ts +37 -6
- package/dist/server/app-worker-stages.js +81 -9
- package/dist/server/artifact-compatibility.d.ts +0 -1
- package/dist/server/artifact-compatibility.js +1 -10
- package/dist/server/bfcache-identity.d.ts +7 -0
- package/dist/server/bfcache-identity.js +10 -1
- package/dist/server/cache-proof.d.ts +1 -115
- package/dist/server/cache-proof.js +1 -544
- package/dist/server/cacheability-manifest.js +1 -2
- package/dist/server/cacheability-request.js +13 -8
- package/dist/server/dev-origin-check.d.ts +2 -1
- package/dist/server/dev-origin-check.js +2 -1
- package/dist/server/dev-server.js +6 -4
- package/dist/server/headers.d.ts +6 -3
- package/dist/server/headers.js +9 -5
- package/dist/server/image-optimization.d.ts +5 -0
- package/dist/server/image-optimization.js +6 -1
- package/dist/server/isr-cache.d.ts +8 -2
- package/dist/server/isr-cache.js +30 -2
- package/dist/server/metadata-route-response.js +32 -15
- package/dist/server/middleware-matcher.js +19 -6
- package/dist/server/middleware-runtime.js +6 -2
- package/dist/server/multi-stage.d.ts +57 -12
- package/dist/server/multi-stage.js +13 -1
- package/dist/server/navigation-planner.js +1 -1
- package/dist/server/pages-api-route.js +28 -19
- package/dist/server/pages-media-type.d.ts +21 -1
- package/dist/server/pages-media-type.js +69 -5
- package/dist/server/pages-node-compat.d.ts +1 -1
- package/dist/server/pages-node-compat.js +54 -27
- package/dist/server/pages-page-data.js +2 -1
- package/dist/server/pages-page-handler.js +28 -26
- package/dist/server/pages-page-response.d.ts +9 -0
- package/dist/server/pages-page-response.js +18 -4
- package/dist/server/pages-request-pipeline.d.ts +8 -0
- package/dist/server/pages-request-pipeline.js +2 -2
- package/dist/server/pages-request-stage-entry.js +36 -14
- package/dist/server/pages-response-stage-entry.js +9 -3
- package/dist/server/pages-router-entry.js +3 -2
- package/dist/server/prod-server.d.ts +2 -2
- package/dist/server/prod-server.js +47 -9
- package/dist/server/request-error-log.d.ts +9 -0
- package/dist/server/request-error-log.js +13 -0
- package/dist/server/request-pipeline.d.ts +15 -4
- package/dist/server/request-pipeline.js +43 -15
- package/dist/server/rsc-completion-metadata.js +3 -0
- package/dist/server/shared-cache-identity.d.ts +23 -0
- package/dist/server/shared-cache-identity.js +36 -0
- package/dist/server/static-file-cache.d.ts +9 -0
- package/dist/server/static-file-cache.js +13 -2
- package/dist/server/worker-stages.d.ts +16 -3
- package/dist/server/worker-stages.js +23 -4
- package/dist/shims/cache-handler.js +2 -2
- package/dist/shims/cache-request-state.d.ts +23 -26
- package/dist/shims/cache-request-state.js +22 -57
- package/dist/shims/cache-runtime.d.ts +3 -1
- package/dist/shims/cache-runtime.js +94 -48
- package/dist/shims/cache.d.ts +16 -10
- package/dist/shims/cache.js +47 -36
- package/dist/shims/cacheability-classification.d.ts +2 -0
- package/dist/shims/cdn-cache.d.ts +22 -5
- package/dist/shims/client-hook-error.d.ts +2 -0
- package/dist/shims/client-hook-error.js +16 -1
- package/dist/shims/client-page-root.js +2 -2
- package/dist/shims/dynamic.js +9 -6
- package/dist/shims/error-boundary.js +2 -2
- package/dist/shims/fetch-cache-state.d.ts +5 -1
- package/dist/shims/fetch-cache-state.js +1 -3
- package/dist/shims/fetch-cache.d.ts +2 -1
- package/dist/shims/fetch-cache.js +39 -25
- package/dist/shims/form.js +2 -2
- package/dist/shims/headers.d.ts +10 -24
- package/dist/shims/headers.js +22 -70
- package/dist/shims/internal/cache-context-accessor.d.ts +1 -1
- package/dist/shims/internal/navigation-untracked.js +1 -1
- package/dist/shims/link.js +8 -11
- package/dist/shims/metadata.d.ts +23 -21
- package/dist/shims/metadata.js +62 -24
- package/dist/shims/navigation-server.js +1 -1
- package/dist/shims/navigation.d.ts +74 -7
- package/dist/shims/navigation.js +184 -31
- package/dist/shims/navigation.react-server.js +2 -2
- package/dist/shims/request-state-types.d.ts +3 -2
- package/dist/shims/slot.d.ts +16 -0
- package/dist/shims/slot.js +44 -9
- package/dist/shims/unified-request-context.d.ts +7 -1
- package/dist/shims/unified-request-context.js +3 -3
- package/dist/utils/cache-control-metadata.d.ts +5 -0
- package/dist/utils/cache-control-metadata.js +9 -1
- package/dist/utils/cache-life-profiles.d.ts +33 -0
- package/dist/utils/cache-life-profiles.js +111 -0
- package/dist/utils/middleware-request-headers.d.ts +14 -3
- package/dist/utils/middleware-request-headers.js +54 -7
- package/dist/utils/project.d.ts +2 -2
- package/dist/utils/project.js +3 -16
- package/dist/utils/regex.d.ts +5 -0
- package/dist/utils/regex.js +11 -1
- package/dist/utils/text-stream.d.ts +10 -5
- package/dist/utils/text-stream.js +6 -6
- package/package.json +2 -1
- package/dist/build/layout-classification-types.d.ts +0 -60
- package/dist/build/layout-classification-types.js +0 -1
- package/dist/build/layout-classification.d.ts +0 -62
- package/dist/build/layout-classification.js +0 -98
- package/dist/build/route-classification-injector.d.ts +0 -33
- package/dist/build/route-classification-injector.js +0 -59
- package/dist/build/route-classification-manifest.d.ts +0 -54
- package/dist/build/route-classification-manifest.js +0 -143
- package/dist/server/app-browser-client-reuse-manifest.d.ts +0 -11
- package/dist/server/app-browser-client-reuse-manifest.js +0 -101
- package/dist/server/app-layout-param-observation.d.ts +0 -42
- package/dist/server/app-layout-param-observation.js +0 -168
- package/dist/server/client-reuse-manifest.d.ts +0 -103
- package/dist/server/client-reuse-manifest.js +0 -209
- package/dist/server/skip-cache-proof.d.ts +0 -60
- package/dist/server/skip-cache-proof.js +0 -168
- package/dist/server/static-layout-client-reuse-proof.d.ts +0 -14
- package/dist/server/static-layout-client-reuse-proof.js +0 -33
- package/dist/utils/sorted-array.d.ts +0 -8
- package/dist/utils/sorted-array.js +0 -20
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import path, { toSlash } from "../deps/.pnpm/pathslash@0.1.0/deps/pathslash/dist/index.js";
|
|
2
|
+
import { escapeRegExp } from "../utils/regex.js";
|
|
2
3
|
import { DEFAULT_PAGE_EXTENSIONS, normalizePageExtensions } from "../routing/file-matcher.js";
|
|
3
4
|
import { loadCommonJsModule, shouldRetryAsCommonJs } from "../utils/commonjs-loader.js";
|
|
4
5
|
import { isUnknownRecord } from "../utils/record.js";
|
|
5
6
|
import { PHASE_DEVELOPMENT_SERVER, PHASE_PRODUCTION_BUILD } from "../shims/constants.js";
|
|
6
7
|
import { getHtmlLimitedBotRegex } from "../utils/html-limited-bots.js";
|
|
7
8
|
import { flattenPluginOptions } from "../utils/plugin-options.js";
|
|
9
|
+
import { resolveCacheLifeProfiles } from "../utils/cache-life-profiles.js";
|
|
8
10
|
import { configSourceError } from "./config-source.js";
|
|
9
11
|
import { isExternalUrl } from "../utils/external-url.js";
|
|
10
12
|
import { applyLocaleToRoutes } from "./config-matchers.js";
|
|
@@ -375,7 +377,11 @@ function warnDeprecatedConfigOptions(config, root) {
|
|
|
375
377
|
];
|
|
376
378
|
for (const [propertyPath, warning] of warnings) if (hasConfigProperty(config, propertyPath)) warnConfigOnce(warning);
|
|
377
379
|
const experimental = readOptionalRecord(config.experimental);
|
|
378
|
-
for (const key of [
|
|
380
|
+
for (const key of [
|
|
381
|
+
"skipTrailingSlashRedirect",
|
|
382
|
+
"cacheComponents",
|
|
383
|
+
"cacheLife"
|
|
384
|
+
]) if (experimental?.[key] != null) warnConfigOnce(`\`experimental.${key}\` has been moved to \`${key}\`. Please update your ${configFileName} file accordingly.`);
|
|
379
385
|
}
|
|
380
386
|
async function resolveNextConfigInput(config, phase = PHASE_DEVELOPMENT_SERVER) {
|
|
381
387
|
return await resolveConfigValue(config, phase);
|
|
@@ -884,6 +890,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
884
890
|
resolveExtensions: null,
|
|
885
891
|
serverResolveExtensions: null,
|
|
886
892
|
cacheComponents: false,
|
|
893
|
+
cachedNavigations: false,
|
|
887
894
|
appNavFailHandling: false,
|
|
888
895
|
gestureTransition: false,
|
|
889
896
|
prefetchInlining: false,
|
|
@@ -897,6 +904,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
897
904
|
images: void 0,
|
|
898
905
|
i18n: null,
|
|
899
906
|
mdx: null,
|
|
907
|
+
nextIntlCatalogLoader: null,
|
|
900
908
|
aliases: {},
|
|
901
909
|
allowedDevOrigins: [],
|
|
902
910
|
serverActionsAllowedOrigins: [],
|
|
@@ -932,6 +940,10 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
932
940
|
instrumentationServerValueInjections: {},
|
|
933
941
|
clientTraceMetadata: void 0,
|
|
934
942
|
staleTimes: { ...DEFAULT_STALE_TIMES },
|
|
943
|
+
cacheLife: resolveCacheLifeProfiles(void 0, {
|
|
944
|
+
expireTime: DEFAULT_EXPIRE_TIME,
|
|
945
|
+
staticStaleTime: DEFAULT_STALE_TIMES.static
|
|
946
|
+
}, warnConfigOnce),
|
|
935
947
|
useLightningcss: false,
|
|
936
948
|
lightningCssFeatures: {
|
|
937
949
|
include: 0,
|
|
@@ -1011,6 +1023,8 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1011
1023
|
const allowedDevOrigins = Array.isArray(config.allowedDevOrigins) ? config.allowedDevOrigins : [];
|
|
1012
1024
|
const experimental = readOptionalRecord(config.experimental);
|
|
1013
1025
|
const cacheComponents = (experimental?.cacheComponents ?? config.cacheComponents) === true;
|
|
1026
|
+
const expireTime = typeof config.expireTime === "number" ? config.expireTime : DEFAULT_EXPIRE_TIME;
|
|
1027
|
+
const staleTimes = resolveStaleTimes(experimental);
|
|
1014
1028
|
const serverActionsConfig = readOptionalRecord(experimental?.serverActions);
|
|
1015
1029
|
const serverActionsAllowedOrigins = readStringArray(serverActionsConfig?.allowedOrigins);
|
|
1016
1030
|
const serverActionsBodySizeLimitConfig = readOptionalBodySizeLimit(serverActionsConfig?.bodySizeLimit);
|
|
@@ -1049,7 +1063,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1049
1063
|
if (rawLightningCssFeatures && !useLightningcss) console.warn("[vinext] experimental.lightningCssFeatures is set but experimental.useLightningcss is not enabled. The lightningCssFeatures option has no effect without useLightningcss.");
|
|
1050
1064
|
if (experimental?.cachedNavigations === true && !cacheComponents) console.warn("[vinext] `experimental.cachedNavigations` requires `cacheComponents: true` to have any effect. Set `cacheComponents: true` in your next.config, or remove `experimental.cachedNavigations`.");
|
|
1051
1065
|
if (config.webpack !== void 0) {
|
|
1052
|
-
if (mdx || Object.keys(webpackProbe.aliases).length > 0 || webpackProbe.resolveExtensionsCustomized || webpackProbe.instrumentationClientRouteManifest !== void 0) console.warn("[vinext] next.config option \"webpack\" is only partially supported. vinext preserves resolve.alias, resolve.extensions, MDX loader settings, and instrumentation-client route manifests, but other webpack customization is ignored");
|
|
1066
|
+
if (mdx || Object.keys(webpackProbe.aliases).length > 0 || webpackProbe.resolveExtensionsCustomized || webpackProbe.instrumentationClientRouteManifest !== void 0 || webpackProbe.nextIntlCatalogLoader !== null) console.warn("[vinext] next.config option \"webpack\" is only partially supported. vinext preserves resolve.alias, resolve.extensions, MDX loader settings, next-intl message catalog loaders, and instrumentation-client route manifests, but other webpack customization is ignored");
|
|
1053
1067
|
else console.warn("[vinext] next.config option \"webpack\" is not yet supported and will be ignored");
|
|
1054
1068
|
}
|
|
1055
1069
|
const output = readOptionalString(config.output) ?? "";
|
|
@@ -1099,6 +1113,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1099
1113
|
instrumentationClientRouteManifest: webpackProbe.instrumentationClientRouteManifest,
|
|
1100
1114
|
instrumentationServerValueInjections: webpackProbe.instrumentationServerValueInjections,
|
|
1101
1115
|
cacheComponents,
|
|
1116
|
+
cachedNavigations: cacheComponents && experimental?.cachedNavigations === true,
|
|
1102
1117
|
appNavFailHandling: experimental?.appNavFailHandling === true,
|
|
1103
1118
|
gestureTransition: experimental?.gestureTransition === true,
|
|
1104
1119
|
prefetchInlining,
|
|
@@ -1108,6 +1123,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1108
1123
|
images,
|
|
1109
1124
|
i18n,
|
|
1110
1125
|
mdx,
|
|
1126
|
+
nextIntlCatalogLoader: webpackProbe.nextIntlCatalogLoader ?? extractTurbopackNextIntlCatalogLoader(config, root),
|
|
1111
1127
|
aliases,
|
|
1112
1128
|
allowedDevOrigins,
|
|
1113
1129
|
serverActionsAllowedOrigins,
|
|
@@ -1119,7 +1135,7 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1119
1135
|
globalNotFound,
|
|
1120
1136
|
serverActionsBodySizeLimit,
|
|
1121
1137
|
serverActionsBodySizeLimitLabel,
|
|
1122
|
-
expireTime
|
|
1138
|
+
expireTime,
|
|
1123
1139
|
reactMaxHeadersLength: typeof config.reactMaxHeadersLength === "number" ? config.reactMaxHeadersLength : DEFAULT_REACT_MAX_HEADERS_LENGTH,
|
|
1124
1140
|
htmlLimitedBots,
|
|
1125
1141
|
serverExternalPackages,
|
|
@@ -1139,11 +1155,16 @@ async function resolveNextConfig(config, root = toSlash(process.cwd()), options
|
|
|
1139
1155
|
compilerDefine: serializeCompilerDefine(config.compiler?.define),
|
|
1140
1156
|
compilerDefineServer: serializeCompilerDefine(config.compiler?.defineServer),
|
|
1141
1157
|
clientTraceMetadata: Array.isArray(experimental?.clientTraceMetadata) ? experimental.clientTraceMetadata.filter((value) => typeof value === "string") : void 0,
|
|
1142
|
-
staleTimes
|
|
1158
|
+
staleTimes,
|
|
1159
|
+
cacheLife: resolveCacheLifeProfiles(experimental?.cacheLife ?? config.cacheLife, {
|
|
1160
|
+
expireTime,
|
|
1161
|
+
staticStaleTime: staleTimes.static
|
|
1162
|
+
}, warnConfigOnce),
|
|
1143
1163
|
useLightningcss,
|
|
1144
1164
|
lightningCssFeatures
|
|
1145
1165
|
};
|
|
1146
1166
|
detectNextIntlConfig(root, resolved);
|
|
1167
|
+
if (resolved.aliases["use-intl/format-message"]?.includes("format-only") && resolved.nextIntlCatalogLoader === null) console.warn("[vinext] next-intl's `experimental.messages.precompile` is enabled, but vinext could not find next-intl's catalog loader in the webpack or Turbopack config. Messages with arguments or rich text will render their raw ICU source; remove `precompile` to format them at runtime");
|
|
1147
1168
|
if (resolved.basePath !== "" && resolved.basePath !== "/" && resolved.assetPrefix === "") resolved.assetPrefix = resolved.basePath;
|
|
1148
1169
|
return resolved;
|
|
1149
1170
|
}
|
|
@@ -1180,10 +1201,36 @@ function extractTurboAliases(config, root) {
|
|
|
1180
1201
|
...normalizeAliasEntries(readOptionalRecord(topLevelTurbopack?.resolveAlias), root)
|
|
1181
1202
|
};
|
|
1182
1203
|
}
|
|
1204
|
+
function extractTurbopackNextIntlCatalogLoader(config, root) {
|
|
1205
|
+
const experimental = readOptionalRecord(config.experimental);
|
|
1206
|
+
for (const turbo of [readOptionalRecord(config.turbopack), readOptionalRecord(experimental?.turbo)]) {
|
|
1207
|
+
const rules = readOptionalRecord(turbo?.rules);
|
|
1208
|
+
for (const [glob, entry] of Object.entries(rules ?? {})) {
|
|
1209
|
+
const extension = /^\*(\.[^*/{}]+)$/.exec(glob)?.[1];
|
|
1210
|
+
if (!extension) continue;
|
|
1211
|
+
for (const rule of Array.isArray(entry) ? entry : [entry]) {
|
|
1212
|
+
if (!isUnknownRecord(rule) || !Array.isArray(rule.loaders)) continue;
|
|
1213
|
+
const loader = rule.loaders.find((use) => isUnknownRecord(use) && use.loader === NEXT_INTL_CATALOG_LOADER);
|
|
1214
|
+
if (!isUnknownRecord(loader) || !isUnknownRecord(loader.options)) continue;
|
|
1215
|
+
const condition = readOptionalRecord(rule.condition);
|
|
1216
|
+
const dirs = typeof condition?.path === "string" ? /^(?:\{([^{}]+)\}|([^{}]+))\/\*\*\/\*$/.exec(condition.path) : null;
|
|
1217
|
+
const include = (dirs?.[1]?.split(",") ?? (dirs?.[2] ? [dirs[2]] : [])).map((dir) => path.resolve(root, dir));
|
|
1218
|
+
if (include.length === 0) continue;
|
|
1219
|
+
return {
|
|
1220
|
+
include,
|
|
1221
|
+
test: new RegExp(`${escapeRegExp(extension)}$`),
|
|
1222
|
+
options: loader.options
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return null;
|
|
1228
|
+
}
|
|
1183
1229
|
async function probeWebpackConfig(config, root, dev) {
|
|
1184
1230
|
if (typeof config.webpack !== "function") return {
|
|
1185
1231
|
aliases: {},
|
|
1186
1232
|
mdx: null,
|
|
1233
|
+
nextIntlCatalogLoader: null,
|
|
1187
1234
|
resolveExtensions: null,
|
|
1188
1235
|
serverResolveExtensions: null,
|
|
1189
1236
|
resolveExtensionsCustomized: false,
|
|
@@ -1204,6 +1251,7 @@ async function probeWebpackConfig(config, root, dev) {
|
|
|
1204
1251
|
return {
|
|
1205
1252
|
aliases: normalizeAliasEntries(clientProbe.config.resolve?.alias, root),
|
|
1206
1253
|
mdx: extractMdxOptionsFromRules(clientProbe.rules),
|
|
1254
|
+
nextIntlCatalogLoader: extractNextIntlCatalogLoader(clientProbe.rules),
|
|
1207
1255
|
resolveExtensions: clientProbe.resolveExtensions,
|
|
1208
1256
|
serverResolveExtensions: serverProbe.resolveExtensions,
|
|
1209
1257
|
resolveExtensionsCustomized: clientProbe.resolveExtensions !== null || serverProbe.resolveExtensions !== null,
|
|
@@ -1214,6 +1262,7 @@ async function probeWebpackConfig(config, root, dev) {
|
|
|
1214
1262
|
return {
|
|
1215
1263
|
aliases: {},
|
|
1216
1264
|
mdx: null,
|
|
1265
|
+
nextIntlCatalogLoader: null,
|
|
1217
1266
|
resolveExtensions: null,
|
|
1218
1267
|
serverResolveExtensions: null,
|
|
1219
1268
|
resolveExtensionsCustomized: false,
|
|
@@ -1246,6 +1295,35 @@ function extractInstrumentationClientRouteManifest(rules) {
|
|
|
1246
1295
|
for (const rule of rules) visit(rule);
|
|
1247
1296
|
return manifest;
|
|
1248
1297
|
}
|
|
1298
|
+
const NEXT_INTL_CATALOG_LOADER = "next-intl/extractor/catalogLoader";
|
|
1299
|
+
function extractNextIntlCatalogLoader(rules) {
|
|
1300
|
+
let catalogLoader = null;
|
|
1301
|
+
const visit = (rule) => {
|
|
1302
|
+
if (!rule || typeof rule !== "object") return;
|
|
1303
|
+
if (Array.isArray(rule)) {
|
|
1304
|
+
for (const child of rule) visit(child);
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
if (Array.isArray(rule.oneOf)) for (const child of rule.oneOf) visit(child);
|
|
1308
|
+
if (Array.isArray(rule.rules)) for (const child of rule.rules) visit(child);
|
|
1309
|
+
if (!(rule.test instanceof RegExp)) return;
|
|
1310
|
+
const include = typeof rule.include === "string" ? [rule.include] : rule.include;
|
|
1311
|
+
if (!Array.isArray(include) || include.length === 0) return;
|
|
1312
|
+
if (!include.every((dir) => typeof dir === "string")) return;
|
|
1313
|
+
const uses = Array.isArray(rule.use) ? rule.use : rule.use ? [rule.use] : [];
|
|
1314
|
+
for (const use of uses) {
|
|
1315
|
+
if (!isUnknownRecord(use) || use.loader !== NEXT_INTL_CATALOG_LOADER) continue;
|
|
1316
|
+
if (!isUnknownRecord(use.options)) continue;
|
|
1317
|
+
catalogLoader = {
|
|
1318
|
+
include,
|
|
1319
|
+
test: rule.test,
|
|
1320
|
+
options: use.options
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
for (const rule of rules) visit(rule);
|
|
1325
|
+
return catalogLoader;
|
|
1326
|
+
}
|
|
1249
1327
|
function matchesWebpackCondition(condition, value) {
|
|
1250
1328
|
if (typeof condition === "string") return value.startsWith(condition);
|
|
1251
1329
|
if (condition instanceof RegExp) {
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_safer } from "../../../../safer-buffer@2.1.2/deps/safer-buffer/safer.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/dbcs-codec.js
|
|
4
|
+
var require_dbcs_codec = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5
|
+
var Buffer = require_safer().Buffer;
|
|
6
|
+
exports._dbcs = DBCSCodec;
|
|
7
|
+
var UNASSIGNED = -1;
|
|
8
|
+
var GB18030_CODE = -2;
|
|
9
|
+
var SEQ_START = -10;
|
|
10
|
+
var NODE_START = -1e3;
|
|
11
|
+
var UNASSIGNED_NODE = new Array(256);
|
|
12
|
+
var DEF_CHAR = -1;
|
|
13
|
+
for (var i = 0; i < 256; i++) UNASSIGNED_NODE[i] = UNASSIGNED;
|
|
14
|
+
function DBCSCodec(codecOptions, iconv) {
|
|
15
|
+
this.encodingName = codecOptions.encodingName;
|
|
16
|
+
if (!codecOptions) throw new Error("DBCS codec is called without the data.");
|
|
17
|
+
if (!codecOptions.table) throw new Error("Encoding '" + this.encodingName + "' has no data.");
|
|
18
|
+
var mappingTable = codecOptions.table();
|
|
19
|
+
this.decodeTables = [];
|
|
20
|
+
this.decodeTables[0] = UNASSIGNED_NODE.slice(0);
|
|
21
|
+
this.decodeTableSeq = [];
|
|
22
|
+
for (var i = 0; i < mappingTable.length; i++) this._addDecodeChunk(mappingTable[i]);
|
|
23
|
+
this.defaultCharUnicode = iconv.defaultCharUnicode;
|
|
24
|
+
this.encodeTable = [];
|
|
25
|
+
this.encodeTableSeq = [];
|
|
26
|
+
var skipEncodeChars = {};
|
|
27
|
+
if (codecOptions.encodeSkipVals) for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
|
|
28
|
+
var val = codecOptions.encodeSkipVals[i];
|
|
29
|
+
if (typeof val === "number") skipEncodeChars[val] = true;
|
|
30
|
+
else for (var j = val.from; j <= val.to; j++) skipEncodeChars[j] = true;
|
|
31
|
+
}
|
|
32
|
+
this._fillEncodeTable(0, 0, skipEncodeChars);
|
|
33
|
+
if (codecOptions.encodeAdd) {
|
|
34
|
+
for (var uChar in codecOptions.encodeAdd) if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
|
|
35
|
+
}
|
|
36
|
+
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
|
|
37
|
+
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]["?"];
|
|
38
|
+
if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
|
|
39
|
+
if (typeof codecOptions.gb18030 === "function") {
|
|
40
|
+
this.gb18030 = codecOptions.gb18030();
|
|
41
|
+
var thirdByteNodeIdx = this.decodeTables.length;
|
|
42
|
+
var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
|
43
|
+
var fourthByteNodeIdx = this.decodeTables.length;
|
|
44
|
+
var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0);
|
|
45
|
+
for (var i = 129; i <= 254; i++) {
|
|
46
|
+
var secondByteNodeIdx = NODE_START - this.decodeTables[0][i];
|
|
47
|
+
var secondByteNode = this.decodeTables[secondByteNodeIdx];
|
|
48
|
+
for (var j = 48; j <= 57; j++) secondByteNode[j] = NODE_START - thirdByteNodeIdx;
|
|
49
|
+
}
|
|
50
|
+
for (var i = 129; i <= 254; i++) thirdByteNode[i] = NODE_START - fourthByteNodeIdx;
|
|
51
|
+
for (var i = 48; i <= 57; i++) fourthByteNode[i] = GB18030_CODE;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
DBCSCodec.prototype.encoder = DBCSEncoder;
|
|
55
|
+
DBCSCodec.prototype.decoder = DBCSDecoder;
|
|
56
|
+
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
|
|
57
|
+
var bytes = [];
|
|
58
|
+
for (; addr > 0; addr >>= 8) bytes.push(addr & 255);
|
|
59
|
+
if (bytes.length == 0) bytes.push(0);
|
|
60
|
+
var node = this.decodeTables[0];
|
|
61
|
+
for (var i = bytes.length - 1; i > 0; i--) {
|
|
62
|
+
var val = node[bytes[i]];
|
|
63
|
+
if (val == UNASSIGNED) {
|
|
64
|
+
node[bytes[i]] = NODE_START - this.decodeTables.length;
|
|
65
|
+
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
|
|
66
|
+
} else if (val <= NODE_START) node = this.decodeTables[NODE_START - val];
|
|
67
|
+
else throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
|
|
68
|
+
}
|
|
69
|
+
return node;
|
|
70
|
+
};
|
|
71
|
+
DBCSCodec.prototype._addDecodeChunk = function(chunk) {
|
|
72
|
+
var curAddr = parseInt(chunk[0], 16);
|
|
73
|
+
var writeTable = this._getDecodeTrieNode(curAddr);
|
|
74
|
+
curAddr = curAddr & 255;
|
|
75
|
+
for (var k = 1; k < chunk.length; k++) {
|
|
76
|
+
var part = chunk[k];
|
|
77
|
+
if (typeof part === "string") for (var l = 0; l < part.length;) {
|
|
78
|
+
var code = part.charCodeAt(l++);
|
|
79
|
+
if (55296 <= code && code < 56320) {
|
|
80
|
+
var codeTrail = part.charCodeAt(l++);
|
|
81
|
+
if (56320 <= codeTrail && codeTrail < 57344) writeTable[curAddr++] = 65536 + (code - 55296) * 1024 + (codeTrail - 56320);
|
|
82
|
+
else throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
|
|
83
|
+
} else if (4080 < code && code <= 4095) {
|
|
84
|
+
var len = 4095 - code + 2;
|
|
85
|
+
var seq = [];
|
|
86
|
+
for (var m = 0; m < len; m++) seq.push(part.charCodeAt(l++));
|
|
87
|
+
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
|
|
88
|
+
this.decodeTableSeq.push(seq);
|
|
89
|
+
} else writeTable[curAddr++] = code;
|
|
90
|
+
}
|
|
91
|
+
else if (typeof part === "number") {
|
|
92
|
+
var charCode = writeTable[curAddr - 1] + 1;
|
|
93
|
+
for (var l = 0; l < part; l++) writeTable[curAddr++] = charCode++;
|
|
94
|
+
} else throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
|
|
95
|
+
}
|
|
96
|
+
if (curAddr > 255) throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
|
|
97
|
+
};
|
|
98
|
+
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
|
|
99
|
+
var high = uCode >> 8;
|
|
100
|
+
if (this.encodeTable[high] === void 0) this.encodeTable[high] = UNASSIGNED_NODE.slice(0);
|
|
101
|
+
return this.encodeTable[high];
|
|
102
|
+
};
|
|
103
|
+
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
|
|
104
|
+
var bucket = this._getEncodeBucket(uCode);
|
|
105
|
+
var low = uCode & 255;
|
|
106
|
+
if (bucket[low] <= SEQ_START) this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = dbcsCode;
|
|
107
|
+
else if (bucket[low] == UNASSIGNED) bucket[low] = dbcsCode;
|
|
108
|
+
};
|
|
109
|
+
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
|
|
110
|
+
var uCode = seq[0];
|
|
111
|
+
var bucket = this._getEncodeBucket(uCode);
|
|
112
|
+
var low = uCode & 255;
|
|
113
|
+
var node;
|
|
114
|
+
if (bucket[low] <= SEQ_START) node = this.encodeTableSeq[SEQ_START - bucket[low]];
|
|
115
|
+
else {
|
|
116
|
+
node = {};
|
|
117
|
+
if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low];
|
|
118
|
+
bucket[low] = SEQ_START - this.encodeTableSeq.length;
|
|
119
|
+
this.encodeTableSeq.push(node);
|
|
120
|
+
}
|
|
121
|
+
for (var j = 1; j < seq.length - 1; j++) {
|
|
122
|
+
var oldVal = node[uCode];
|
|
123
|
+
if (typeof oldVal === "object") node = oldVal;
|
|
124
|
+
else {
|
|
125
|
+
node = node[uCode] = {};
|
|
126
|
+
if (oldVal !== void 0) node[DEF_CHAR] = oldVal;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
uCode = seq[seq.length - 1];
|
|
130
|
+
node[uCode] = dbcsCode;
|
|
131
|
+
};
|
|
132
|
+
DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
|
|
133
|
+
var node = this.decodeTables[nodeIdx];
|
|
134
|
+
for (var i = 0; i < 256; i++) {
|
|
135
|
+
var uCode = node[i];
|
|
136
|
+
var mbCode = prefix + i;
|
|
137
|
+
if (skipEncodeChars[mbCode]) continue;
|
|
138
|
+
if (uCode >= 0) this._setEncodeChar(uCode, mbCode);
|
|
139
|
+
else if (uCode <= NODE_START) this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars);
|
|
140
|
+
else if (uCode <= SEQ_START) this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function DBCSEncoder(options, codec) {
|
|
144
|
+
this.leadSurrogate = -1;
|
|
145
|
+
this.seqObj = void 0;
|
|
146
|
+
this.encodeTable = codec.encodeTable;
|
|
147
|
+
this.encodeTableSeq = codec.encodeTableSeq;
|
|
148
|
+
this.defaultCharSingleByte = codec.defCharSB;
|
|
149
|
+
this.gb18030 = codec.gb18030;
|
|
150
|
+
}
|
|
151
|
+
DBCSEncoder.prototype.write = function(str) {
|
|
152
|
+
var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), leadSurrogate = this.leadSurrogate, seqObj = this.seqObj, nextChar = -1, i = 0, j = 0;
|
|
153
|
+
while (true) {
|
|
154
|
+
if (nextChar === -1) {
|
|
155
|
+
if (i == str.length) break;
|
|
156
|
+
var uCode = str.charCodeAt(i++);
|
|
157
|
+
} else {
|
|
158
|
+
var uCode = nextChar;
|
|
159
|
+
nextChar = -1;
|
|
160
|
+
}
|
|
161
|
+
if (55296 <= uCode && uCode < 57344) {
|
|
162
|
+
if (uCode < 56320) {
|
|
163
|
+
if (leadSurrogate === -1) {
|
|
164
|
+
leadSurrogate = uCode;
|
|
165
|
+
continue;
|
|
166
|
+
} else {
|
|
167
|
+
leadSurrogate = uCode;
|
|
168
|
+
uCode = UNASSIGNED;
|
|
169
|
+
}
|
|
170
|
+
} else if (leadSurrogate !== -1) {
|
|
171
|
+
uCode = 65536 + (leadSurrogate - 55296) * 1024 + (uCode - 56320);
|
|
172
|
+
leadSurrogate = -1;
|
|
173
|
+
} else uCode = UNASSIGNED;
|
|
174
|
+
} else if (leadSurrogate !== -1) {
|
|
175
|
+
nextChar = uCode;
|
|
176
|
+
uCode = UNASSIGNED;
|
|
177
|
+
leadSurrogate = -1;
|
|
178
|
+
}
|
|
179
|
+
var dbcsCode = UNASSIGNED;
|
|
180
|
+
if (seqObj !== void 0 && uCode != UNASSIGNED) {
|
|
181
|
+
var resCode = seqObj[uCode];
|
|
182
|
+
if (typeof resCode === "object") {
|
|
183
|
+
seqObj = resCode;
|
|
184
|
+
continue;
|
|
185
|
+
} else if (typeof resCode == "number") dbcsCode = resCode;
|
|
186
|
+
else if (resCode == void 0) {
|
|
187
|
+
resCode = seqObj[DEF_CHAR];
|
|
188
|
+
if (resCode !== void 0) {
|
|
189
|
+
dbcsCode = resCode;
|
|
190
|
+
nextChar = uCode;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
seqObj = void 0;
|
|
194
|
+
} else if (uCode >= 0) {
|
|
195
|
+
var subtable = this.encodeTable[uCode >> 8];
|
|
196
|
+
if (subtable !== void 0) dbcsCode = subtable[uCode & 255];
|
|
197
|
+
if (dbcsCode <= SEQ_START) {
|
|
198
|
+
seqObj = this.encodeTableSeq[SEQ_START - dbcsCode];
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (dbcsCode == UNASSIGNED && this.gb18030) {
|
|
202
|
+
var idx = findIdx(this.gb18030.uChars, uCode);
|
|
203
|
+
if (idx != -1) {
|
|
204
|
+
var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
|
|
205
|
+
newBuf[j++] = 129 + Math.floor(dbcsCode / 12600);
|
|
206
|
+
dbcsCode = dbcsCode % 12600;
|
|
207
|
+
newBuf[j++] = 48 + Math.floor(dbcsCode / 1260);
|
|
208
|
+
dbcsCode = dbcsCode % 1260;
|
|
209
|
+
newBuf[j++] = 129 + Math.floor(dbcsCode / 10);
|
|
210
|
+
dbcsCode = dbcsCode % 10;
|
|
211
|
+
newBuf[j++] = 48 + dbcsCode;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (dbcsCode === UNASSIGNED) dbcsCode = this.defaultCharSingleByte;
|
|
217
|
+
if (dbcsCode < 256) newBuf[j++] = dbcsCode;
|
|
218
|
+
else if (dbcsCode < 65536) {
|
|
219
|
+
newBuf[j++] = dbcsCode >> 8;
|
|
220
|
+
newBuf[j++] = dbcsCode & 255;
|
|
221
|
+
} else {
|
|
222
|
+
newBuf[j++] = dbcsCode >> 16;
|
|
223
|
+
newBuf[j++] = dbcsCode >> 8 & 255;
|
|
224
|
+
newBuf[j++] = dbcsCode & 255;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.seqObj = seqObj;
|
|
228
|
+
this.leadSurrogate = leadSurrogate;
|
|
229
|
+
return newBuf.slice(0, j);
|
|
230
|
+
};
|
|
231
|
+
DBCSEncoder.prototype.end = function() {
|
|
232
|
+
if (this.leadSurrogate === -1 && this.seqObj === void 0) return;
|
|
233
|
+
var newBuf = Buffer.alloc(10), j = 0;
|
|
234
|
+
if (this.seqObj) {
|
|
235
|
+
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
236
|
+
if (dbcsCode !== void 0) {
|
|
237
|
+
if (dbcsCode < 256) newBuf[j++] = dbcsCode;
|
|
238
|
+
else {
|
|
239
|
+
newBuf[j++] = dbcsCode >> 8;
|
|
240
|
+
newBuf[j++] = dbcsCode & 255;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
this.seqObj = void 0;
|
|
244
|
+
}
|
|
245
|
+
if (this.leadSurrogate !== -1) {
|
|
246
|
+
newBuf[j++] = this.defaultCharSingleByte;
|
|
247
|
+
this.leadSurrogate = -1;
|
|
248
|
+
}
|
|
249
|
+
return newBuf.slice(0, j);
|
|
250
|
+
};
|
|
251
|
+
DBCSEncoder.prototype.findIdx = findIdx;
|
|
252
|
+
function DBCSDecoder(options, codec) {
|
|
253
|
+
this.nodeIdx = 0;
|
|
254
|
+
this.prevBuf = Buffer.alloc(0);
|
|
255
|
+
this.decodeTables = codec.decodeTables;
|
|
256
|
+
this.decodeTableSeq = codec.decodeTableSeq;
|
|
257
|
+
this.defaultCharUnicode = codec.defaultCharUnicode;
|
|
258
|
+
this.gb18030 = codec.gb18030;
|
|
259
|
+
}
|
|
260
|
+
DBCSDecoder.prototype.write = function(buf) {
|
|
261
|
+
var newBuf = Buffer.alloc(buf.length * 2), nodeIdx = this.nodeIdx, prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, seqStart = -this.prevBuf.length, uCode;
|
|
262
|
+
if (prevBufOffset > 0) prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]);
|
|
263
|
+
for (var i = 0, j = 0; i < buf.length; i++) {
|
|
264
|
+
var curByte = i >= 0 ? buf[i] : prevBuf[i + prevBufOffset];
|
|
265
|
+
var uCode = this.decodeTables[nodeIdx][curByte];
|
|
266
|
+
if (uCode >= 0) {} else if (uCode === UNASSIGNED) {
|
|
267
|
+
i = seqStart;
|
|
268
|
+
uCode = this.defaultCharUnicode.charCodeAt(0);
|
|
269
|
+
} else if (uCode === GB18030_CODE) {
|
|
270
|
+
var curSeq = seqStart >= 0 ? buf.slice(seqStart, i + 1) : prevBuf.slice(seqStart + prevBufOffset, i + 1 + prevBufOffset);
|
|
271
|
+
var ptr = (curSeq[0] - 129) * 12600 + (curSeq[1] - 48) * 1260 + (curSeq[2] - 129) * 10 + (curSeq[3] - 48);
|
|
272
|
+
var idx = findIdx(this.gb18030.gbChars, ptr);
|
|
273
|
+
uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
|
|
274
|
+
} else if (uCode <= NODE_START) {
|
|
275
|
+
nodeIdx = NODE_START - uCode;
|
|
276
|
+
continue;
|
|
277
|
+
} else if (uCode <= SEQ_START) {
|
|
278
|
+
var seq = this.decodeTableSeq[SEQ_START - uCode];
|
|
279
|
+
for (var k = 0; k < seq.length - 1; k++) {
|
|
280
|
+
uCode = seq[k];
|
|
281
|
+
newBuf[j++] = uCode & 255;
|
|
282
|
+
newBuf[j++] = uCode >> 8;
|
|
283
|
+
}
|
|
284
|
+
uCode = seq[seq.length - 1];
|
|
285
|
+
} else throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
|
286
|
+
if (uCode > 65535) {
|
|
287
|
+
uCode -= 65536;
|
|
288
|
+
var uCodeLead = 55296 + Math.floor(uCode / 1024);
|
|
289
|
+
newBuf[j++] = uCodeLead & 255;
|
|
290
|
+
newBuf[j++] = uCodeLead >> 8;
|
|
291
|
+
uCode = 56320 + uCode % 1024;
|
|
292
|
+
}
|
|
293
|
+
newBuf[j++] = uCode & 255;
|
|
294
|
+
newBuf[j++] = uCode >> 8;
|
|
295
|
+
nodeIdx = 0;
|
|
296
|
+
seqStart = i + 1;
|
|
297
|
+
}
|
|
298
|
+
this.nodeIdx = nodeIdx;
|
|
299
|
+
this.prevBuf = seqStart >= 0 ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset);
|
|
300
|
+
return newBuf.slice(0, j).toString("ucs2");
|
|
301
|
+
};
|
|
302
|
+
DBCSDecoder.prototype.end = function() {
|
|
303
|
+
var ret = "";
|
|
304
|
+
while (this.prevBuf.length > 0) {
|
|
305
|
+
ret += this.defaultCharUnicode;
|
|
306
|
+
var buf = this.prevBuf.slice(1);
|
|
307
|
+
this.prevBuf = Buffer.alloc(0);
|
|
308
|
+
this.nodeIdx = 0;
|
|
309
|
+
if (buf.length > 0) ret += this.write(buf);
|
|
310
|
+
}
|
|
311
|
+
this.nodeIdx = 0;
|
|
312
|
+
return ret;
|
|
313
|
+
};
|
|
314
|
+
function findIdx(table, val) {
|
|
315
|
+
if (table[0] > val) return -1;
|
|
316
|
+
var l = 0, r = table.length;
|
|
317
|
+
while (l < r - 1) {
|
|
318
|
+
var mid = l + Math.floor((r - l + 1) / 2);
|
|
319
|
+
if (table[mid] <= val) l = mid;
|
|
320
|
+
else r = mid;
|
|
321
|
+
}
|
|
322
|
+
return l;
|
|
323
|
+
}
|
|
324
|
+
}));
|
|
325
|
+
//#endregion
|
|
326
|
+
export default require_dbcs_codec();
|
|
327
|
+
export { require_dbcs_codec };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_shiftjis } from "./tables/shiftjis.json.js";
|
|
3
|
+
import { require_eucjp } from "./tables/eucjp.json.js";
|
|
4
|
+
import { require_cp936 } from "./tables/cp936.json.js";
|
|
5
|
+
import { require_gbk_added } from "./tables/gbk-added.json.js";
|
|
6
|
+
import { require_gb18030_ranges } from "./tables/gb18030-ranges.json.js";
|
|
7
|
+
import { require_cp949 } from "./tables/cp949.json.js";
|
|
8
|
+
import { require_cp950 } from "./tables/cp950.json.js";
|
|
9
|
+
import { require_big5_added } from "./tables/big5-added.json.js";
|
|
10
|
+
//#region ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/dbcs-data.js
|
|
11
|
+
var require_dbcs_data = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12
|
+
module.exports = {
|
|
13
|
+
"shiftjis": {
|
|
14
|
+
type: "_dbcs",
|
|
15
|
+
table: function() {
|
|
16
|
+
return require_shiftjis();
|
|
17
|
+
},
|
|
18
|
+
encodeAdd: {
|
|
19
|
+
"¥": 92,
|
|
20
|
+
"‾": 126
|
|
21
|
+
},
|
|
22
|
+
encodeSkipVals: [{
|
|
23
|
+
from: 60736,
|
|
24
|
+
to: 63808
|
|
25
|
+
}]
|
|
26
|
+
},
|
|
27
|
+
"csshiftjis": "shiftjis",
|
|
28
|
+
"mskanji": "shiftjis",
|
|
29
|
+
"sjis": "shiftjis",
|
|
30
|
+
"windows31j": "shiftjis",
|
|
31
|
+
"ms31j": "shiftjis",
|
|
32
|
+
"xsjis": "shiftjis",
|
|
33
|
+
"windows932": "shiftjis",
|
|
34
|
+
"ms932": "shiftjis",
|
|
35
|
+
"932": "shiftjis",
|
|
36
|
+
"cp932": "shiftjis",
|
|
37
|
+
"eucjp": {
|
|
38
|
+
type: "_dbcs",
|
|
39
|
+
table: function() {
|
|
40
|
+
return require_eucjp();
|
|
41
|
+
},
|
|
42
|
+
encodeAdd: {
|
|
43
|
+
"¥": 92,
|
|
44
|
+
"‾": 126
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"gb2312": "cp936",
|
|
48
|
+
"gb231280": "cp936",
|
|
49
|
+
"gb23121980": "cp936",
|
|
50
|
+
"csgb2312": "cp936",
|
|
51
|
+
"csiso58gb231280": "cp936",
|
|
52
|
+
"euccn": "cp936",
|
|
53
|
+
"windows936": "cp936",
|
|
54
|
+
"ms936": "cp936",
|
|
55
|
+
"936": "cp936",
|
|
56
|
+
"cp936": {
|
|
57
|
+
type: "_dbcs",
|
|
58
|
+
table: function() {
|
|
59
|
+
return require_cp936();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"gbk": {
|
|
63
|
+
type: "_dbcs",
|
|
64
|
+
table: function() {
|
|
65
|
+
return require_cp936().concat(require_gbk_added());
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"xgbk": "gbk",
|
|
69
|
+
"isoir58": "gbk",
|
|
70
|
+
"gb18030": {
|
|
71
|
+
type: "_dbcs",
|
|
72
|
+
table: function() {
|
|
73
|
+
return require_cp936().concat(require_gbk_added());
|
|
74
|
+
},
|
|
75
|
+
gb18030: function() {
|
|
76
|
+
return require_gb18030_ranges();
|
|
77
|
+
},
|
|
78
|
+
encodeSkipVals: [128],
|
|
79
|
+
encodeAdd: { "€": 41699 }
|
|
80
|
+
},
|
|
81
|
+
"chinese": "gb18030",
|
|
82
|
+
"windows949": "cp949",
|
|
83
|
+
"ms949": "cp949",
|
|
84
|
+
"949": "cp949",
|
|
85
|
+
"cp949": {
|
|
86
|
+
type: "_dbcs",
|
|
87
|
+
table: function() {
|
|
88
|
+
return require_cp949();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"cseuckr": "cp949",
|
|
92
|
+
"csksc56011987": "cp949",
|
|
93
|
+
"euckr": "cp949",
|
|
94
|
+
"isoir149": "cp949",
|
|
95
|
+
"korean": "cp949",
|
|
96
|
+
"ksc56011987": "cp949",
|
|
97
|
+
"ksc56011989": "cp949",
|
|
98
|
+
"ksc5601": "cp949",
|
|
99
|
+
"windows950": "cp950",
|
|
100
|
+
"ms950": "cp950",
|
|
101
|
+
"950": "cp950",
|
|
102
|
+
"cp950": {
|
|
103
|
+
type: "_dbcs",
|
|
104
|
+
table: function() {
|
|
105
|
+
return require_cp950();
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"big5": "big5hkscs",
|
|
109
|
+
"big5hkscs": {
|
|
110
|
+
type: "_dbcs",
|
|
111
|
+
table: function() {
|
|
112
|
+
return require_cp950().concat(require_big5_added());
|
|
113
|
+
},
|
|
114
|
+
encodeSkipVals: [41676]
|
|
115
|
+
},
|
|
116
|
+
"cnbig5": "big5hkscs",
|
|
117
|
+
"csbig5": "big5hkscs",
|
|
118
|
+
"xxbig5": "big5hkscs"
|
|
119
|
+
};
|
|
120
|
+
}));
|
|
121
|
+
//#endregion
|
|
122
|
+
export default require_dbcs_data();
|
|
123
|
+
export { require_dbcs_data };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_internal } from "./internal.js";
|
|
3
|
+
import { require_utf16 } from "./utf16.js";
|
|
4
|
+
import { require_utf7 } from "./utf7.js";
|
|
5
|
+
import { require_sbcs_codec } from "./sbcs-codec.js";
|
|
6
|
+
import { require_sbcs_data } from "./sbcs-data.js";
|
|
7
|
+
import { require_sbcs_data_generated } from "./sbcs-data-generated.js";
|
|
8
|
+
import { require_dbcs_codec } from "./dbcs-codec.js";
|
|
9
|
+
import { require_dbcs_data } from "./dbcs-data.js";
|
|
10
|
+
//#region ../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings/index.js
|
|
11
|
+
var require_encodings = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
12
|
+
var modules = [
|
|
13
|
+
require_internal(),
|
|
14
|
+
require_utf16(),
|
|
15
|
+
require_utf7(),
|
|
16
|
+
require_sbcs_codec(),
|
|
17
|
+
require_sbcs_data(),
|
|
18
|
+
require_sbcs_data_generated(),
|
|
19
|
+
require_dbcs_codec(),
|
|
20
|
+
require_dbcs_data()
|
|
21
|
+
];
|
|
22
|
+
for (var i = 0; i < modules.length; i++) {
|
|
23
|
+
var module = modules[i];
|
|
24
|
+
for (var enc in module) if (Object.prototype.hasOwnProperty.call(module, enc)) exports[enc] = module[enc];
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
//#endregion
|
|
28
|
+
export default require_encodings();
|
|
29
|
+
export { require_encodings };
|