next 15.3.0-canary.0 → 15.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/build-context.d.ts +1 -0
- package/dist/build/build-context.js.map +1 -1
- package/dist/build/index.js +25 -2
- package/dist/build/index.js.map +1 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/plugins/define-env-plugin.d.ts +2 -1
- package/dist/build/webpack/plugins/define-env-plugin.js +23 -2
- package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/build/webpack-build/impl.js +1 -0
- package/dist/build/webpack-build/impl.js.map +1 -1
- package/dist/build/webpack-config.d.ts +2 -1
- package/dist/build/webpack-config.js +5 -4
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +8 -8
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js +1 -1
- package/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.production.js +1 -1
- package/dist/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js +1 -1
- package/dist/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.production.js +1 -1
- package/dist/esm/build/build-context.js.map +1 -1
- package/dist/esm/build/index.js +25 -2
- package/dist/esm/build/index.js.map +1 -1
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js +23 -2
- package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/esm/build/webpack-build/impl.js +1 -0
- package/dist/esm/build/webpack-build/impl.js.map +1 -1
- package/dist/esm/build/webpack-config.js +5 -4
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/inline-static-env.js +122 -0
- package/dist/esm/lib/inline-static-env.js.map +1 -0
- package/dist/esm/server/base-server.js +8 -0
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js +10 -2
- package/dist/esm/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/lib/inline-static-env.d.ts +7 -0
- package/dist/lib/inline-static-env.js +149 -0
- package/dist/lib/inline-static-env.js.map +1 -0
- package/dist/server/base-server.js +8 -0
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/router-utils/setup-dev-bundler.js +8 -0
- package/dist/server/lib/router-utils/setup-dev-bundler.js.map +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/build.d.ts +1 -1
- package/dist/telemetry/events/build.js.map +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
package/dist/esm/client/index.js
CHANGED
@@ -26,7 +26,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
26
26
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
27
27
|
import tracer from './tracing/tracer';
|
28
28
|
import { isNextRouterError } from './components/is-next-router-error';
|
29
|
-
export const version = "15.3.0-canary.
|
29
|
+
export const version = "15.3.0-canary.1";
|
30
30
|
export let router;
|
31
31
|
export const emitter = mitt();
|
32
32
|
const looseToArray = (input)=>[].slice.call(input);
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import fs from 'fs';
|
2
|
+
import path from 'path';
|
3
|
+
import crypto from 'crypto';
|
4
|
+
import { promisify } from 'util';
|
5
|
+
import globOriginal from 'next/dist/compiled/glob';
|
6
|
+
import { getNextConfigEnv, getNextPublicEnvironmentVariables } from '../build/webpack/plugins/define-env-plugin';
|
7
|
+
import { Sema } from 'next/dist/compiled/async-sema';
|
8
|
+
import { BUILD_MANIFEST } from '../shared/lib/constants';
|
9
|
+
const glob = promisify(globOriginal);
|
10
|
+
const getStaticEnv = (config)=>{
|
11
|
+
const staticEnv = {
|
12
|
+
...getNextPublicEnvironmentVariables(),
|
13
|
+
...getNextConfigEnv(config),
|
14
|
+
'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || ''
|
15
|
+
};
|
16
|
+
return staticEnv;
|
17
|
+
};
|
18
|
+
export function populateStaticEnv(config) {
|
19
|
+
// since inlining comes after static generation we need
|
20
|
+
// to ensure this value is assigned to process env so it
|
21
|
+
// can still be accessed
|
22
|
+
const staticEnv = getStaticEnv(config);
|
23
|
+
for(const key in staticEnv){
|
24
|
+
const innerKey = key.split('.').pop() || '';
|
25
|
+
if (!process.env[innerKey]) {
|
26
|
+
process.env[innerKey] = staticEnv[key] || '';
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
export async function inlineStaticEnv({ distDir, config, buildId }) {
|
31
|
+
const nextConfigEnv = getNextConfigEnv(config);
|
32
|
+
const staticEnv = getStaticEnv(config);
|
33
|
+
const serverDir = path.join(distDir, 'server');
|
34
|
+
const serverChunks = await glob('**/*.js', {
|
35
|
+
cwd: serverDir
|
36
|
+
});
|
37
|
+
const clientDir = path.join(distDir, 'static');
|
38
|
+
const clientChunks = await glob('**/*.js', {
|
39
|
+
cwd: clientDir
|
40
|
+
});
|
41
|
+
const webpackRuntimeFile = clientChunks.find((item)=>item.match(/webpack-[a-z0-9]{16}/));
|
42
|
+
if (!webpackRuntimeFile) {
|
43
|
+
throw Object.defineProperty(new Error(`Invariant failed to find webpack runtime chunk`), "__NEXT_ERROR_CODE", {
|
44
|
+
value: "E662",
|
45
|
+
enumerable: false,
|
46
|
+
configurable: true
|
47
|
+
});
|
48
|
+
}
|
49
|
+
const inlineSema = new Sema(8);
|
50
|
+
const nextConfigEnvKeys = Object.keys(nextConfigEnv).map((item)=>item.split('process.env.').pop());
|
51
|
+
const builtRegEx = new RegExp(`[\\w]{1,}(\\.env)?\\.(?:NEXT_PUBLIC_[\\w]{1,}${nextConfigEnvKeys.length ? '|' + nextConfigEnvKeys.join('|') : ''})`, 'g');
|
52
|
+
const changedClientFiles = [];
|
53
|
+
for (const [parentDir, files] of [
|
54
|
+
[
|
55
|
+
serverDir,
|
56
|
+
serverChunks
|
57
|
+
],
|
58
|
+
[
|
59
|
+
clientDir,
|
60
|
+
clientChunks
|
61
|
+
]
|
62
|
+
]){
|
63
|
+
await Promise.all(files.map(async (file)=>{
|
64
|
+
await inlineSema.acquire();
|
65
|
+
const filepath = path.join(parentDir, file);
|
66
|
+
const content = await fs.promises.readFile(filepath, 'utf8');
|
67
|
+
const newContent = content.replace(builtRegEx, (match)=>{
|
68
|
+
let normalizedMatch = `process.env.${match.split('.').pop()}`;
|
69
|
+
if (staticEnv[normalizedMatch]) {
|
70
|
+
return JSON.stringify(staticEnv[normalizedMatch]);
|
71
|
+
}
|
72
|
+
return match;
|
73
|
+
});
|
74
|
+
await fs.promises.writeFile(filepath, newContent);
|
75
|
+
if (content !== newContent && parentDir === clientDir) {
|
76
|
+
changedClientFiles.push({
|
77
|
+
file,
|
78
|
+
content: newContent
|
79
|
+
});
|
80
|
+
}
|
81
|
+
inlineSema.release();
|
82
|
+
}));
|
83
|
+
}
|
84
|
+
const hashChanges = [];
|
85
|
+
// hashes need updating for any changed client files
|
86
|
+
for (const { file, content } of changedClientFiles){
|
87
|
+
var _file_match;
|
88
|
+
// hash is 16 chars currently for all client chunks
|
89
|
+
const originalHash = ((_file_match = file.match(/([a-z0-9]{16})\./)) == null ? void 0 : _file_match[1]) || '';
|
90
|
+
if (!originalHash) {
|
91
|
+
throw Object.defineProperty(new Error(`Invariant: client chunk changed but failed to detect hash ${file}`), "__NEXT_ERROR_CODE", {
|
92
|
+
value: "E663",
|
93
|
+
enumerable: false,
|
94
|
+
configurable: true
|
95
|
+
});
|
96
|
+
}
|
97
|
+
const newHash = crypto.createHash('sha256').update(content).digest('hex').substring(0, 16);
|
98
|
+
hashChanges.push({
|
99
|
+
originalHash,
|
100
|
+
newHash
|
101
|
+
});
|
102
|
+
const filepath = path.join(clientDir, file);
|
103
|
+
await fs.promises.rename(filepath, filepath.replace(originalHash, newHash));
|
104
|
+
}
|
105
|
+
// update build-manifest and webpack-runtime with new hashes
|
106
|
+
for (const file of [
|
107
|
+
path.join(distDir, BUILD_MANIFEST),
|
108
|
+
path.join(distDir, 'static', webpackRuntimeFile),
|
109
|
+
path.join(distDir, 'static', buildId, '_buildManifest.js')
|
110
|
+
]){
|
111
|
+
const content = await fs.promises.readFile(file, 'utf-8');
|
112
|
+
let newContent = content;
|
113
|
+
for (const { originalHash, newHash } of hashChanges){
|
114
|
+
newContent = newContent.replaceAll(originalHash, newHash);
|
115
|
+
}
|
116
|
+
if (content !== newContent) {
|
117
|
+
await fs.promises.writeFile(file, newContent);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
//# sourceMappingURL=inline-static-env.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/inline-static-env.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport crypto from 'crypto'\nimport { promisify } from 'util'\nimport globOriginal from 'next/dist/compiled/glob'\nimport {\n getNextConfigEnv,\n getNextPublicEnvironmentVariables,\n} from '../build/webpack/plugins/define-env-plugin'\nimport { Sema } from 'next/dist/compiled/async-sema'\nimport type { NextConfigComplete } from '../server/config-shared'\nimport { BUILD_MANIFEST } from '../shared/lib/constants'\n\nconst glob = promisify(globOriginal)\n\nconst getStaticEnv = (config: NextConfigComplete) => {\n const staticEnv: Record<string, string | undefined> = {\n ...getNextPublicEnvironmentVariables(),\n ...getNextConfigEnv(config),\n 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || '',\n }\n return staticEnv\n}\n\nexport function populateStaticEnv(config: NextConfigComplete) {\n // since inlining comes after static generation we need\n // to ensure this value is assigned to process env so it\n // can still be accessed\n const staticEnv = getStaticEnv(config)\n for (const key in staticEnv) {\n const innerKey = key.split('.').pop() || ''\n if (!process.env[innerKey]) {\n process.env[innerKey] = staticEnv[key] || ''\n }\n }\n}\n\nexport async function inlineStaticEnv({\n distDir,\n config,\n buildId,\n}: {\n distDir: string\n buildId: string\n config: NextConfigComplete\n}) {\n const nextConfigEnv = getNextConfigEnv(config)\n const staticEnv = getStaticEnv(config)\n\n const serverDir = path.join(distDir, 'server')\n const serverChunks = await glob('**/*.js', {\n cwd: serverDir,\n })\n const clientDir = path.join(distDir, 'static')\n const clientChunks = await glob('**/*.js', {\n cwd: clientDir,\n })\n const webpackRuntimeFile = clientChunks.find((item) =>\n item.match(/webpack-[a-z0-9]{16}/)\n )\n\n if (!webpackRuntimeFile) {\n throw new Error(`Invariant failed to find webpack runtime chunk`)\n }\n\n const inlineSema = new Sema(8)\n const nextConfigEnvKeys = Object.keys(nextConfigEnv).map((item) =>\n item.split('process.env.').pop()\n )\n\n const builtRegEx = new RegExp(\n `[\\\\w]{1,}(\\\\.env)?\\\\.(?:NEXT_PUBLIC_[\\\\w]{1,}${nextConfigEnvKeys.length ? '|' + nextConfigEnvKeys.join('|') : ''})`,\n 'g'\n )\n const changedClientFiles: Array<{ file: string; content: string }> = []\n\n for (const [parentDir, files] of [\n [serverDir, serverChunks],\n [clientDir, clientChunks],\n ] as const) {\n await Promise.all(\n files.map(async (file) => {\n await inlineSema.acquire()\n const filepath = path.join(parentDir, file)\n const content = await fs.promises.readFile(filepath, 'utf8')\n const newContent = content.replace(builtRegEx, (match) => {\n let normalizedMatch = `process.env.${match.split('.').pop()}`\n\n if (staticEnv[normalizedMatch]) {\n return JSON.stringify(staticEnv[normalizedMatch])\n }\n return match\n })\n\n await fs.promises.writeFile(filepath, newContent)\n\n if (content !== newContent && parentDir === clientDir) {\n changedClientFiles.push({ file, content: newContent })\n }\n inlineSema.release()\n })\n )\n }\n const hashChanges: Array<{\n originalHash: string\n newHash: string\n }> = []\n\n // hashes need updating for any changed client files\n for (const { file, content } of changedClientFiles) {\n // hash is 16 chars currently for all client chunks\n const originalHash = file.match(/([a-z0-9]{16})\\./)?.[1] || ''\n\n if (!originalHash) {\n throw new Error(\n `Invariant: client chunk changed but failed to detect hash ${file}`\n )\n }\n const newHash = crypto\n .createHash('sha256')\n .update(content)\n .digest('hex')\n .substring(0, 16)\n\n hashChanges.push({ originalHash, newHash })\n const filepath = path.join(clientDir, file)\n await fs.promises.rename(filepath, filepath.replace(originalHash, newHash))\n }\n\n // update build-manifest and webpack-runtime with new hashes\n for (const file of [\n path.join(distDir, BUILD_MANIFEST),\n path.join(distDir, 'static', webpackRuntimeFile),\n path.join(distDir, 'static', buildId, '_buildManifest.js'),\n ]) {\n const content = await fs.promises.readFile(file, 'utf-8')\n let newContent = content\n\n for (const { originalHash, newHash } of hashChanges) {\n newContent = newContent.replaceAll(originalHash, newHash)\n }\n if (content !== newContent) {\n await fs.promises.writeFile(file, newContent)\n }\n }\n}\n"],"names":["fs","path","crypto","promisify","globOriginal","getNextConfigEnv","getNextPublicEnvironmentVariables","Sema","BUILD_MANIFEST","glob","getStaticEnv","config","staticEnv","deploymentId","populateStaticEnv","key","innerKey","split","pop","process","env","inlineStaticEnv","distDir","buildId","nextConfigEnv","serverDir","join","serverChunks","cwd","clientDir","clientChunks","webpackRuntimeFile","find","item","match","Error","inlineSema","nextConfigEnvKeys","Object","keys","map","builtRegEx","RegExp","length","changedClientFiles","parentDir","files","Promise","all","file","acquire","filepath","content","promises","readFile","newContent","replace","normalizedMatch","JSON","stringify","writeFile","push","release","hashChanges","originalHash","newHash","createHash","update","digest","substring","rename","replaceAll"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,OAAOC,YAAY,SAAQ;AAC3B,SAASC,SAAS,QAAQ,OAAM;AAChC,OAAOC,kBAAkB,0BAAyB;AAClD,SACEC,gBAAgB,EAChBC,iCAAiC,QAC5B,6CAA4C;AACnD,SAASC,IAAI,QAAQ,gCAA+B;AAEpD,SAASC,cAAc,QAAQ,0BAAyB;AAExD,MAAMC,OAAON,UAAUC;AAEvB,MAAMM,eAAe,CAACC;IACpB,MAAMC,YAAgD;QACpD,GAAGN,mCAAmC;QACtC,GAAGD,iBAAiBM,OAAO;QAC3B,kCAAkCA,OAAOE,YAAY,IAAI;IAC3D;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,kBAAkBH,MAA0B;IAC1D,uDAAuD;IACvD,wDAAwD;IACxD,wBAAwB;IACxB,MAAMC,YAAYF,aAAaC;IAC/B,IAAK,MAAMI,OAAOH,UAAW;QAC3B,MAAMI,WAAWD,IAAIE,KAAK,CAAC,KAAKC,GAAG,MAAM;QACzC,IAAI,CAACC,QAAQC,GAAG,CAACJ,SAAS,EAAE;YAC1BG,QAAQC,GAAG,CAACJ,SAAS,GAAGJ,SAAS,CAACG,IAAI,IAAI;QAC5C;IACF;AACF;AAEA,OAAO,eAAeM,gBAAgB,EACpCC,OAAO,EACPX,MAAM,EACNY,OAAO,EAKR;IACC,MAAMC,gBAAgBnB,iBAAiBM;IACvC,MAAMC,YAAYF,aAAaC;IAE/B,MAAMc,YAAYxB,KAAKyB,IAAI,CAACJ,SAAS;IACrC,MAAMK,eAAe,MAAMlB,KAAK,WAAW;QACzCmB,KAAKH;IACP;IACA,MAAMI,YAAY5B,KAAKyB,IAAI,CAACJ,SAAS;IACrC,MAAMQ,eAAe,MAAMrB,KAAK,WAAW;QACzCmB,KAAKC;IACP;IACA,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|
345
345
|
onInstrumentationRequestError: this.instrumentationOnRequestError.bind(this),
|
346
346
|
reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength
|
347
347
|
};
|
348
|
+
if (process.env.NEXT_RUNTIME !== 'edge') {
|
349
|
+
const { populateStaticEnv } = require('../lib/inline-static-env');
|
350
|
+
// when using compile mode static env isn't inlined so we
|
351
|
+
// need to populate in normal runtime env
|
352
|
+
if (this.renderOpts.isExperimentalCompile) {
|
353
|
+
populateStaticEnv(this.nextConfig);
|
354
|
+
}
|
355
|
+
}
|
348
356
|
// Initialize next/config with the environment configuration
|
349
357
|
setConfig({
|
350
358
|
serverRuntimeConfig,
|