@wular/pnext 0.1.9 → 0.1.10
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/server/_chunks/{aliases-fhv4dt06.js → aliases-s49gt0bb.js} +5 -5
- package/dist/server/_chunks/{analyze-09kx9q6r.js → analyze-c45xjea8.js} +8 -8
- package/dist/server/_chunks/{boot-8aj7efqk.js → boot-exjk45ry.js} +8 -8
- package/dist/server/_chunks/{build-jda155c9.js → build-m49fem3j.js} +4 -4
- package/dist/server/_chunks/{build-wspv5h60.js → build-ntq282xh.js} +46 -26
- package/dist/server/_chunks/{build-tier-qrkpfsk1.js → build-tier-byqfyz34.js} +17 -17
- package/dist/server/_chunks/{config-d4hqyygy.js → config-1hdw96je.js} +2 -2
- package/dist/server/_chunks/{config-7h84p6q8.js → config-m2yaayer.js} +3 -3
- package/dist/server/_chunks/{create-skj8wzt5.js → create-k089tdt7.js} +3 -3
- package/dist/server/_chunks/{dev-pennd36n.js → dev-kwp1t8b3.js} +2 -2
- package/dist/server/_chunks/{generate-d8vb1d21.js → generate-ap2zs26g.js} +3 -3
- package/dist/server/_chunks/{index-yghskk8w.js → index-0f5t5730.js} +16 -13
- package/dist/server/_chunks/{index-xs3411qh.js → index-1q52cw31.js} +7 -7
- package/dist/server/_chunks/{index-cqcwwxfp.js → index-1tmqkr6x.js} +3 -3
- package/dist/server/_chunks/index-1xrvw3zp.js +92 -0
- package/dist/server/_chunks/{index-42fef2rv.js → index-4g6amwtg.js} +2 -2
- package/dist/server/_chunks/{index-47gx7trn.js → index-4hspm5ez.js} +1 -1
- package/dist/server/_chunks/{index-s61bx2aj.js → index-56jw1658.js} +2 -2
- package/dist/server/_chunks/{index-xrsg0041.js → index-6w807g31.js} +12 -4
- package/dist/server/_chunks/{index-jjppzw0s.js → index-72wjyacg.js} +2 -2
- package/dist/server/_chunks/{index-n814hcky.js → index-81qnfmzz.js} +1 -1
- package/dist/server/_chunks/{index-vqs3rebe.js → index-8hy8qskn.js} +3 -3
- package/dist/server/_chunks/{index-e176wk6x.js → index-8y2yft9b.js} +1 -1
- package/dist/server/_chunks/{index-aarf1brn.js → index-a4asdd4j.js} +1 -1
- package/dist/server/_chunks/{index-53fnn598.js → index-cqft8ae4.js} +7 -7
- package/dist/server/_chunks/{index-6tb725m8.js → index-dd4tb5vy.js} +1 -1
- package/dist/server/_chunks/{index-yzcpr3yw.js → index-drfxdvvh.js} +4 -4
- package/dist/server/_chunks/{index-4qsce64w.js → index-e63ma63t.js} +1 -1
- package/dist/server/_chunks/{index-jexsy9a8.js → index-ed6rwv1x.js} +1 -1
- package/dist/server/_chunks/{index-kpdph69z.js → index-f76517s5.js} +23 -23
- package/dist/server/_chunks/{index-0wm2p3ks.js → index-fdc7wz3a.js} +1 -1
- package/dist/server/_chunks/{index-912z4mfx.js → index-g39z5s9d.js} +3 -3
- package/dist/server/_chunks/{index-y9bygr95.js → index-hw5k2sgj.js} +1 -1
- package/dist/server/_chunks/{index-hr63fvzn.js → index-jh486fye.js} +1 -1
- package/dist/server/_chunks/{index-4vf121ws.js → index-mjvq5c7e.js} +8 -8
- package/dist/server/_chunks/{index-0qt2vapb.js → index-mph0cmh9.js} +3 -3
- package/dist/server/_chunks/{index-26gwrm07.js → index-nxg8k7cg.js} +2 -2
- package/dist/server/_chunks/{index-3r6qpe8a.js → index-p79ck9cd.js} +4 -4
- package/dist/server/_chunks/{index-fpghsgb4.js → index-pshjr3qm.js} +1 -1
- package/dist/server/_chunks/{index-1y0cesgn.js → index-r1kzsnyp.js} +4 -4
- package/dist/server/_chunks/{index-veycp46e.js → index-ra6fsg5v.js} +1 -1
- package/dist/server/_chunks/{index-y71a76dn.js → index-tgwt3kwf.js} +4 -4
- package/dist/server/_chunks/{index-zedjt25v.js → index-x3cvacmf.js} +4 -4
- package/dist/server/_chunks/{index-qjrh7w2g.js → index-zq077xjc.js} +1 -1
- package/dist/server/_chunks/{index-da0fphj0.js → index-zvy5134a.js} +5 -5
- package/dist/server/_chunks/{loader-w1e0n5sm.js → loader-5j9bjhw7.js} +6 -6
- package/dist/server/_chunks/{modules-730j14cm.js → modules-gy48pdw3.js} +8 -8
- package/dist/server/_chunks/{pipeline-yjdnwbhm.js → pipeline-m8ac90dn.js} +11 -11
- package/dist/server/_chunks/{production-1xe9b7wd.js → production-26vqtxvg.js} +1 -1
- package/dist/server/_chunks/{proxy-pnevsbfd.js → proxy-74a1mg4v.js} +7 -7
- package/dist/server/_chunks/{proxy-config-9r9e0jvn.js → proxy-config-7hnexa7b.js} +5 -5
- package/dist/server/_chunks/{router-rzge0vz8.js → router-frkywyzb.js} +4 -4
- package/dist/server/_chunks/{routes-0x8wjvcj.js → routes-y7de16ja.js} +7 -7
- package/dist/server/_chunks/{run-tk90r3ac.js → run-q8aq4cez.js} +4 -4
- package/dist/server/_chunks/{server-gev78ejc.js → server-21t1fzp7.js} +19 -19
- package/dist/server/_chunks/{tsconfig-defaults-qe9wd6ne.js → tsconfig-defaults-bcq068bd.js} +3 -3
- package/dist/server/_chunks/{typegen-0yw8sry8.js → typegen-wdqj67rx.js} +10 -10
- package/dist/server/cli/index.js +11 -11
- package/dist/server/cli/start.js +5 -5
- package/dist/server/compat/next/config-headers.js +4 -4
- package/dist/server/compat/next/font/cache.js +4 -4
- package/dist/server/compat/next/font/local.js +5 -5
- package/dist/server/compat/next/font/runtime.js +5 -5
- package/dist/server/compat/next/navigation.js +4 -4
- package/dist/server/compat/next/redirects.js +4 -4
- package/dist/server/compat/next/rewrites.js +3 -3
- package/dist/server/generation.json +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/vercel-warm.ts +2 -1
- package/src/cli/adapters/vercel.ts +37 -1
- package/src/cli/serve/standalone.ts +14 -6
- package/src/css/assets.ts +9 -1
- package/src/render/renderer.ts +6 -3
- package/dist/server/_chunks/index-md5jchzy.js +0 -92
package/src/css/assets.ts
CHANGED
|
@@ -126,11 +126,19 @@ export async function emitFontCssStylesheet(
|
|
|
126
126
|
: `${routeId}.css`
|
|
127
127
|
const name = hashedAssetName(logicalName, contents)
|
|
128
128
|
const file = path.join(outDir, name)
|
|
129
|
-
if (
|
|
129
|
+
if (existsSync(file) && (await readFile(file, 'utf8')) === contents) return name
|
|
130
|
+
try {
|
|
130
131
|
await writeFile(file, contents)
|
|
132
|
+
} catch (error) {
|
|
133
|
+
// A read-only deployment cannot add the sheet; the render inlines the font rules instead.
|
|
134
|
+
if (options.dev || !readOnlyErrors.has((error as NodeJS.ErrnoException).code ?? '')) throw error
|
|
135
|
+
return undefined
|
|
136
|
+
}
|
|
131
137
|
return name
|
|
132
138
|
}
|
|
133
139
|
|
|
140
|
+
const readOnlyErrors = new Set(['EROFS', 'EACCES', 'EPERM'])
|
|
141
|
+
|
|
134
142
|
// Prepend the configured assetPrefix (a CDN origin or path) to an app-absolute
|
|
135
143
|
// asset URL. Link hrefs use basePath instead and must NOT go through here.
|
|
136
144
|
export function withAssetPrefix(
|
package/src/render/renderer.ts
CHANGED
|
@@ -3987,14 +3987,17 @@ async function renderTreeInFrame(
|
|
|
3987
3987
|
...(nonce ? { nonce } : {}),
|
|
3988
3988
|
}),
|
|
3989
3989
|
)
|
|
3990
|
+
let fontStyle = ''
|
|
3990
3991
|
if (!inlineStylesheets && fonts.css) {
|
|
3991
3992
|
const fontAsset = await profileRenderStep(profile, 'font stylesheet', () =>
|
|
3992
3993
|
emitFontCssStylesheet(options.config, options.route.id, fonts.css, stylesheetAssets[0], {
|
|
3993
3994
|
dev: Boolean(options.dev),
|
|
3994
3995
|
}),
|
|
3995
3996
|
)
|
|
3996
|
-
const fontHref = assetHref(options.config, fontAsset)
|
|
3997
|
-
if (
|
|
3997
|
+
const fontHref = fontAsset && assetHref(options.config, fontAsset)
|
|
3998
|
+
if (!fontHref)
|
|
3999
|
+
fontStyle = `<style${nonce ? ` nonce="${escapeHtml(nonce)}"` : ''}>${fonts.css}</style>`
|
|
4000
|
+
else if (globalStylesheet) globalStylesheet = fontHref
|
|
3998
4001
|
else if (Array.isArray(routeStylesheet))
|
|
3999
4002
|
routeStylesheet = [fontHref, ...routeStylesheet.slice(1)]
|
|
4000
4003
|
else routeStylesheet = fontHref
|
|
@@ -4039,7 +4042,7 @@ async function renderTreeInFrame(
|
|
|
4039
4042
|
: ''
|
|
4040
4043
|
// Inlined CSS is a stylesheet, not a script: it belongs at the stylesheet slot so the cascade
|
|
4041
4044
|
// (and the emitted order) matches the linked path.
|
|
4042
|
-
const headStyles = inlineStylesheets
|
|
4045
|
+
const headStyles = [fontStyle, ...(inlineStylesheets ?? [])].filter(Boolean).join('\n')
|
|
4043
4046
|
const headScripts = profileRenderSyncStep(profile, 'head scripts', () =>
|
|
4044
4047
|
[
|
|
4045
4048
|
renderCollectedHeadScripts(),
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import { join as __pnextJoin } from "node:path";
|
|
3
|
-
const __PNEXT_PACKAGE_ROOT__ = __pnextJoin(import.meta.dirname, "../../..");
|
|
4
|
-
// src/runtime/fingerprint.ts
|
|
5
|
-
import { createHash } from "crypto";
|
|
6
|
-
import { mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
var prebundleFingerprint = typeof { version: "0.1.9", fingerprint: "5c05030a635e53e4", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] } === "object" ? { version: "0.1.9", fingerprint: "5c05030a635e53e4", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] }.fingerprint : undefined;
|
|
10
|
-
var SOURCE_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx", ".cjs", ".mjs"]);
|
|
11
|
-
var DECLARATION = /\.d\.[cm]?ts$/;
|
|
12
|
-
var frameworkSrc = fileURLToPath(new URL("..", Bun.pathToFileURL(__PNEXT_PACKAGE_ROOT__ + "/src/runtime/fingerprint.ts").href));
|
|
13
|
-
function sourceFiles(dir, found = []) {
|
|
14
|
-
let entries;
|
|
15
|
-
try {
|
|
16
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
17
|
-
} catch {
|
|
18
|
-
return found;
|
|
19
|
-
}
|
|
20
|
-
for (const entry of entries.sort((a, b) => a.name < b.name ? -1 : 1)) {
|
|
21
|
-
const full = path.join(dir, entry.name);
|
|
22
|
-
if (entry.isDirectory())
|
|
23
|
-
sourceFiles(full, found);
|
|
24
|
-
else if (SOURCE_EXTENSIONS.has(path.extname(entry.name)) && !DECLARATION.test(entry.name))
|
|
25
|
-
found.push(full);
|
|
26
|
-
}
|
|
27
|
-
return found;
|
|
28
|
-
}
|
|
29
|
-
function contentFingerprint(files, dir) {
|
|
30
|
-
const hash = createHash("sha256");
|
|
31
|
-
for (const file of files) {
|
|
32
|
-
hash.update(path.relative(dir, file));
|
|
33
|
-
try {
|
|
34
|
-
hash.update(Bun.hash(readFileSync(file)).toString(36));
|
|
35
|
-
} catch {}
|
|
36
|
-
hash.update("\x00");
|
|
37
|
-
}
|
|
38
|
-
return hash.digest("hex").slice(0, 16);
|
|
39
|
-
}
|
|
40
|
-
var RECORD_VERSION = 1;
|
|
41
|
-
function statSignature(files, dir) {
|
|
42
|
-
const hash = createHash("sha256");
|
|
43
|
-
for (const file of files) {
|
|
44
|
-
const stats = statSync(file, { throwIfNoEntry: false });
|
|
45
|
-
hash.update(`${path.relative(dir, file)}:${stats?.size ?? -1}:${stats?.mtimeMs ?? -1}\x00`);
|
|
46
|
-
}
|
|
47
|
-
return hash.digest("hex").slice(0, 16);
|
|
48
|
-
}
|
|
49
|
-
function recordFile(dir) {
|
|
50
|
-
return path.join(dir, "framework.json");
|
|
51
|
-
}
|
|
52
|
-
function readRecord(dir) {
|
|
53
|
-
try {
|
|
54
|
-
const parsed = JSON.parse(readFileSync(recordFile(dir), "utf8"));
|
|
55
|
-
return parsed.version === RECORD_VERSION && parsed.stats && parsed.fingerprint ? parsed : undefined;
|
|
56
|
-
} catch {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function writeRecord(dir, record) {
|
|
61
|
-
try {
|
|
62
|
-
mkdirSync(dir, { recursive: true });
|
|
63
|
-
writeFileSync(recordFile(dir), JSON.stringify(record));
|
|
64
|
-
} catch {}
|
|
65
|
-
}
|
|
66
|
-
var fingerprint;
|
|
67
|
-
var fingerprintStats;
|
|
68
|
-
var scanned = false;
|
|
69
|
-
var recorded = new Set;
|
|
70
|
-
function frameworkFingerprint(recordDir) {
|
|
71
|
-
const pinned = process.env.PNEXT_FRAMEWORK_FINGERPRINT ?? prebundleFingerprint;
|
|
72
|
-
if (pinned)
|
|
73
|
-
return pinned;
|
|
74
|
-
if (fingerprint !== undefined && (!recordDir || recorded.has(recordDir)))
|
|
75
|
-
return fingerprint;
|
|
76
|
-
const previous = recordDir ? readRecord(recordDir) : undefined;
|
|
77
|
-
if (!scanned || fingerprint === undefined || fingerprintStats === undefined) {
|
|
78
|
-
const files = sourceFiles(frameworkSrc);
|
|
79
|
-
fingerprintStats = statSignature(files, frameworkSrc);
|
|
80
|
-
const recordedFingerprint = previous?.stats === fingerprintStats ? previous.fingerprint : undefined;
|
|
81
|
-
scanned = recordedFingerprint === undefined;
|
|
82
|
-
fingerprint = recordedFingerprint ?? contentFingerprint(files, frameworkSrc);
|
|
83
|
-
}
|
|
84
|
-
if (recordDir) {
|
|
85
|
-
recorded.add(recordDir);
|
|
86
|
-
if (previous?.stats !== fingerprintStats)
|
|
87
|
-
writeRecord(recordDir, { version: RECORD_VERSION, stats: fingerprintStats, fingerprint });
|
|
88
|
-
}
|
|
89
|
-
return fingerprint;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { frameworkFingerprint };
|