@netlify/plugin-nextjs 4.40.3-rc.0 → 4.41.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/lib/constants.js +1 -0
- package/lib/helpers/files.js +34 -6
- package/lib/helpers/flags.js +7 -1
- package/lib/helpers/functions.js +3 -0
- package/lib/index.js +15 -1
- package/lib/templates/blobStorage.js +30 -0
- package/lib/templates/getHandler.js +28 -8
- package/lib/templates/handlerUtils.js +46 -26
- package/lib/templates/server.js +26 -3
- package/package.json +3 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js +12 -7
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js +11 -1
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js +4 -1
- package/src/templates/vendor/import_map.json +1 -17
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/error.js +0 -9
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/next-url.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/cookies.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/utils.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/get-hostname.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/i18n/detect-domain-locale.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/i18n/normalize-locale-path.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-locale.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-prefix.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-suffix.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/format-next-pathname-info.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/get-next-pathname-info.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-path-prefix.js +0 -2
- package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-trailing-slash.js +0 -2
package/lib/constants.js
CHANGED
|
@@ -38,6 +38,7 @@ exports.HIDDEN_PATHS = (0, destr_1.default)(process.env.NEXT_KEEP_METADATA_FILES
|
|
|
38
38
|
'/prerender-manifest.js',
|
|
39
39
|
'/required-server-files.json',
|
|
40
40
|
'/static-manifest.json',
|
|
41
|
+
'/blobs-manifest.json',
|
|
41
42
|
];
|
|
42
43
|
exports.ODB_FUNCTION_PATH = `/.netlify/builders/${exports.ODB_FUNCTION_NAME}`;
|
|
43
44
|
exports.HANDLER_FUNCTION_PATH = `/.netlify/functions/${exports.HANDLER_FUNCTION_NAME}`;
|
package/lib/helpers/files.js
CHANGED
|
@@ -13,6 +13,7 @@ const p_limit_1 = __importDefault(require("p-limit"));
|
|
|
13
13
|
const pathe_1 = require("pathe");
|
|
14
14
|
const slash_1 = __importDefault(require("slash"));
|
|
15
15
|
const constants_1 = require("../constants");
|
|
16
|
+
const blobStorage_1 = require("../templates/blobStorage");
|
|
16
17
|
const edge_1 = require("./edge");
|
|
17
18
|
const utils_1 = require("./utils");
|
|
18
19
|
const TEST_ROUTE = /(|\/)\[[^/]+?](\/|\.html|$)/;
|
|
@@ -66,7 +67,8 @@ const getMiddleware = async (publish) => {
|
|
|
66
67
|
};
|
|
67
68
|
exports.getMiddleware = getMiddleware;
|
|
68
69
|
// eslint-disable-next-line max-lines-per-function
|
|
69
|
-
const moveStaticPages = async ({ netlifyConfig, target,
|
|
70
|
+
const moveStaticPages = async ({ netlifyConfig, target, nextConfig, netliBlob, }) => {
|
|
71
|
+
const { i18n, basePath } = nextConfig;
|
|
70
72
|
console.log('Moving static page files to serve from CDN...');
|
|
71
73
|
const outputDir = (0, pathe_1.join)(netlifyConfig.build.publish, target === 'serverless' ? 'serverless' : 'server');
|
|
72
74
|
const buildId = (0, fs_extra_1.readFileSync)((0, pathe_1.join)(netlifyConfig.build.publish, 'BUILD_ID'), 'utf8').trim();
|
|
@@ -93,15 +95,24 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
|
|
|
93
95
|
}
|
|
94
96
|
});
|
|
95
97
|
let fileCount = 0;
|
|
98
|
+
let blobCount = 0;
|
|
96
99
|
const filesManifest = {};
|
|
97
|
-
const
|
|
100
|
+
const blobsManifest = new Set();
|
|
101
|
+
const getSourceAndTargetPath = (file) => {
|
|
102
|
+
const source = (0, pathe_1.join)(outputDir, file);
|
|
98
103
|
// Strip the initial 'app' or 'pages' directory from the output path
|
|
99
104
|
const pathname = file.split('/').slice(1).join('/');
|
|
100
105
|
// .rsc data files go next to the html file
|
|
101
106
|
const isData = file.endsWith('.json');
|
|
102
|
-
const source = (0, pathe_1.join)(outputDir, file);
|
|
103
107
|
const targetFile = isData ? (0, pathe_1.join)(dataDir, pathname) : pathname;
|
|
104
108
|
const targetPath = basePath ? (0, pathe_1.join)(basePath, targetFile) : targetFile;
|
|
109
|
+
return {
|
|
110
|
+
targetPath,
|
|
111
|
+
source,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const moveFile = async (file) => {
|
|
115
|
+
const { source, targetPath } = getSourceAndTargetPath(file);
|
|
105
116
|
fileCount += 1;
|
|
106
117
|
filesManifest[file] = targetPath;
|
|
107
118
|
const dest = (0, pathe_1.join)(netlifyConfig.build.publish, targetPath);
|
|
@@ -112,6 +123,14 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
|
|
|
112
123
|
console.warn('Error moving file', source, error);
|
|
113
124
|
}
|
|
114
125
|
};
|
|
126
|
+
const uploadFileToBlobStorageAndDelete = async (file) => {
|
|
127
|
+
const { source } = getSourceAndTargetPath(file);
|
|
128
|
+
blobsManifest.add(file);
|
|
129
|
+
const content = await (0, fs_extra_1.readFile)(source, 'utf8');
|
|
130
|
+
blobCount += 1;
|
|
131
|
+
await netliBlob.set((0, blobStorage_1.getNormalizedBlobKey)(file), content);
|
|
132
|
+
await (0, fs_extra_1.remove)(source);
|
|
133
|
+
};
|
|
115
134
|
// Move all static files, except nft manifests
|
|
116
135
|
const pages = await (0, globby_1.default)(['{app,pages}/**/*.{html,json,rsc}', '!**/*.js.nft.{html,json}'], {
|
|
117
136
|
cwd: outputDir,
|
|
@@ -128,8 +147,13 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
|
|
|
128
147
|
const filePath = (0, slash_1.default)(rawPath);
|
|
129
148
|
// Remove the initial 'app' or 'pages' directory from the output path
|
|
130
149
|
const pagePath = filePath.split('/').slice(1).join('/');
|
|
131
|
-
// Don't move ISR files, as they're used for the first request
|
|
132
150
|
if (isrFiles.has(pagePath)) {
|
|
151
|
+
if (netliBlob) {
|
|
152
|
+
// if netliblob is enabled, we will move ISR assets to blob store and delete files after that
|
|
153
|
+
// to minimize the number of files needed in lambda
|
|
154
|
+
return limit(uploadFileToBlobStorageAndDelete, filePath);
|
|
155
|
+
}
|
|
156
|
+
// Don't move ISR files, as they're used for the first request
|
|
133
157
|
return;
|
|
134
158
|
}
|
|
135
159
|
if ((0, exports.isDynamicRoute)(pagePath)) {
|
|
@@ -155,7 +179,10 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
|
|
|
155
179
|
return limit(moveFile, filePath);
|
|
156
180
|
});
|
|
157
181
|
await Promise.all(promises);
|
|
158
|
-
console.log(`Moved ${fileCount} files`);
|
|
182
|
+
console.log(`Moved ${fileCount} files to CDN`);
|
|
183
|
+
if (netliBlob) {
|
|
184
|
+
console.log(`Moved ${blobCount} files to Blob Storage`);
|
|
185
|
+
}
|
|
159
186
|
if (matchedPages.size !== 0) {
|
|
160
187
|
console.log((0, chalk_1.yellowBright)((0, outdent_1.outdent) `
|
|
161
188
|
Skipped moving ${matchedPages.size} ${matchedPages.size === 1 ? 'file because it matches' : 'files because they match'} middleware, so cannot be deployed to the CDN and will be served from the origin instead.
|
|
@@ -198,8 +225,9 @@ const moveStaticPages = async ({ netlifyConfig, target, i18n, basePath, }) => {
|
|
|
198
225
|
`);
|
|
199
226
|
}
|
|
200
227
|
}
|
|
201
|
-
// Write the
|
|
228
|
+
// Write the manifests for use in the serverless functions
|
|
202
229
|
await (0, fs_extra_1.writeJson)((0, pathe_1.join)(netlifyConfig.build.publish, 'static-manifest.json'), Object.entries(filesManifest));
|
|
230
|
+
await (0, fs_extra_1.writeJson)((0, pathe_1.join)(netlifyConfig.build.publish, 'blobs-manifest.json'), [...blobsManifest]);
|
|
203
231
|
if (i18n === null || i18n === void 0 ? void 0 : i18n.defaultLocale) {
|
|
204
232
|
const rootPath = basePath ? (0, pathe_1.join)(netlifyConfig.build.publish, basePath) : netlifyConfig.build.publish;
|
|
205
233
|
// Copy the default locale into the root
|
package/lib/helpers/flags.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.bundleBasedOnNftFiles = exports.splitApiRoutes = void 0;
|
|
6
|
+
exports.useBlobsForISRAssets = exports.bundleBasedOnNftFiles = exports.splitApiRoutes = void 0;
|
|
7
7
|
const destr_1 = __importDefault(require("destr"));
|
|
8
8
|
const fs_extra_1 = require("fs-extra");
|
|
9
9
|
const pathe_1 = require("pathe");
|
|
@@ -38,3 +38,9 @@ const bundleBasedOnNftFiles = (featureFlags) => {
|
|
|
38
38
|
return isEnabled;
|
|
39
39
|
};
|
|
40
40
|
exports.bundleBasedOnNftFiles = bundleBasedOnNftFiles;
|
|
41
|
+
const useBlobsForISRAssets = (featureFlags) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const isEnabled = (_b = (_a = (0, destr_1.default)(process.env.NEXT_USE_BLOBS_FOR_ISR)) !== null && _a !== void 0 ? _a : featureFlags['next-runtime-use-blobs-for-isr-assets']) !== null && _b !== void 0 ? _b : false;
|
|
44
|
+
return isEnabled;
|
|
45
|
+
};
|
|
46
|
+
exports.useBlobsForISRAssets = useBlobsForISRAssets;
|
package/lib/helpers/functions.js
CHANGED
|
@@ -82,6 +82,7 @@ const generateFunctions = async ({ INTERNAL_FUNCTIONS_SRC, PUBLISH_DIR, PACKAGE_
|
|
|
82
82
|
await (0, fs_extra_1.copyFile)((0, pathe_1.join)(__dirname, '..', '..', 'lib', 'templates', 'server.js'), (0, pathe_1.join)(functionsDir, functionName, 'server.js'));
|
|
83
83
|
await (0, fs_extra_1.copyFile)((0, pathe_1.join)(__dirname, '..', '..', 'lib', 'templates', 'requireHooks.js'), (0, pathe_1.join)(functionsDir, functionName, 'requireHooks.js'));
|
|
84
84
|
await (0, fs_extra_1.copyFile)((0, pathe_1.join)(__dirname, '..', '..', 'lib', 'templates', 'handlerUtils.js'), (0, pathe_1.join)(functionsDir, functionName, 'handlerUtils.js'));
|
|
85
|
+
await (0, fs_extra_1.copyFile)((0, pathe_1.join)(__dirname, '..', '..', 'lib', 'templates', 'blobStorage.js'), (0, pathe_1.join)(functionsDir, functionName, 'blobStorage.js'));
|
|
85
86
|
await (0, functionsMetaData_1.writeFunctionConfiguration)({ functionName, functionTitle, functionsDir });
|
|
86
87
|
const nfInternalFiles = await (0, tiny_glob_1.default)((0, pathe_1.join)(functionsDir, functionName, '**'));
|
|
87
88
|
const lambda = ssrLambdas.find((l) => l.functionName === functionName);
|
|
@@ -214,6 +215,7 @@ const getCommonDependencies = async (publish) => {
|
|
|
214
215
|
(0, exports.traceNPMPackage)('follow-redirects', publish),
|
|
215
216
|
// using package.json because otherwise, we'd find some /dist/... path
|
|
216
217
|
(0, exports.traceNPMPackage)('@netlify/functions/package.json', publish),
|
|
218
|
+
(0, exports.traceNPMPackage)('@netlify/blobs/package.json', publish),
|
|
217
219
|
(0, exports.traceNPMPackage)('is-promise', publish),
|
|
218
220
|
]);
|
|
219
221
|
return deps.flat(1);
|
|
@@ -259,6 +261,7 @@ const getSSRDependencies = async (publish) => {
|
|
|
259
261
|
}),
|
|
260
262
|
(0, pathe_1.join)(publish, '**', '*.html'),
|
|
261
263
|
(0, pathe_1.join)(publish, 'static-manifest.json'),
|
|
264
|
+
(0, pathe_1.join)(publish, 'blobs-manifest.json'),
|
|
262
265
|
];
|
|
263
266
|
};
|
|
264
267
|
const getSSRLambdas = async (publish) => {
|
package/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const functions_1 = require("./helpers/functions");
|
|
|
19
19
|
const redirects_1 = require("./helpers/redirects");
|
|
20
20
|
const utils_1 = require("./helpers/utils");
|
|
21
21
|
const verification_1 = require("./helpers/verification");
|
|
22
|
+
const blobStorage_1 = require("./templates/blobStorage");
|
|
22
23
|
const plugin = {
|
|
23
24
|
async onPreBuild({ constants, netlifyConfig, utils: { build: { failBuild }, cache, }, }) {
|
|
24
25
|
var _a;
|
|
@@ -108,7 +109,20 @@ const plugin = {
|
|
|
108
109
|
});
|
|
109
110
|
await (0, files_1.movePublicFiles)({ appDir, outdir, publish, basePath });
|
|
110
111
|
if (!(0, destr_1.default)(process.env.SERVE_STATIC_FILES_FROM_ORIGIN)) {
|
|
111
|
-
|
|
112
|
+
const useBlobs = (0, flags_1.useBlobsForISRAssets)(featureFlags);
|
|
113
|
+
const { NETLIFY_API_HOST, NETLIFY_API_TOKEN, SITE_ID } = constants;
|
|
114
|
+
const testBlobStorage = useBlobs
|
|
115
|
+
? new blobStorage_1.Blobs({
|
|
116
|
+
authentication: {
|
|
117
|
+
apiURL: `https://${NETLIFY_API_HOST}`,
|
|
118
|
+
token: NETLIFY_API_TOKEN,
|
|
119
|
+
},
|
|
120
|
+
context: `deploy:${process.env.DEPLOY_ID}`,
|
|
121
|
+
siteID: SITE_ID,
|
|
122
|
+
})
|
|
123
|
+
: undefined;
|
|
124
|
+
const netliBlob = testBlobStorage && (await (0, blobStorage_1.isBlobStorageAvailable)(testBlobStorage)) ? testBlobStorage : undefined;
|
|
125
|
+
await (0, files_1.moveStaticPages)({ target, netlifyConfig, nextConfig: { basePath, i18n }, netliBlob });
|
|
112
126
|
}
|
|
113
127
|
await (0, redirects_1.generateStaticRedirects)({
|
|
114
128
|
netlifyConfig,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Blobs = exports.getNormalizedBlobKey = exports.getBlobInit = exports.setBlobInit = exports.isBlobStorageAvailable = void 0;
|
|
4
|
+
const buffer_1 = require("buffer");
|
|
5
|
+
const blobs_1 = require("@netlify/blobs");
|
|
6
|
+
Object.defineProperty(exports, "Blobs", { enumerable: true, get: function () { return blobs_1.Blobs; } });
|
|
7
|
+
const isBlobStorageAvailable = async (netliBlob) => {
|
|
8
|
+
try {
|
|
9
|
+
// request a key that is not present. If it returns `null` then the blob storage is available
|
|
10
|
+
// if it throws it's not available.
|
|
11
|
+
await netliBlob.get('any-key');
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.isBlobStorageAvailable = isBlobStorageAvailable;
|
|
19
|
+
let blobInit;
|
|
20
|
+
const setBlobInit = (init) => {
|
|
21
|
+
blobInit = init;
|
|
22
|
+
};
|
|
23
|
+
exports.setBlobInit = setBlobInit;
|
|
24
|
+
const getBlobInit = () => blobInit;
|
|
25
|
+
exports.getBlobInit = getBlobInit;
|
|
26
|
+
/**
|
|
27
|
+
* @netlify/blobs ATM has some limitation to keys, so we need to normalize it for now (they will be resolved so we will be able to remove this code)
|
|
28
|
+
*/
|
|
29
|
+
const getNormalizedBlobKey = (key) => buffer_1.Buffer.from(key).toString('base64url');
|
|
30
|
+
exports.getNormalizedBlobKey = getNormalizedBlobKey;
|
|
@@ -4,18 +4,20 @@ exports.getHandler = void 0;
|
|
|
4
4
|
// Aliasing like this means the editor may be able to syntax-highlight the string
|
|
5
5
|
const outdent_1 = require("outdent");
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
7
|
+
const { Buffer } = require('buffer');
|
|
7
8
|
const { promises } = require('fs');
|
|
8
9
|
const { Server } = require('http');
|
|
9
10
|
const path = require('path');
|
|
10
11
|
// eslint-disable-next-line n/prefer-global/url, n/prefer-global/url-search-params
|
|
11
12
|
const { URLSearchParams, URL } = require('url');
|
|
12
13
|
const { Bridge } = require('@vercel/node-bridge/bridge');
|
|
13
|
-
const {
|
|
14
|
+
const { setBlobInit } = require('./blobStorage');
|
|
15
|
+
const { augmentFsModule, getMaxAge, getMultiValueHeaders, getPrefetchResponse, normalizePath } = require('./handlerUtils');
|
|
14
16
|
const { overrideRequireHooks, applyRequireHooks } = require('./requireHooks');
|
|
15
17
|
const { getNetlifyNextServer } = require('./server');
|
|
16
18
|
// We return a function and then call `toString()` on it to serialise it as the launcher function
|
|
17
19
|
// eslint-disable-next-line max-lines-per-function
|
|
18
|
-
const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mode = 'ssr', useHooks, }) => {
|
|
20
|
+
const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], blobsManifest = new Set(), mode = 'ssr', useHooks, }) => {
|
|
19
21
|
var _a;
|
|
20
22
|
// Change working directory into the site root, unless using Nx, which moves the
|
|
21
23
|
// dist directory and handles this itself
|
|
@@ -47,7 +49,7 @@ const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mod
|
|
|
47
49
|
}
|
|
48
50
|
// Set during the request as it needs to get it from the request URL. Defaults to the URL env var
|
|
49
51
|
let base = process.env.URL;
|
|
50
|
-
augmentFsModule({ promises, staticManifest, pageRoot, getBase: () => base });
|
|
52
|
+
augmentFsModule({ promises, staticManifest, blobsManifest, pageRoot, getBase: () => base });
|
|
51
53
|
// We memoize this because it can be shared between requests, but don't instantiate it until
|
|
52
54
|
// the first request because we need the host and port.
|
|
53
55
|
let bridge;
|
|
@@ -82,7 +84,7 @@ const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mod
|
|
|
82
84
|
return bridge;
|
|
83
85
|
};
|
|
84
86
|
return async function handler(event, context) {
|
|
85
|
-
var _a, _b, _c;
|
|
87
|
+
var _a, _b, _c, _d, _e;
|
|
86
88
|
let requestMode = mode;
|
|
87
89
|
const prefetchResponse = getPrefetchResponse(event, mode);
|
|
88
90
|
if (prefetchResponse) {
|
|
@@ -101,6 +103,18 @@ const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mod
|
|
|
101
103
|
// 'x-next-just-first-accept-language' header is escape hatch to be able to hit this code for tests (both automated and manual)
|
|
102
104
|
event.headers['accept-language'] = event.headers['accept-language'].replace(/\s*,.*$/, '');
|
|
103
105
|
}
|
|
106
|
+
if ((_b = (_a = context === null || context === void 0 ? void 0 : context.clientContext) === null || _a === void 0 ? void 0 : _a.custom) === null || _b === void 0 ? void 0 : _b.blobs) {
|
|
107
|
+
const rawData = Buffer.from(context.clientContext.custom.blobs, 'base64');
|
|
108
|
+
const data = JSON.parse(rawData.toString('ascii'));
|
|
109
|
+
setBlobInit({
|
|
110
|
+
authentication: {
|
|
111
|
+
contextURL: data.url,
|
|
112
|
+
token: data.token,
|
|
113
|
+
},
|
|
114
|
+
context: `deploy:${event.headers['x-nf-deploy-id']}`,
|
|
115
|
+
siteID: event.headers['x-nf-site-id'],
|
|
116
|
+
});
|
|
117
|
+
}
|
|
104
118
|
const { headers, ...result } = await getBridge(event, context).launcher(event, context);
|
|
105
119
|
// Convert all headers to multiValueHeaders
|
|
106
120
|
const multiValueHeaders = getMultiValueHeaders(headers);
|
|
@@ -111,12 +125,12 @@ const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mod
|
|
|
111
125
|
};
|
|
112
126
|
console.log('Next server response:', JSON.stringify(response, null, 2));
|
|
113
127
|
}
|
|
114
|
-
if ((
|
|
128
|
+
if ((_d = (_c = multiValueHeaders['set-cookie']) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.includes('__prerender_bypass')) {
|
|
115
129
|
delete multiValueHeaders.etag;
|
|
116
130
|
multiValueHeaders['cache-control'] = ['no-cache'];
|
|
117
131
|
}
|
|
118
132
|
// Sending SWR headers causes undefined behaviour with the Netlify CDN
|
|
119
|
-
const cacheHeader = (
|
|
133
|
+
const cacheHeader = (_e = multiValueHeaders['cache-control']) === null || _e === void 0 ? void 0 : _e[0];
|
|
120
134
|
if (cacheHeader === null || cacheHeader === void 0 ? void 0 : cacheHeader.includes('stale-while-revalidate')) {
|
|
121
135
|
if (requestMode === 'odb') {
|
|
122
136
|
const ttl = getMaxAge(cacheHeader);
|
|
@@ -158,8 +172,10 @@ const getHandler = ({ isODB = false, publishDir = '../../../.next', appDir = '..
|
|
|
158
172
|
|
|
159
173
|
process.env.NODE_ENV = 'production';
|
|
160
174
|
|
|
175
|
+
const { Buffer } = require('buffer')
|
|
161
176
|
const { Server } = require("http");
|
|
162
177
|
const { promises } = require("fs");
|
|
178
|
+
const { setBlobInit } = require('./blobStorage')
|
|
163
179
|
// We copy the file here rather than requiring from the node module
|
|
164
180
|
const { Bridge } = require("./bridge");
|
|
165
181
|
const { augmentFsModule, getMaxAge, getMultiValueHeaders, getPrefetchResponse, normalizePath, nextVersionNum } = require('./handlerUtils')
|
|
@@ -172,10 +188,14 @@ const getHandler = ({ isODB = false, publishDir = '../../../.next', appDir = '..
|
|
|
172
188
|
try {
|
|
173
189
|
staticManifest = require("${publishDir}/static-manifest.json")
|
|
174
190
|
} catch {}
|
|
191
|
+
let blobsManifest
|
|
192
|
+
try {
|
|
193
|
+
blobsManifest = new Set(require("${publishDir}/blobs-manifest.json"))
|
|
194
|
+
} catch {}
|
|
175
195
|
const path = require("path");
|
|
176
196
|
const pageRoot = path.resolve(path.join(__dirname, "${publishDir}", "server"));
|
|
177
197
|
exports.handler = ${isODB
|
|
178
|
-
? `builder((${makeHandler.toString()})({ conf: config, app: "${appDir}", pageRoot, NextServer, staticManifest, mode: 'odb', useHooks: ${useHooks}}));`
|
|
179
|
-
: `(${makeHandler.toString()})({ conf: config, app: "${appDir}", pageRoot, NextServer, staticManifest, mode: 'ssr', useHooks: ${useHooks}});`}
|
|
198
|
+
? `builder((${makeHandler.toString()})({ conf: config, app: "${appDir}", pageRoot, NextServer, staticManifest, blobsManifest, mode: 'odb', useHooks: ${useHooks}}));`
|
|
199
|
+
: `(${makeHandler.toString()})({ conf: config, app: "${appDir}", pageRoot, NextServer, staticManifest, blobsManifest, mode: 'ssr', useHooks: ${useHooks}});`}
|
|
180
200
|
`;
|
|
181
201
|
exports.getHandler = getHandler;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getMatchedRoute = exports.localizeDataRoute = exports.localizeRoute = exports.unlocalizeRoute = exports.joinPaths = exports.normalizeRoute = exports.netlifyApiFetch = exports.normalizePath = exports.getPrefetchResponse = exports.augmentFsModule = exports.getMultiValueHeaders = exports.getMaxAge = exports.
|
|
6
|
+
exports.getMatchedRoute = exports.localizeDataRoute = exports.localizeRoute = exports.unlocalizeRoute = exports.joinPaths = exports.normalizeRoute = exports.netlifyApiFetch = exports.normalizePath = exports.getPrefetchResponse = exports.augmentFsModule = exports.getMultiValueHeaders = exports.getMaxAge = exports.downloadFileFromCDN = void 0;
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const os_1 = require("os");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -11,12 +11,13 @@ const stream_1 = require("stream");
|
|
|
11
11
|
const util_1 = require("util");
|
|
12
12
|
const follow_redirects_1 = require("follow-redirects");
|
|
13
13
|
const streamPipeline = (0, util_1.promisify)(stream_1.pipeline);
|
|
14
|
+
const writeFilePromisified = (0, util_1.promisify)(fs_1.writeFile);
|
|
14
15
|
/**
|
|
15
16
|
* Downloads a file from the CDN to the local aliased filesystem. This is a fallback, because in most cases we'd expect
|
|
16
17
|
* files required at runtime to not be sent to the CDN.
|
|
17
18
|
*/
|
|
18
|
-
const
|
|
19
|
-
console.log(`Downloading ${url} to ${destination}`);
|
|
19
|
+
const downloadFileFromCDN = async (url, destination) => {
|
|
20
|
+
console.log(`Downloading ${url} from CDN to ${destination}`);
|
|
20
21
|
const httpx = url.startsWith('https') ? follow_redirects_1.https : follow_redirects_1.http;
|
|
21
22
|
await new Promise((resolve, reject) => {
|
|
22
23
|
const req = httpx.get(url, { timeout: 10000, maxRedirects: 1 }, (response) => {
|
|
@@ -38,7 +39,17 @@ const downloadFile = async (url, destination) => {
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
};
|
|
41
|
-
exports.
|
|
42
|
+
exports.downloadFileFromCDN = downloadFileFromCDN;
|
|
43
|
+
const downloadFileFromBlobs = async (filePath, destination) => {
|
|
44
|
+
console.log(`Downloading ${filePath} from Blobs Storage to ${destination}`);
|
|
45
|
+
const { Blobs, getNormalizedBlobKey, getBlobInit } =
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
47
|
+
require('./blobStorage');
|
|
48
|
+
const netliBlob = new Blobs(getBlobInit());
|
|
49
|
+
const blobKey = getNormalizedBlobKey(filePath);
|
|
50
|
+
const fileContent = await netliBlob.get(blobKey, { type: 'text' });
|
|
51
|
+
await writeFilePromisified(destination, fileContent);
|
|
52
|
+
};
|
|
42
53
|
/**
|
|
43
54
|
* Parse maxage from a cache-control header
|
|
44
55
|
*/
|
|
@@ -75,7 +86,7 @@ exports.getMultiValueHeaders = getMultiValueHeaders;
|
|
|
75
86
|
/**
|
|
76
87
|
* Monkey-patch the fs module to download missing files from the CDN
|
|
77
88
|
*/
|
|
78
|
-
const augmentFsModule = ({ promises, staticManifest, pageRoot, getBase, }) => {
|
|
89
|
+
const augmentFsModule = ({ promises, staticManifest, blobsManifest, pageRoot, getBase, }) => {
|
|
79
90
|
// Only do this if we have some static files moved to the CDN
|
|
80
91
|
if (staticManifest.length === 0) {
|
|
81
92
|
return;
|
|
@@ -91,6 +102,9 @@ const augmentFsModule = ({ promises, staticManifest, pageRoot, getBase, }) => {
|
|
|
91
102
|
// Grab the real fs.promises.readFile...
|
|
92
103
|
const readfileOrig = promises.readFile;
|
|
93
104
|
const statsOrig = promises.stat;
|
|
105
|
+
const { getBlobInit } =
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
107
|
+
require('./blobStorage');
|
|
94
108
|
// ...then monkey-patch it to see if it's requesting a CDN file
|
|
95
109
|
promises.readFile = (async (file, options) => {
|
|
96
110
|
const baseUrl = getBase();
|
|
@@ -98,30 +112,36 @@ const augmentFsModule = ({ promises, staticManifest, pageRoot, getBase, }) => {
|
|
|
98
112
|
if (file.startsWith(pageRoot)) {
|
|
99
113
|
// We only want the part after `.next/server/`
|
|
100
114
|
const filePath = file.slice(pageRoot.length + 1);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
await promises.mkdir(path_1.default.dirname(cacheFile), { recursive: true });
|
|
113
|
-
try {
|
|
114
|
-
// Append the path to our host and we can load it like a regular page
|
|
115
|
-
const downloadPromise = (0, exports.downloadFile)(url, cacheFile);
|
|
116
|
-
downloadPromises.set(url, downloadPromise);
|
|
117
|
-
await downloadPromise;
|
|
115
|
+
if (!(0, fs_1.existsSync)(file)) {
|
|
116
|
+
// Is it in the CDN or Blobs Storage and not local?
|
|
117
|
+
const isStatic = staticFiles.has(filePath);
|
|
118
|
+
const isBlob = getBlobInit() ? blobsManifest.has(filePath) : false;
|
|
119
|
+
if (isStatic || isBlob) {
|
|
120
|
+
// This name is safe to use, because it's one that was already created by Next
|
|
121
|
+
const cacheFile = path_1.default.join(cacheDir, filePath);
|
|
122
|
+
const url = `${baseUrl}/${staticFiles.get(filePath)}`;
|
|
123
|
+
// If it's already downloading we can wait for it to finish
|
|
124
|
+
if (downloadPromises.has(url)) {
|
|
125
|
+
await downloadPromises.get(url);
|
|
118
126
|
}
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
// Have we already cached it? We download every time if running locally to avoid staleness
|
|
128
|
+
if ((!(0, fs_1.existsSync)(cacheFile) || process.env.NETLIFY_DEV) && baseUrl) {
|
|
129
|
+
await promises.mkdir(path_1.default.dirname(cacheFile), { recursive: true });
|
|
130
|
+
try {
|
|
131
|
+
// Append the path to our host and we can load it like a regular page
|
|
132
|
+
const downloadPromise = isStatic
|
|
133
|
+
? (0, exports.downloadFileFromCDN)(url, cacheFile)
|
|
134
|
+
: downloadFileFromBlobs(filePath, cacheFile);
|
|
135
|
+
downloadPromises.set(url, downloadPromise);
|
|
136
|
+
await downloadPromise;
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
downloadPromises.delete(url);
|
|
140
|
+
}
|
|
121
141
|
}
|
|
142
|
+
// Return the cache file
|
|
143
|
+
return readfileOrig(cacheFile, options);
|
|
122
144
|
}
|
|
123
|
-
// Return the cache file
|
|
124
|
-
return readfileOrig(cacheFile, options);
|
|
125
145
|
}
|
|
126
146
|
}
|
|
127
147
|
return readfileOrig(file, options);
|
package/lib/templates/server.js
CHANGED
|
@@ -22,6 +22,25 @@ const getNetlifyNextServer = (NextServer) => {
|
|
|
22
22
|
dynamicRoutes: { ...manifest.dynamicRoutes },
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
getPrerenderManifest() {
|
|
26
|
+
const manifest = super.getPrerenderManifest();
|
|
27
|
+
if (typeof (manifest === null || manifest === void 0 ? void 0 : manifest.dynamicRoutes) === 'object') {
|
|
28
|
+
for (const route of Object.values(manifest.dynamicRoutes)) {
|
|
29
|
+
// 'fallback' property is:
|
|
30
|
+
// - a string when fallback: true is used
|
|
31
|
+
// - `null` when fallback: blocking is used
|
|
32
|
+
// - `false` when fallback: false is used
|
|
33
|
+
// `fallback: true` is not working correctly with ODBs
|
|
34
|
+
// as we will cache fallback html forever, so
|
|
35
|
+
// we are treating those as `fallback: blocking`
|
|
36
|
+
// by editing the manifest
|
|
37
|
+
if (typeof route.fallback === 'string') {
|
|
38
|
+
route.fallback = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return manifest;
|
|
43
|
+
}
|
|
25
44
|
getRequestHandler() {
|
|
26
45
|
const handler = super.getRequestHandler();
|
|
27
46
|
return async (req, res, parsedUrl) => {
|
|
@@ -51,9 +70,13 @@ const getNetlifyNextServer = (NextServer) => {
|
|
|
51
70
|
// but ignore in preview mode (prerender_bypass is set to true in preview mode)
|
|
52
71
|
// because otherwise revalidate will override preview mode
|
|
53
72
|
if (!((_b = headers.cookie) === null || _b === void 0 ? void 0 : _b.includes('__prerender_bypass'))) {
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
73
|
+
const isFirstODBRequest = headers['x-nf-builder-cache'] === 'miss';
|
|
74
|
+
// first ODB request should NOT be revalidated and instead it should try to serve cached version
|
|
75
|
+
if (!isFirstODBRequest) {
|
|
76
|
+
// this header controls whether Next.js will revalidate the page
|
|
77
|
+
// and needs to be set to the preview mode id to enable it
|
|
78
|
+
headers['x-prerender-revalidate'] = this.renderOpts.previewProps.previewModeId;
|
|
79
|
+
}
|
|
57
80
|
}
|
|
58
81
|
return handler(req, res, parsedUrl);
|
|
59
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.41.0",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"manifest.yml"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@netlify/blobs": "^2.2.0",
|
|
15
16
|
"@netlify/esbuild": "0.14.39",
|
|
16
17
|
"@netlify/functions": "^1.6.0",
|
|
17
18
|
"@netlify/ipx": "^1.4.5",
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@delucis/if-env": "^1.1.2",
|
|
41
|
-
"@netlify/build": "^29.
|
|
42
|
+
"@netlify/build": "^29.23.1",
|
|
42
43
|
"@types/fs-extra": "^9.0.13",
|
|
43
44
|
"@types/jest": "^27.4.1",
|
|
44
45
|
"@types/merge-stream": "^1.1.2",
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/* esm.sh - esbuild bundle(next@12.2.5/dist/compiled/cookie) deno production */
|
|
2
|
-
var
|
|
3
|
-
/*!
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var A=Object.create;var S=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var z=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),D=(i,e)=>{for(var a in e)S(i,a,{get:e[a],enumerable:!0})},y=(i,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of N(e))!q.call(i,s)&&s!==a&&S(i,s,{get:()=>e[s],enumerable:!(l=U(e,s))||l.enumerable});return i},u=(i,e,a)=>(y(i,e,"default"),a&&y(a,e,"default")),g=(i,e,a)=>(a=i!=null?A(O(i)):{},y(e||!i||!i.__esModule?S(a,"default",{value:i,enumerable:!0}):a,i));var _=z((F,T)=>{(()=>{"use strict";typeof __nccwpck_require__<"u"&&(__nccwpck_require__.ab="/_virtual/esm.sh/v91/next@12.2.5/deno/dist/compiled/");var i={};(()=>{var e=i;e.parse=b,e.serialize=k;var a=decodeURIComponent,l=encodeURIComponent,s=/; */,w=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(n,d){if(typeof n!="string")throw new TypeError("argument str must be a string");for(var f={},r=d||{},m=n.split(s),c=r.decode||a,t=0;t<m.length;t++){var o=m[t],v=o.indexOf("=");if(!(v<0)){var x=o.substr(0,v).trim(),h=o.substr(++v,o.length).trim();h[0]=='"'&&(h=h.slice(1,-1)),f[x]==null&&(f[x]=C(h,c))}}return f}function k(n,d,f){var r=f||{},m=r.encode||l;if(typeof m!="function")throw new TypeError("option encode is invalid");if(!w.test(n))throw new TypeError("argument name is invalid");var c=m(d);if(c&&!w.test(c))throw new TypeError("argument val is invalid");var t=n+"="+c;if(r.maxAge!=null){var o=r.maxAge-0;if(isNaN(o)||!isFinite(o))throw new TypeError("option maxAge is invalid");t+="; Max-Age="+Math.floor(o)}if(r.domain){if(!w.test(r.domain))throw new TypeError("option domain is invalid");t+="; Domain="+r.domain}if(r.path){if(!w.test(r.path))throw new TypeError("option path is invalid");t+="; Path="+r.path}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");t+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(t+="; HttpOnly"),r.secure&&(t+="; Secure"),r.sameSite){var v=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(v){case!0:t+="; SameSite=Strict";break;case"lax":t+="; SameSite=Lax";break;case"strict":t+="; SameSite=Strict";break;case"none":t+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return t}function C(n,d){try{return d(n)}catch{return n}}})(),T.exports=i})()});var p={};D(p,{default:()=>M});var I=g(_());u(p,g(_()));var{default:E,...L}=I,M=E!==void 0?E:L;export{M as default};
|
|
3
|
+
/*! Bundled license information:
|
|
4
|
+
|
|
5
|
+
next/dist/compiled/cookie/index.js:
|
|
6
|
+
(*!
|
|
7
|
+
* cookie
|
|
8
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
9
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
10
|
+
* MIT Licensed
|
|
11
|
+
*)
|
|
12
|
+
*/
|
|
13
|
+
//# sourceMappingURL=cookie.js.map
|
package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/request.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/spec-extension/request) deno production */
|
|
2
|
-
import
|
|
2
|
+
import * as __0$ from "/v91/next@12.2.5/deno/dist/compiled/cookie.js";
|
|
3
|
+
var require=n=>{const e=m=>typeof m.default<"u"?m.default:m,c=m=>Object.assign({},m);switch(n){case"next/dist/compiled/cookie":return e(__0$);default:throw new Error("module \""+n+"\" not found");}};
|
|
4
|
+
var xe=Object.create;var w=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var ye=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty;var we=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var l=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),je=(t,e)=>{for(var r in e)w(t,r,{get:e[r],enumerable:!0})},L=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of be(e))!Le.call(t,i)&&i!==r&&w(t,i,{get:()=>e[i],enumerable:!(s=_e(e,i))||s.enumerable});return t},c=(t,e,r)=>(L(t,e,"default"),r&&L(r,e,"default")),G=(t,e,r)=>(r=t!=null?xe(ye(t)):{},L(e||!t||!t.__esModule?w(r,"default",{value:t,enumerable:!0}):r,t));var Q=l(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.detectDomainLocale=qe;function qe(t,e,r){let s;if(t){r&&(r=r.toLowerCase());for(let o of t){var i,n;let u=(i=o.domain)==null?void 0:i.split(":")[0].toLowerCase();if(e===u||r===o.defaultLocale.toLowerCase()||(n=o.locales)!=null&&n.some(h=>h.toLowerCase()===r)){s=o;break}}}return s}});var V=l(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.removeTrailingSlash=Ce;function Ce(t){return t.replace(/\/$/,"")||"/"}});var v=l(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.parsePath=Ie;function Ie(t){let e=t.indexOf("#"),r=t.indexOf("?"),s=r>-1&&(e<0||r<e);return s||e>-1?{pathname:t.substring(0,s?r:e),query:s?t.substring(r,e>-1?e:void 0):"",hash:e>-1?t.slice(e):""}:{pathname:t,query:"",hash:""}}});var S=l(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.addPathPrefix=Ne;var Se=v();function Ne(t,e){if(!t.startsWith("/")||!e)return t;let{pathname:r,query:s,hash:i}=Se.parsePath(t);return`${e}${r}${s}${i}`}});var X=l(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.addPathSuffix=$e;var Re=v();function $e(t,e){if(!t.startsWith("/")||!e)return t;let{pathname:r,query:s,hash:i}=Re.parsePath(t);return`${r}${e}${s}${i}`}});var x=l(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.pathHasPrefix=ke;var Oe=v();function ke(t,e){if(typeof t!="string")return!1;let{pathname:r}=Oe.parsePath(t);return r===e||r.startsWith(e+"/")}});var K=l($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.addLocale=He;var Ae=S(),B=x();function He(t,e,r,s){return e&&e!==r&&(s||!B.pathHasPrefix(t.toLowerCase(),`/${e.toLowerCase()}`)&&!B.pathHasPrefix(t.toLowerCase(),"/api"))?Ae.addPathPrefix(t,`/${e}`):t}});var ee=l(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.formatNextPathnameInfo=Ee;var Ue=V(),Y=S(),Z=X(),Me=K();function Ee(t){let e=Me.addLocale(t.pathname,t.locale,t.buildId?void 0:t.defaultLocale,t.ignorePrefix);return t.buildId&&(e=Z.addPathSuffix(Y.addPathPrefix(e,`/_next/data/${t.buildId}`),t.pathname==="/"?"index.json":".json")),e=Y.addPathPrefix(e,t.basePath),t.trailingSlash?!t.buildId&&!e.endsWith("/")?Z.addPathSuffix(e,"/"):e:Ue.removeTrailingSlash(e)}});var te=l(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getHostname=Te;function Te(t,e){var r;return(r=!Array.isArray(e?.host)&&e?.host||t.hostname)==null?void 0:r.split(":")[0].toLowerCase()}});var re=l(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.normalizeLocalePath=ze;function ze(t,e){let r,s=t.split("/");return(e||[]).some(i=>s[1]&&s[1].toLowerCase()===i.toLowerCase()?(r=i,s.splice(1,1),t=s.join("/")||"/",!0):!1),{pathname:t,detectedLocale:r}}});var se=l(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.removePathPrefix=De;var We=x();function De(t,e){if(We.pathHasPrefix(t,e)){let r=t.slice(e.length);return r.startsWith("/")?r:`/${r}`}return t}});var ae=l(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getNextPathnameInfo=Qe;var Je=re(),Fe=se(),Ge=x();function Qe(t,e){var r;let{basePath:s,i18n:i,trailingSlash:n}=(r=e.nextConfig)!=null?r:{},o={pathname:t,trailingSlash:t!=="/"?t.endsWith("/"):n};if(s&&Ge.pathHasPrefix(o.pathname,s)&&(o.pathname=Fe.removePathPrefix(o.pathname,s),o.basePath=s),e.parseData===!0&&o.pathname.startsWith("/_next/data/")&&o.pathname.endsWith(".json")){let u=o.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),h=u[0];o.pathname=u[1]!=="index"?`/${u.slice(1).join("/")}`:"/",o.buildId=h}if(i){let u=Je.normalizeLocalePath(o.pathname,i.locales);o.locale=u?.detectedLocale,o.pathname=u?.pathname||o.pathname}return o}});var ne=l(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});var Ve=Q(),Xe=ee(),Be=te(),Ke=ae(),a=Symbol("NextURLInternal"),M=class t{constructor(e,r,s){let i,n;typeof r=="object"&&"pathname"in r||typeof r=="string"?(i=r,n=s||{}):n=s||r||{},this[a]={url:oe(e,i??n.base),options:n,basePath:""},this.analyzeUrl()}analyzeUrl(){var e,r,s,i,n;let o=Ke.getNextPathnameInfo(this[a].url.pathname,{nextConfig:this[a].options.nextConfig,parseData:!0});this[a].domainLocale=Ve.detectDomainLocale((e=this[a].options.nextConfig)==null||(r=e.i18n)==null?void 0:r.domains,Be.getHostname(this[a].url,this[a].options.headers));let u=((s=this[a].domainLocale)==null?void 0:s.defaultLocale)||((i=this[a].options.nextConfig)==null||(n=i.i18n)==null?void 0:n.defaultLocale);this[a].url.pathname=o.pathname,this[a].defaultLocale=u;var h;this[a].basePath=(h=o.basePath)!=null?h:"",this[a].buildId=o.buildId;var P;this[a].locale=(P=o.locale)!=null?P:u,this[a].trailingSlash=o.trailingSlash}formatPathname(){return Xe.formatNextPathnameInfo({basePath:this[a].basePath,buildId:this[a].buildId,defaultLocale:this[a].options.forceLocale?void 0:this[a].defaultLocale,locale:this[a].locale,pathname:this[a].url.pathname,trailingSlash:this[a].trailingSlash})}get buildId(){return this[a].buildId}set buildId(e){this[a].buildId=e}get locale(){var e;return(e=this[a].locale)!=null?e:""}set locale(e){var r,s;if(!this[a].locale||!(!((r=this[a].options.nextConfig)==null||(s=r.i18n)==null)&&s.locales.includes(e)))throw new TypeError(`The NextURL configuration includes no locale "${e}"`);this[a].locale=e}get defaultLocale(){return this[a].defaultLocale}get domainLocale(){return this[a].domainLocale}get searchParams(){return this[a].url.searchParams}get host(){return this[a].url.host}set host(e){this[a].url.host=e}get hostname(){return this[a].url.hostname}set hostname(e){this[a].url.hostname=e}get port(){return this[a].url.port}set port(e){this[a].url.port=e}get protocol(){return this[a].url.protocol}set protocol(e){this[a].url.protocol=e}get href(){let e=this.formatPathname();return`${this.protocol}//${this.host}${e}${this[a].url.search}`}set href(e){this[a].url=oe(e),this.analyzeUrl()}get origin(){return this[a].url.origin}get pathname(){return this[a].url.pathname}set pathname(e){this[a].url.pathname=e}get hash(){return this[a].url.hash}set hash(e){this[a].url.hash=e}get search(){return this[a].url.search}set search(e){this[a].url.search=e}get password(){return this[a].url.password}set password(e){this[a].url.password=e}get username(){return this[a].url.username}set username(e){this[a].url.username=e}get basePath(){return this[a].basePath}set basePath(e){this[a].basePath=e.startsWith("/")?e:`/${e}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new t(String(this),this[a].options)}};E.NextURL=M;var ie=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1|localhost)/;function oe(t,e){return new URL(String(t).replace(ie,"localhost"),e&&String(e).replace(ie,"localhost"))}});var le=l(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.fromNodeHeaders=Ye;p.toNodeHeaders=Ze;p.splitCookiesString=ue;p.validateURL=et;function Ye(t){let e=new Headers;for(let[r,s]of Object.entries(t)){let i=Array.isArray(s)?s:[s];for(let n of i)n!==void 0&&e.append(r,n)}return e}function Ze(t){let e={};if(t)for(let[r,s]of t.entries())e[r]=s,r.toLowerCase()==="set-cookie"&&(e[r]=ue(s));return e}function ue(t){var e=[],r=0,s,i,n,o,u;function h(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function P(){return i=t.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<t.length;){for(s=r,u=!1;h();)if(i=t.charAt(r),i===","){for(n=r,r+=1,h(),o=r;r<t.length&&P();)r+=1;r<t.length&&t.charAt(r)==="="?(u=!0,r=o,e.push(t.substring(s,n)),s=r):r=n+1}else r+=1;(!u||r>=t.length)&&e.push(t.substring(s,t.length))}return e}function et(t){try{return String(new URL(String(t)))}catch(e){throw new Error("URLs is malformed. Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls",{cause:e})}}});var he=l(m=>{"use strict";Object.defineProperty(m,"__esModule",{value:!0});var T=class extends Error{constructor({page:e}){super(`The middleware "${e}" accepts an async API directly with the form:
|
|
5
|
+
|
|
6
|
+
export function middleware(request, event) {
|
|
7
|
+
return NextResponse.redirect('/new-location')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
|
11
|
+
`)}};m.PageSignatureError=T;var z=class extends Error{constructor(){super("The request.page has been deprecated in favour of `URLPattern`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n ")}};m.RemovedPageError=z;var W=class extends Error{constructor(){super("The request.ua has been removed in favour of `userAgent` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n ")}};m.RemovedUAError=W});var pe=l(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});var _=tt(we("next/dist/compiled/cookie"));function tt(t){return t&&t.__esModule?t:{default:t}}var rt=t=>(t=Object.assign({},t),t.maxAge&&(t.expires=new Date(Date.now()+t.maxAge*1e3)),t.path==null&&(t.path="/"),t),st=t=>typeof t=="object"?`j:${JSON.stringify(t)}`:String(t),de=(t,e={})=>_.default.serialize(t,"",{expires:new Date(0),path:"/",...e}),ce=t=>{let e=t.headers.get("set-cookie");return e!=null?e.split(", "):[]},fe=t=>t.join(", "),b=class extends Map{constructor(e){let r=typeof e=="string"?_.default.parse(e):{};super(Object.entries(r))}set(e,r,s={}){return super.set(e,_.default.serialize(e,st(r),rt(s)))}[Symbol.for("edge-runtime.inspect.custom")](){return Object.fromEntries(this.entries())}};y.Cookies=b;var D=class extends b{constructor(e){super(e.headers.get("cookie")),this.response=e}get=(...e)=>this.getWithOptions(...e).value;getWithOptions=(...e)=>{let r=super.get(...e);if(typeof r!="string")return{value:r,options:{}};let{[e[0]]:s,...i}=_.default.parse(r);return{value:s,options:i}};set=(...e)=>{let r=super.has(e[0]);super.set(...e);let s=super.get(e[0]);if(typeof s!="string")throw new Error(`Invariant: failed to generate cookie for ${JSON.stringify(e)}`);if(r){let i=fe(ce(this.response).filter(n=>!n.startsWith(`${e[0]}=`)));i?this.response.headers.set("set-cookie",[s,i].join(", ")):this.response.headers.set("set-cookie",s)}else this.response.headers.append("set-cookie",s);return this};delete=(e,r={})=>{let s=super.delete(e);if(s){let i=fe(ce(this.response).filter(o=>!o.startsWith(`${e}=`))),n=de(e,r);this.response.headers.set("set-cookie",[n,i].join(", "))}return s};clear=(e={})=>{let r=Array.from(super.keys()).map(s=>de(s,e)).join(", ");return r&&this.response.headers.set("set-cookie",r),super.clear()}};y.NextCookies=D});var F=l(g=>{"use strict";Object.defineProperty(g,"__esModule",{value:!0});g.INTERNALS=void 0;var at=ne(),me=le(),ge=he(),it=pe(),f=Symbol("internal request");g.INTERNALS=f;var J=class extends Request{constructor(e,r={}){let s=typeof e!="string"&&"url"in e?e.url:String(e);me.validateURL(s),super(s,r),this[f]={cookies:new it.NextCookies(this),geo:r.geo||{},ip:r.ip,url:new at.NextURL(s,{headers:me.toNodeHeaders(this.headers),nextConfig:r.nextConfig})}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,geo:this.geo,ip:this.ip,nextUrl:this.nextUrl,url:this.url,bodyUsed:this.bodyUsed,cache:this.cache,credentials:this.credentials,destination:this.destination,headers:Object.fromEntries(this.headers),integrity:this.integrity,keepalive:this.keepalive,method:this.method,mode:this.mode,redirect:this.redirect,referrer:this.referrer,referrerPolicy:this.referrerPolicy,signal:this.signal}}get cookies(){return this[f].cookies}get geo(){return this[f].geo}get ip(){return this[f].ip}get nextUrl(){return this[f].url}get page(){throw new ge.RemovedPageError}get ua(){throw new ge.RemovedUAError}get url(){return this[f].url.toString()}};g.NextRequest=J});var d={};je(d,{INTERNALS:()=>nt,NextRequest:()=>ut,__esModule:()=>ot,default:()=>ht});var ve=G(F());c(d,G(F()));var{__esModule:ot,INTERNALS:nt,NextRequest:ut}=ve,{default:Pe,...lt}=ve,ht=Pe!==void 0?Pe:lt;export{nt as INTERNALS,ut as NextRequest,ot as __esModule,ht as default};
|
|
12
|
+
//# sourceMappingURL=request.js.map
|
package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/response.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/spec-extension/response) deno production */
|
|
2
|
-
import
|
|
2
|
+
import * as __0$ from "/v91/next@12.2.5/deno/dist/compiled/cookie.js";
|
|
3
|
+
var require=n=>{const e=m=>typeof m.default<"u"?m.default:m,c=m=>Object.assign({},m);switch(n){case"next/dist/compiled/cookie":return e(__0$);default:throw new Error("module \""+n+"\" not found");}};
|
|
4
|
+
var fe=Object.create;var b=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var Pe=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xe=(t,e)=>{for(var r in e)b(t,r,{get:e[r],enumerable:!0})},_=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of me(e))!ve.call(t,o)&&o!==r&&b(t,o,{get:()=>e[o],enumerable:!(s=pe(e,o))||s.enumerable});return t},c=(t,e,r)=>(_(t,e,"default"),r&&_(r,e,"default")),D=(t,e,r)=>(r=t!=null?fe(Pe(t)):{},_(e||!t||!t.__esModule?b(r,"default",{value:t,enumerable:!0}):r,t));var T=u(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.detectDomainLocale=_e;function _e(t,e,r){let s;if(t){r&&(r=r.toLowerCase());for(let n of t){var o,i;let l=(o=n.domain)==null?void 0:o.split(":")[0].toLowerCase();if(e===l||r===n.defaultLocale.toLowerCase()||(i=n.locales)!=null&&i.some(h=>h.toLowerCase()===r)){s=n;break}}}return s}});var J=u(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.removeTrailingSlash=be;function be(t){return t.replace(/\/$/,"")||"/"}});var m=u(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.parsePath=ye;function ye(t){let e=t.indexOf("#"),r=t.indexOf("?"),s=r>-1&&(e<0||r<e);return s||e>-1?{pathname:t.substring(0,s?r:e),query:s?t.substring(r,e>-1?e:void 0):"",hash:e>-1?t.slice(e):""}:{pathname:t,query:"",hash:""}}});var C=u(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.addPathPrefix=Le;var we=m();function Le(t,e){if(!t.startsWith("/")||!e)return t;let{pathname:r,query:s,hash:o}=we.parsePath(t);return`${e}${r}${s}${o}`}});var F=u(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.addPathSuffix=Ce;var je=m();function Ce(t,e){if(!t.startsWith("/")||!e)return t;let{pathname:r,query:s,hash:o}=je.parsePath(t);return`${r}${e}${s}${o}`}});var P=u(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.pathHasPrefix=Se;var Ie=m();function Se(t,e){if(typeof t!="string")return!1;let{pathname:r}=Ie.parsePath(t);return r===e||r.startsWith(e+"/")}});var Q=u(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.addLocale=He;var qe=C(),G=P();function He(t,e,r,s){return e&&e!==r&&(s||!G.pathHasPrefix(t.toLowerCase(),`/${e.toLowerCase()}`)&&!G.pathHasPrefix(t.toLowerCase(),"/api"))?qe.addPathPrefix(t,`/${e}`):t}});var B=u(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.formatNextPathnameInfo=Ne;var Oe=J(),V=C(),X=F(),$e=Q();function Ne(t){let e=$e.addLocale(t.pathname,t.locale,t.buildId?void 0:t.defaultLocale,t.ignorePrefix);return t.buildId&&(e=X.addPathSuffix(V.addPathPrefix(e,`/_next/data/${t.buildId}`),t.pathname==="/"?"index.json":".json")),e=V.addPathPrefix(e,t.basePath),t.trailingSlash?!t.buildId&&!e.endsWith("/")?X.addPathSuffix(e,"/"):e:Oe.removeTrailingSlash(e)}});var K=u(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.getHostname=ke;function ke(t,e){var r;return(r=!Array.isArray(e?.host)&&e?.host||t.hostname)==null?void 0:r.split(":")[0].toLowerCase()}});var Y=u($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.normalizeLocalePath=Re;function Re(t,e){let r,s=t.split("/");return(e||[]).some(o=>s[1]&&s[1].toLowerCase()===o.toLowerCase()?(r=o,s.splice(1,1),t=s.join("/")||"/",!0):!1),{pathname:t,detectedLocale:r}}});var Z=u(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.removePathPrefix=Ue;var Me=P();function Ue(t,e){if(Me.pathHasPrefix(t,e)){let r=t.slice(e.length);return r.startsWith("/")?r:`/${r}`}return t}});var ee=u(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.getNextPathnameInfo=Ee;var Ae=Y(),ze=Z(),We=P();function Ee(t,e){var r;let{basePath:s,i18n:o,trailingSlash:i}=(r=e.nextConfig)!=null?r:{},n={pathname:t,trailingSlash:t!=="/"?t.endsWith("/"):i};if(s&&We.pathHasPrefix(n.pathname,s)&&(n.pathname=ze.removePathPrefix(n.pathname,s),n.basePath=s),e.parseData===!0&&n.pathname.startsWith("/_next/data/")&&n.pathname.endsWith(".json")){let l=n.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),h=l[0];n.pathname=l[1]!=="index"?`/${l.slice(1).join("/")}`:"/",n.buildId=h}if(o){let l=Ae.normalizeLocalePath(n.pathname,o.locales);n.locale=l?.detectedLocale,n.pathname=l?.pathname||n.pathname}return n}});var se=u(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});var De=T(),Te=B(),Je=K(),Fe=ee(),a=Symbol("NextURLInternal"),R=class t{constructor(e,r,s){let o,i;typeof r=="object"&&"pathname"in r||typeof r=="string"?(o=r,i=s||{}):i=s||r||{},this[a]={url:re(e,o??i.base),options:i,basePath:""},this.analyzeUrl()}analyzeUrl(){var e,r,s,o,i;let n=Fe.getNextPathnameInfo(this[a].url.pathname,{nextConfig:this[a].options.nextConfig,parseData:!0});this[a].domainLocale=De.detectDomainLocale((e=this[a].options.nextConfig)==null||(r=e.i18n)==null?void 0:r.domains,Je.getHostname(this[a].url,this[a].options.headers));let l=((s=this[a].domainLocale)==null?void 0:s.defaultLocale)||((o=this[a].options.nextConfig)==null||(i=o.i18n)==null?void 0:i.defaultLocale);this[a].url.pathname=n.pathname,this[a].defaultLocale=l;var h;this[a].basePath=(h=n.basePath)!=null?h:"",this[a].buildId=n.buildId;var p;this[a].locale=(p=n.locale)!=null?p:l,this[a].trailingSlash=n.trailingSlash}formatPathname(){return Te.formatNextPathnameInfo({basePath:this[a].basePath,buildId:this[a].buildId,defaultLocale:this[a].options.forceLocale?void 0:this[a].defaultLocale,locale:this[a].locale,pathname:this[a].url.pathname,trailingSlash:this[a].trailingSlash})}get buildId(){return this[a].buildId}set buildId(e){this[a].buildId=e}get locale(){var e;return(e=this[a].locale)!=null?e:""}set locale(e){var r,s;if(!this[a].locale||!(!((r=this[a].options.nextConfig)==null||(s=r.i18n)==null)&&s.locales.includes(e)))throw new TypeError(`The NextURL configuration includes no locale "${e}"`);this[a].locale=e}get defaultLocale(){return this[a].defaultLocale}get domainLocale(){return this[a].domainLocale}get searchParams(){return this[a].url.searchParams}get host(){return this[a].url.host}set host(e){this[a].url.host=e}get hostname(){return this[a].url.hostname}set hostname(e){this[a].url.hostname=e}get port(){return this[a].url.port}set port(e){this[a].url.port=e}get protocol(){return this[a].url.protocol}set protocol(e){this[a].url.protocol=e}get href(){let e=this.formatPathname();return`${this.protocol}//${this.host}${e}${this[a].url.search}`}set href(e){this[a].url=re(e),this.analyzeUrl()}get origin(){return this[a].url.origin}get pathname(){return this[a].url.pathname}set pathname(e){this[a].url.pathname=e}get hash(){return this[a].url.hash}set hash(e){this[a].url.hash=e}get search(){return this[a].url.search}set search(e){this[a].url.search=e}get password(){return this[a].url.password}set password(e){this[a].url.password=e}get username(){return this[a].url.username}set username(e){this[a].url.username=e}get basePath(){return this[a].basePath}set basePath(e){this[a].basePath=e.startsWith("/")?e:`/${e}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new t(String(this),this[a].options)}};M.NextURL=R;var te=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1|localhost)/;function re(t,e){return new URL(String(t).replace(te,"localhost"),e&&String(e).replace(te,"localhost"))}});var oe=u(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.fromNodeHeaders=Ge;f.toNodeHeaders=Qe;f.splitCookiesString=ae;f.validateURL=Ve;function Ge(t){let e=new Headers;for(let[r,s]of Object.entries(t)){let o=Array.isArray(s)?s:[s];for(let i of o)i!==void 0&&e.append(r,i)}return e}function Qe(t){let e={};if(t)for(let[r,s]of t.entries())e[r]=s,r.toLowerCase()==="set-cookie"&&(e[r]=ae(s));return e}function ae(t){var e=[],r=0,s,o,i,n,l;function h(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function p(){return o=t.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<t.length;){for(s=r,l=!1;h();)if(o=t.charAt(r),o===","){for(i=r,r+=1,h(),n=r;r<t.length&&p();)r+=1;r<t.length&&t.charAt(r)==="="?(l=!0,r=n,e.push(t.substring(s,i)),s=r):r=i+1}else r+=1;(!l||r>=t.length)&&e.push(t.substring(s,t.length))}return e}function Ve(t){try{return String(new URL(String(t)))}catch(e){throw new Error("URLs is malformed. Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls",{cause:e})}}});var ue=u(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});var v=Xe(ge("next/dist/compiled/cookie"));function Xe(t){return t&&t.__esModule?t:{default:t}}var Be=t=>(t=Object.assign({},t),t.maxAge&&(t.expires=new Date(Date.now()+t.maxAge*1e3)),t.path==null&&(t.path="/"),t),Ke=t=>typeof t=="object"?`j:${JSON.stringify(t)}`:String(t),ne=(t,e={})=>v.default.serialize(t,"",{expires:new Date(0),path:"/",...e}),ie=t=>{let e=t.headers.get("set-cookie");return e!=null?e.split(", "):[]},le=t=>t.join(", "),g=class extends Map{constructor(e){let r=typeof e=="string"?v.default.parse(e):{};super(Object.entries(r))}set(e,r,s={}){return super.set(e,v.default.serialize(e,Ke(r),Be(s)))}[Symbol.for("edge-runtime.inspect.custom")](){return Object.fromEntries(this.entries())}};x.Cookies=g;var U=class extends g{constructor(e){super(e.headers.get("cookie")),this.response=e}get=(...e)=>this.getWithOptions(...e).value;getWithOptions=(...e)=>{let r=super.get(...e);if(typeof r!="string")return{value:r,options:{}};let{[e[0]]:s,...o}=v.default.parse(r);return{value:s,options:o}};set=(...e)=>{let r=super.has(e[0]);super.set(...e);let s=super.get(e[0]);if(typeof s!="string")throw new Error(`Invariant: failed to generate cookie for ${JSON.stringify(e)}`);if(r){let o=le(ie(this.response).filter(i=>!i.startsWith(`${e[0]}=`)));o?this.response.headers.set("set-cookie",[s,o].join(", ")):this.response.headers.set("set-cookie",s)}else this.response.headers.append("set-cookie",s);return this};delete=(e,r={})=>{let s=super.delete(e);if(s){let o=le(ie(this.response).filter(n=>!n.startsWith(`${e}=`))),i=ne(e,r);this.response.headers.set("set-cookie",[i,o].join(", "))}return s};clear=(e={})=>{let r=Array.from(super.keys()).map(s=>ne(s,e)).join(", ");return r&&this.response.headers.set("set-cookie",r),super.clear()}};x.NextCookies=U});var E=u(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});var Ye=se(),A=oe(),Ze=ue(),he=Symbol("internal response"),et=new Set([301,302,303,307,308]),z=class t extends Response{constructor(e,r={}){super(e,r),this[he]={cookies:new Ze.NextCookies(this),url:r.url?new Ye.NextURL(r.url,{headers:A.toNodeHeaders(this.headers),nextConfig:r.nextConfig}):void 0}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,url:this.url,body:this.body,bodyUsed:this.bodyUsed,headers:Object.fromEntries(this.headers),ok:this.ok,redirected:this.redirected,status:this.status,statusText:this.statusText,type:this.type}}get cookies(){return this[he].cookies}static json(e,r){let s=Response.json(e,r);return new t(s.body,s)}static redirect(e,r){var s;let o=typeof r=="number"?r:(s=r?.status)!=null?s:307;if(!et.has(o))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');let i=typeof r=="object"?r:{},n=new Headers(i?.headers);return n.set("Location",A.validateURL(e)),new t(null,{...i,headers:n,status:o})}static rewrite(e,r){let s=new Headers(r?.headers);return s.set("x-middleware-rewrite",A.validateURL(e)),new t(null,{...r,headers:s})}static next(e){let r=new Headers(e?.headers);return r.set("x-middleware-next","1"),new t(null,{...e,headers:r})}};W.NextResponse=z});var d={};xe(d,{NextResponse:()=>rt,__esModule:()=>tt,default:()=>at});var ce=D(E());c(d,D(E()));var{__esModule:tt,NextResponse:rt}=ce,{default:de,...st}=ce,at=de!==void 0?de:st;export{rt as NextResponse,tt as __esModule,at as default};
|
|
5
|
+
//# sourceMappingURL=response.js.map
|
|
@@ -7,23 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"scopes": {
|
|
9
9
|
"./esm.sh/": {
|
|
10
|
-
"/v91/next@12.2.5/deno/dist/
|
|
11
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/get-hostname.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/get-hostname.js",
|
|
12
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/format-next-pathname-info.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/format-next-pathname-info.js",
|
|
13
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/i18n/detect-domain-locale.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/i18n/detect-domain-locale.js",
|
|
14
|
-
"/v91/next@12.2.5/deno/dist/compiled/cookie.js": "./esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js",
|
|
15
|
-
"/v91/next@12.2.5/deno/dist/server/web/error.js": "./esm.sh/v91/next@12.2.5/deno/dist/server/web/error.js",
|
|
16
|
-
"/v91/next@12.2.5/deno/dist/server/web/utils.js": "./esm.sh/v91/next@12.2.5/deno/dist/server/web/utils.js",
|
|
17
|
-
"/v91/next@12.2.5/deno/dist/server/web/next-url.js": "./esm.sh/v91/next@12.2.5/deno/dist/server/web/next-url.js",
|
|
18
|
-
"/v91/next@12.2.5/deno/dist/server/web/spec-extension/cookies.js": "./esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/cookies.js",
|
|
19
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js",
|
|
20
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-prefix.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-prefix.js",
|
|
21
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js",
|
|
22
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-locale.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-locale.js",
|
|
23
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-suffix.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-suffix.js",
|
|
24
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-trailing-slash.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-trailing-slash.js",
|
|
25
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/i18n/normalize-locale-path.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/i18n/normalize-locale-path.js",
|
|
26
|
-
"/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-path-prefix.js": "./esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-path-prefix.js"
|
|
10
|
+
"/v91/next@12.2.5/deno/dist/compiled/cookie.js": "./esm.sh/v91/next@12.2.5/deno/dist/compiled/cookie.js"
|
|
27
11
|
}
|
|
28
12
|
}
|
|
29
13
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/error) deno production */
|
|
2
|
-
var l=Object.create;var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var _=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var w=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of f(r))!h.call(e,s)&&s!==t&&c(e,s,{get:()=>r[s],enumerable:!(u=g(r,s))||u.enumerable});return e};var v=(e,r,t)=>(t=e!=null?l(x(e)):{},w(r||!e||!e.__esModule?c(t,"default",{value:e,enumerable:!0}):t,e));var i=_(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});var a=class extends Error{constructor({page:r}){super(`The middleware "${r}" accepts an async API directly with the form:
|
|
3
|
-
|
|
4
|
-
export function middleware(request, event) {
|
|
5
|
-
return NextResponse.redirect('/new-location')
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
|
9
|
-
`)}};o.PageSignatureError=a;var n=class extends Error{constructor(){super("The request.page has been deprecated in favour of `URLPattern`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n ")}};o.RemovedPageError=n;var d=class extends Error{constructor(){super("The request.ua has been removed in favour of `userAgent` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n ")}};o.RemovedUAError=d});var p=v(i()),j=!0,{PageSignatureError:q,RemovedPageError:b,RemovedUAError:y}=p,{default:m,...R}=p,A=m!==void 0?m:R;export{q as PageSignatureError,b as RemovedPageError,y as RemovedUAError,j as __esModule,A as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/next-url) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_get_next_pathname_info$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/get-next-pathname-info.js";import __next_dist_shared_lib_get_hostname$ from "/v91/next@12.2.5/deno/dist/shared/lib/get-hostname.js";import __next_dist_shared_lib_router_utils_format_next_pathname_info$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/format-next-pathname-info.js";import __next_dist_shared_lib_i18n_detect_domain_locale$ from "/v91/next@12.2.5/deno/dist/shared/lib/i18n/detect-domain-locale.js";var _=Object.create;var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var l=(s=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(s,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):s)(function(s){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+s+'" is not supported')});var w=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var y=(s,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of I(t))!S.call(s,a)&&a!==r&&p(s,a,{get:()=>t[a],enumerable:!(o=v(t,a))||o.enumerable});return s};var N=(s,t,r)=>(r=s!=null?_(x(s)):{},y(t||!s||!s.__esModule?p(r,"default",{value:s,enumerable:!0}):r,s));var L=w(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});var U=__next_dist_shared_lib_i18n_detect_domain_locale$,C=__next_dist_shared_lib_router_utils_format_next_pathname_info$,$=__next_dist_shared_lib_get_hostname$,R=__next_dist_shared_lib_router_utils_get_next_pathname_info$,e=Symbol("NextURLInternal"),n=class{constructor(t,r,o){let a,h;typeof r=="object"&&"pathname"in r||typeof r=="string"?(a=r,h=o||{}):h=o||r||{},this[e]={url:g(t,a??h.base),options:h,basePath:""},this.analyzeUrl()}analyzeUrl(){var t,r,o,a,h;let i=R.getNextPathnameInfo(this[e].url.pathname,{nextConfig:this[e].options.nextConfig,parseData:!0});this[e].domainLocale=U.detectDomainLocale((t=this[e].options.nextConfig)==null||(r=t.i18n)==null?void 0:r.domains,$.getHostname(this[e].url,this[e].options.headers));let c=((o=this[e].domainLocale)==null?void 0:o.defaultLocale)||((a=this[e].options.nextConfig)==null||(h=a.i18n)==null?void 0:h.defaultLocale);this[e].url.pathname=i.pathname,this[e].defaultLocale=c;var d;this[e].basePath=(d=i.basePath)!=null?d:"",this[e].buildId=i.buildId;var m;this[e].locale=(m=i.locale)!=null?m:c,this[e].trailingSlash=i.trailingSlash}formatPathname(){return C.formatNextPathnameInfo({basePath:this[e].basePath,buildId:this[e].buildId,defaultLocale:this[e].options.forceLocale?void 0:this[e].defaultLocale,locale:this[e].locale,pathname:this[e].url.pathname,trailingSlash:this[e].trailingSlash})}get buildId(){return this[e].buildId}set buildId(t){this[e].buildId=t}get locale(){var t;return(t=this[e].locale)!=null?t:""}set locale(t){var r,o;if(!this[e].locale||!(!((r=this[e].options.nextConfig)==null||(o=r.i18n)==null)&&o.locales.includes(t)))throw new TypeError(`The NextURL configuration includes no locale "${t}"`);this[e].locale=t}get defaultLocale(){return this[e].defaultLocale}get domainLocale(){return this[e].domainLocale}get searchParams(){return this[e].url.searchParams}get host(){return this[e].url.host}set host(t){this[e].url.host=t}get hostname(){return this[e].url.hostname}set hostname(t){this[e].url.hostname=t}get port(){return this[e].url.port}set port(t){this[e].url.port=t}get protocol(){return this[e].url.protocol}set protocol(t){this[e].url.protocol=t}get href(){let t=this.formatPathname();return`${this.protocol}//${this.host}${t}${this[e].url.search}`}set href(t){this[e].url=g(t),this.analyzeUrl()}get origin(){return this[e].url.origin}get pathname(){return this[e].url.pathname}set pathname(t){this[e].url.pathname=t}get hash(){return this[e].url.hash}set hash(t){this[e].url.hash=t}get search(){return this[e].url.search}set search(t){this[e].url.search=t}get password(){return this[e].url.password}set password(t){this[e].url.password=t}get username(){return this[e].url.username}set username(t){this[e].url.username=t}get basePath(){return this[e].basePath}set basePath(t){this[e].basePath=t.startsWith("/")?t:`/${t}`}toString(){return this.href}toJSON(){return this.href}[Symbol.for("edge-runtime.inspect.custom")](){return{href:this.href,origin:this.origin,protocol:this.protocol,username:this.username,password:this.password,host:this.host,hostname:this.hostname,port:this.port,pathname:this.pathname,search:this.search,searchParams:this.searchParams,hash:this.hash}}clone(){return new n(String(this),this[e].options)}};u.NextURL=n;var f=/(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|::1|localhost)/;function g(s,t){return new URL(String(s).replace(f,"localhost"),t&&String(t).replace(f,"localhost"))}});var b=N(L()),T=!0,{NextURL:z}=b,{default:P,...q}=b,D=P!==void 0?P:q;export{z as NextURL,T as __esModule,D as default};
|
package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/server/web/spec-extension/cookies.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/spec-extension/cookies) deno production */
|
|
2
|
-
import __next_dist_compiled_cookie$ from "/v91/next@12.2.5/deno/dist/compiled/cookie.js";var x=Object.create;var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var j=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,s)=>(typeof require!="undefined"?require:e)[s]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var w=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of C(e))!y.call(t,i)&&i!==s&&l(t,i,{get:()=>e[i],enumerable:!(r=m(e,i))||r.enumerable});return t};var v=(t,e,s)=>(s=t!=null?x(O(t)):{},w(e||!t||!t.__esModule?l(s,"default",{value:t,enumerable:!0}):s,t));var h=z(a=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var o=A(__next_dist_compiled_cookie$);function A(t){return t&&t.__esModule?t:{default:t}}var D=t=>(t=Object.assign({},t),t.maxAge&&(t.expires=new Date(Date.now()+t.maxAge*1e3)),t.path==null&&(t.path="/"),t),M=t=>typeof t=="object"?`j:${JSON.stringify(t)}`:String(t),p=(t,e={})=>o.default.serialize(t,"",{expires:new Date(0),path:"/",...e}),d=t=>{let e=t.headers.get("set-cookie");return e!=null?e.split(", "):[]},f=t=>t.join(", "),n=class extends Map{constructor(e){let s=typeof e=="string"?o.default.parse(e):{};super(Object.entries(s))}set(e,s,r={}){return super.set(e,o.default.serialize(e,M(s),D(r)))}[Symbol.for("edge-runtime.inspect.custom")](){return Object.fromEntries(this.entries())}};a.Cookies=n;var c=class extends n{constructor(e){super(e.headers.get("cookie")),this.response=e}get=(...e)=>this.getWithOptions(...e).value;getWithOptions=(...e)=>{let s=super.get(...e);if(typeof s!="string")return{value:s,options:{}};let{[e[0]]:r,...i}=o.default.parse(s);return{value:r,options:i}};set=(...e)=>{let s=super.has(e[0]);super.set(...e);let r=super.get(e[0]);if(typeof r!="string")throw new Error(`Invariant: failed to generate cookie for ${JSON.stringify(e)}`);if(s){let i=f(d(this.response).filter(u=>!u.startsWith(`${e[0]}=`)));i?this.response.headers.set("set-cookie",[r,i].join(", ")):this.response.headers.set("set-cookie",r)}else this.response.headers.append("set-cookie",r);return this};delete=(e,s={})=>{let r=super.delete(e);if(r){let i=f(d(this.response).filter(g=>!g.startsWith(`${e}=`))),u=p(e,s);this.response.headers.set("set-cookie",[u,i].join(", "))}return r};clear=(e={})=>{let s=Array.from(super.keys()).map(r=>p(r,e)).join(", ");return s&&this.response.headers.set("set-cookie",s),super.clear()}};a.NextCookies=c});var _=v(h()),b=!0,{Cookies:E,NextCookies:N}=_,{default:k,...S}=_,q=k!==void 0?k:S;export{E as Cookies,N as NextCookies,b as __esModule,q as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/server/web/utils) deno production */
|
|
2
|
-
var m=Object.create;var f=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var L=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var A=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of _(r))!H.call(e,s)&&s!==t&&f(e,s,{get:()=>r[s],enumerable:!(a=w(r,s))||a.enumerable});return e};var C=(e,r,t)=>(t=e!=null?m(y(e)):{},A(r||!e||!e.__esModule?f(t,"default",{value:e,enumerable:!0}):t,e));var h=L(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.fromNodeHeaders=N;o.toNodeHeaders=R;o.splitCookiesString=i;o.validateURL=U;function N(e){let r=new Headers;for(let[t,a]of Object.entries(e)){let s=Array.isArray(a)?a:[a];for(let n of s)n!==void 0&&r.append(t,n)}return r}function R(e){let r={};if(e)for(let[t,a]of e.entries())r[t]=a,t.toLowerCase()==="set-cookie"&&(r[t]=i(a));return r}function i(e){var r=[],t=0,a,s,n,u,l;function d(){for(;t<e.length&&/\s/.test(e.charAt(t));)t+=1;return t<e.length}function v(){return s=e.charAt(t),s!=="="&&s!==";"&&s!==","}for(;t<e.length;){for(a=t,l=!1;d();)if(s=e.charAt(t),s===","){for(n=t,t+=1,d(),u=t;t<e.length&&v();)t+=1;t<e.length&&e.charAt(t)==="="?(l=!0,t=u,r.push(e.substring(a,n)),a=t):t=n+1}else t+=1;(!l||t>=e.length)&&r.push(e.substring(a,e.length))}return r}function U(e){try{return String(new URL(String(e)))}catch(r){throw new Error("URLs is malformed. Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls",{cause:r})}}});var p=C(h()),j=!0,{fromNodeHeaders:M,toNodeHeaders:O,splitCookiesString:P,validateURL:E}=p,{default:c,...b}=p,F=c!==void 0?c:b;export{j as __esModule,F as default,M as fromNodeHeaders,P as splitCookiesString,O as toNodeHeaders,E as validateURL};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/get-hostname) deno production */
|
|
2
|
-
var _=Object.create;var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var v=(e,t,o,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!c.call(e,r)&&r!==o&&s(e,r,{get:()=>t[r],enumerable:!(u=d(t,r))||u.enumerable});return e};var g=(e,t,o)=>(o=e!=null?_(m(e)):{},v(t||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e));var l=p(n=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.getHostname=x;function x(e,t){var o;return(o=!Array.isArray(t?.host)&&t?.host||e.hostname)==null?void 0:o.split(":")[0].toLowerCase()}});var i=g(l()),M=!0,{getHostname:b}=i,{default:a,...y}=i,j=a!==void 0?a:y;export{M as __esModule,j as default,b as getHostname};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/i18n/detect-domain-locale) deno production */
|
|
2
|
-
var c=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var L=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var x=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!C.call(o,a)&&a!==t&&l(o,a,{get:()=>e[a],enumerable:!(n=p(e,a))||n.enumerable});return o};var D=(o,e,t)=>(t=o!=null?c(w(o)):{},x(e||!o||!o.__esModule?l(t,"default",{value:o,enumerable:!0}):t,o));var u=L(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.detectDomainLocale=b;function b(o,e,t){let n;if(o){t&&(t=t.toLowerCase());for(let r of o){var a,i;let _=(a=r.domain)==null?void 0:a.split(":")[0].toLowerCase();if(e===_||t===r.defaultLocale.toLowerCase()||((i=r.locales)==null?void 0:i.some(d=>d.toLowerCase()===t))){n=r;break}}}return n}});var m=D(u()),y=!0,{detectDomainLocale:H}=m,{default:f,...M}=m,O=f!==void 0?f:M;export{y as __esModule,O as default,H as detectDomainLocale};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/i18n/normalize-locale-path) deno production */
|
|
2
|
-
var i=Object.create;var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var L=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _(t))!m.call(e,r)&&r!==o&&l(e,r,{get:()=>t[r],enumerable:!(s=d(t,r))||s.enumerable});return e};var P=(e,t,o)=>(o=e!=null?i(f(e)):{},L(t||!e||!e.__esModule?l(o,"default",{value:e,enumerable:!0}):o,e));var u=p(a=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.normalizeLocalePath=x;function x(e,t){let o,s=e.split("/");return(t||[]).some(r=>s[1]&&s[1].toLowerCase()===r.toLowerCase()?(o=r,s.splice(1,1),e=s.join("/")||"/",!0):!1),{pathname:e,detectedLocale:o}}});var c=P(u()),w=!0,{normalizeLocalePath:C}=c,{default:n,...z}=c,M=n!==void 0?n:z;export{w as __esModule,M as default,C as normalizeLocalePath};
|
package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-locale.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/add-locale) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_path_has_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js";import __next_dist_shared_lib_router_utils_add_path_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-prefix.js";var x=Object.create;var u=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var s=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(r,t)=>(typeof require!="undefined"?require:r)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var l=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var m=(e,r,t,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of c(r))!L.call(e,a)&&a!==t&&u(e,a,{get:()=>r[a],enumerable:!(d=P(r,a))||d.enumerable});return e};var v=(e,r,t)=>(t=e!=null?x(p(e)):{},m(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e));var f=l(o=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0});o.addLocale=C;var w=__next_dist_shared_lib_router_utils_add_path_prefix$,i=__next_dist_shared_lib_router_utils_path_has_prefix$;function C(e,r,t,d){return r&&r!==t&&(d||!i.pathHasPrefix(e.toLowerCase(),`/${r.toLowerCase()}`)&&!i.pathHasPrefix(e.toLowerCase(),"/api"))?w.addPathPrefix(e,`/${r}`):e}});var n=v(f()),M=!0,{addLocale:$}=n,{default:_,...H}=n,b=_!==void 0?_:H;export{M as __esModule,$ as addLocale,b as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/add-path-prefix) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_parse_path$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js";var f=Object.create;var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var l=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of P(t))!h.call(e,a)&&a!==r&&s(e,a,{get:()=>t[a],enumerable:!(u=i(t,a))||u.enumerable});return e};var m=(e,t,r)=>(r=e!=null?f(c(e)):{},x(t||!e||!e.__esModule?s(r,"default",{value:e,enumerable:!0}):r,e));var o=p(d=>{"use strict";Object.defineProperty(d,"__esModule",{value:!0});d.addPathPrefix=q;var $=__next_dist_shared_lib_router_utils_parse_path$;function q(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:u,hash:a}=$.parsePath(e);return`${t}${r}${u}${a}`}});var _=m(o()),b=!0,{addPathPrefix:j}=_,{default:n,...v}=_,O=n!==void 0?n:v;export{b as __esModule,j as addPathPrefix,O as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/add-path-suffix) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_parse_path$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js";var _=Object.create;var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var p=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of c(t))!l.call(e,a)&&a!==r&&o(e,a,{get:()=>t[a],enumerable:!(u=i(t,a))||u.enumerable});return e};var m=(e,t,r)=>(r=e!=null?_(h(e)):{},x(t||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e));var s=P(d=>{"use strict";Object.defineProperty(d,"__esModule",{value:!0});d.addPathSuffix=S;var $=__next_dist_shared_lib_router_utils_parse_path$;function S(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:r,query:u,hash:a}=$.parsePath(e);return`${r}${t}${u}${a}`}});var n=m(s()),M=!0,{addPathSuffix:b}=n,{default:f,...q}=n,j=f!==void 0?f:q;export{M as __esModule,b as addPathSuffix,j as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/format-next-pathname-info) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_add_locale$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-locale.js";import __next_dist_shared_lib_router_utils_add_path_suffix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-suffix.js";import __next_dist_shared_lib_router_utils_add_path_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/add-path-prefix.js";import __next_dist_shared_lib_router_utils_remove_trailing_slash$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-trailing-slash.js";var x=Object.create;var i=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var r=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(a,t)=>(typeof require!="undefined"?require:a)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var p=(e,a)=>()=>(a||e((a={exports:{}}).exports,a),a.exports);var v=(e,a,t,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of _(a))!c.call(e,d)&&d!==t&&i(e,d,{get:()=>a[d],enumerable:!(l=P(a,d))||l.enumerable});return e};var I=(e,a,t)=>(t=e!=null?x(m(e)):{},v(a||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e));var h=p(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.formatNextPathnameInfo=g;var b=__next_dist_shared_lib_router_utils_remove_trailing_slash$,n=__next_dist_shared_lib_router_utils_add_path_prefix$,o=__next_dist_shared_lib_router_utils_add_path_suffix$,S=__next_dist_shared_lib_router_utils_add_locale$;function g(e){let a=S.addLocale(e.pathname,e.locale,e.buildId?void 0:e.defaultLocale,e.ignorePrefix);return e.buildId&&(a=o.addPathSuffix(n.addPathPrefix(a,`/_next/data/${e.buildId}`),e.pathname==="/"?"index.json":".json")),a=n.addPathPrefix(a,e.basePath),e.trailingSlash?!e.buildId&&!a.endsWith("/")?o.addPathSuffix(a,"/"):a:b.removeTrailingSlash(a)}});var s=I(h()),N=!0,{formatNextPathnameInfo:M}=s,{default:f,...q}=s,T=f!==void 0?f:q;export{N as __esModule,T as default,M as formatNextPathnameInfo};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/get-next-pathname-info) deno production */
|
|
2
|
-
import __next_dist_shared_lib_i18n_normalize_locale_path$ from "/v91/next@12.2.5/deno/dist/shared/lib/i18n/normalize-locale-path.js";import __next_dist_shared_lib_router_utils_path_has_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js";import __next_dist_shared_lib_router_utils_remove_path_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/remove-path-prefix.js";var m=Object.create;var h=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var l=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(a,n)=>(typeof require!="undefined"?require:a)[n]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var g=(e,a)=>()=>(a||e((a={exports:{}}).exports,a),a.exports);var b=(e,a,n,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of x(a))!v.call(e,r)&&r!==n&&h(e,r,{get:()=>a[r],enumerable:!(i=_(a,r))||i.enumerable});return e};var I=(e,a,n)=>(n=e!=null?m(P(e)):{},b(a||!e||!e.__esModule?h(n,"default",{value:e,enumerable:!0}):n,e));var d=g(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.getNextPathnameInfo=N;var j=__next_dist_shared_lib_i18n_normalize_locale_path$,L=__next_dist_shared_lib_router_utils_remove_path_prefix$,q=__next_dist_shared_lib_router_utils_path_has_prefix$;function N(e,a){var n;let{basePath:i,i18n:r,trailingSlash:c}=(n=a.nextConfig)!=null?n:{},t={pathname:e,trailingSlash:e!=="/"?e.endsWith("/"):c};if(i&&q.pathHasPrefix(t.pathname,i)&&(t.pathname=L.removePathPrefix(t.pathname,i),t.basePath=i),a.parseData===!0&&t.pathname.startsWith("/_next/data/")&&t.pathname.endsWith(".json")){let o=t.pathname.replace(/^\/_next\/data\//,"").replace(/\.json$/,"").split("/"),f=o[0];t.pathname=o[1]!=="index"?`/${o.slice(1).join("/")}`:"/",t.buildId=f}if(r){let o=j.normalizeLocalePath(t.pathname,r.locales);t.locale=o?.detectedLocale,t.pathname=o?.pathname||t.pathname}return t}});var u=I(d()),H=!0,{getNextPathnameInfo:M}=u,{default:p,...W}=u,S=p!==void 0?p:W;export{H as __esModule,S as default,M as getNextPathnameInfo};
|
package/src/templates/vendor/esm.sh/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/parse-path) deno production */
|
|
2
|
-
var f=Object.create;var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var m=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of _(e))!h.call(t,n)&&n!==r&&o(t,n,{get:()=>e[n],enumerable:!(s=c(e,n))||s.enumerable});return t};var p=(t,e,r)=>(r=t!=null?f(l(t)):{},m(e||!t||!t.__esModule?o(r,"default",{value:t,enumerable:!0}):r,t));var d=x(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.parsePath=y;function y(t){let e=t.indexOf("#"),r=t.indexOf("?"),s=r>-1&&(e<0||r<e);return s||e>-1?{pathname:t.substring(0,s?r:e),query:s?t.substring(r,e>-1?e:void 0):"",hash:e>-1?t.slice(e):""}:{pathname:t,query:"",hash:""}}});var i=p(d()),O=!0,{parsePath:g}=i,{default:a,...P}=i,I=a!==void 0?a:P;export{O as __esModule,I as default,g as parsePath};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/path-has-prefix) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_parse_path$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/parse-path.js";var _=Object.create;var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var h=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of d(t))!c.call(e,a)&&a!==r&&u(e,a,{get:()=>t[a],enumerable:!(o=p(t,a))||o.enumerable});return e};var m=(e,t,r)=>(r=e!=null?_(l(e)):{},x(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));var n=P(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.pathHasPrefix=v;var H=__next_dist_shared_lib_router_utils_parse_path$;function v(e,t){if(typeof e!="string")return!1;let{pathname:r}=H.parsePath(e);return r===t||r.startsWith(t+"/")}});var i=m(n()),g=!0,{pathHasPrefix:j}=i,{default:f,...y}=i,q=f!==void 0?f:y;export{g as __esModule,q as default,j as pathHasPrefix};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/remove-path-prefix) deno production */
|
|
2
|
-
import __next_dist_shared_lib_router_utils_path_has_prefix$ from "/v91/next@12.2.5/deno/dist/shared/lib/router/utils/path-has-prefix.js";var _=Object.create;var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var x=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var m=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!c.call(e,o)&&o!==r&&s(e,o,{get:()=>t[o],enumerable:!(i=P(t,o))||i.enumerable});return e};var v=(e,t,r)=>(r=e!=null?_(l(e)):{},m(t||!e||!e.__esModule?s(r,"default",{value:e,enumerable:!0}):r,e));var f=h(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.removePathPrefix=H;var p=__next_dist_shared_lib_router_utils_path_has_prefix$;function H(e,t){if(p.pathHasPrefix(e,t)){let r=e.slice(t.length);return r.startsWith("/")?r:`/${r}`}return e}});var n=v(f()),j=!0,{removePathPrefix:q}=n,{default:a,...M}=n,w=a!==void 0?a:M;export{j as __esModule,w as default,q as removePathPrefix};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/* esm.sh - esbuild bundle(next@12.2.5/dist/shared/lib/router/utils/remove-trailing-slash) deno production */
|
|
2
|
-
var _=Object.create;var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var p=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var v=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of c(r))!m.call(e,o)&&o!==t&&a(e,o,{get:()=>r[o],enumerable:!(u=d(r,o))||u.enumerable});return e};var g=(e,r,t)=>(t=e!=null?_(f(e)):{},v(r||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e));var n=p(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});l.removeTrailingSlash=h;function h(e){return e.replace(/\/$/,"")||"/"}});var i=g(n()),M=!0,{removeTrailingSlash:b}=i,{default:s,...x}=i,j=s!==void 0?s:x;export{M as __esModule,j as default,b as removeTrailingSlash};
|