@absolutejs/absolute 0.20.0-beta.56 → 0.20.0-beta.57
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/angular/browser.js +1 -45
- package/dist/angular/browser.js.map +2 -2
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +1 -17
- package/dist/angular/index.js.map +2 -2
- package/dist/build.js +8 -2
- package/dist/build.js.map +3 -3
- package/dist/client/chunks/angularPatch-arh4sr68.js +157 -0
- package/dist/client/chunks/angularPatch-arh4sr68.js.map +10 -0
- package/dist/client/chunks/index-5py90ctf.js +87 -0
- package/dist/client/chunks/index-5py90ctf.js.map +10 -0
- package/dist/client/chunks/index-m35nbkdp.js +374 -0
- package/dist/client/chunks/index-m35nbkdp.js.map +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js +12 -0
- package/dist/client/chunks/index-qxjc7kc5.js.map +9 -0
- package/dist/client/chunks/islands-xj2n8nwf.js +281 -0
- package/dist/client/chunks/islands-xj2n8nwf.js.map +14 -0
- package/dist/client/chunks/react-pdg4325x.js +65 -0
- package/dist/client/chunks/react-pdg4325x.js.map +10 -0
- package/dist/client/chunks/svelte-s0c964kb.js +19 -0
- package/dist/client/chunks/svelte-s0c964kb.js.map +10 -0
- package/dist/client/chunks/vue-rdskrnyg.js +24 -0
- package/dist/client/chunks/vue-rdskrnyg.js.map +10 -0
- package/dist/client/index.js +56 -947
- package/dist/client/index.js.map +7 -22
- package/dist/index.js +8 -2
- package/dist/index.js.map +3 -3
- package/dist/islands/browser.js +1 -17
- package/dist/islands/browser.js.map +2 -2
- package/dist/islands/index.js +1 -17
- package/dist/islands/index.js.map +2 -2
- package/dist/react/browser.js +1 -45
- package/dist/react/browser.js.map +2 -2
- package/dist/react/hooks/index.js +1 -17
- package/dist/react/hooks/index.js.map +2 -2
- package/dist/react/index.js +1 -17
- package/dist/react/index.js.map +2 -2
- package/dist/svelte/browser.js +1 -17
- package/dist/svelte/browser.js.map +2 -2
- package/dist/svelte/index.js +1 -17
- package/dist/svelte/index.js.map +2 -2
- package/dist/vue/browser.js +84 -121
- package/dist/vue/browser.js.map +4 -4
- package/dist/vue/index.js +84 -121
- package/dist/vue/index.js.map +4 -4
- package/package.json +9 -7
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isProductionRuntime,
|
|
3
|
+
resolveAngularRuntimePath
|
|
4
|
+
} from "./index-m35nbkdp.js";
|
|
5
|
+
import"./index-qxjc7kc5.js";
|
|
6
|
+
|
|
7
|
+
// src/angular/angularPatch.ts
|
|
8
|
+
var ensureHead = (doc) => {
|
|
9
|
+
if (!doc || doc.head || !doc.documentElement) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const head = doc.createElement("head");
|
|
13
|
+
doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
|
|
14
|
+
};
|
|
15
|
+
var SSR_LAYOUT_RECT = Object.freeze({
|
|
16
|
+
bottom: 0,
|
|
17
|
+
height: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
top: 0,
|
|
21
|
+
width: 0,
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
toJSON() {
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var layoutPatchApplied = false;
|
|
29
|
+
var collectPrototypeChain = (instance) => {
|
|
30
|
+
const protos = [];
|
|
31
|
+
let current = instance ? Object.getPrototypeOf(instance) : null;
|
|
32
|
+
while (current && current !== Object.prototype) {
|
|
33
|
+
protos.push(current);
|
|
34
|
+
current = Object.getPrototypeOf(current);
|
|
35
|
+
}
|
|
36
|
+
return protos;
|
|
37
|
+
};
|
|
38
|
+
var patchElementLayout = (doc) => {
|
|
39
|
+
if (layoutPatchApplied || !doc) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let element;
|
|
43
|
+
try {
|
|
44
|
+
element = doc.createElement("div");
|
|
45
|
+
} catch {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const protos = collectPrototypeChain(element);
|
|
49
|
+
if (protos.length === 0)
|
|
50
|
+
return;
|
|
51
|
+
const copyLayoutRect = (rect) => ({ ...rect });
|
|
52
|
+
const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
|
|
53
|
+
const getClientRects = () => [];
|
|
54
|
+
const noop = () => {
|
|
55
|
+
return;
|
|
56
|
+
};
|
|
57
|
+
const numericProps = [
|
|
58
|
+
"clientWidth",
|
|
59
|
+
"clientHeight",
|
|
60
|
+
"clientLeft",
|
|
61
|
+
"clientTop",
|
|
62
|
+
"offsetWidth",
|
|
63
|
+
"offsetHeight",
|
|
64
|
+
"offsetLeft",
|
|
65
|
+
"offsetTop",
|
|
66
|
+
"scrollWidth",
|
|
67
|
+
"scrollHeight",
|
|
68
|
+
"scrollLeft",
|
|
69
|
+
"scrollTop"
|
|
70
|
+
];
|
|
71
|
+
for (const proto of protos) {
|
|
72
|
+
const define = (name, value) => {
|
|
73
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
74
|
+
if (typeof descriptor?.value === "function")
|
|
75
|
+
return;
|
|
76
|
+
Object.defineProperty(proto, name, {
|
|
77
|
+
configurable: true,
|
|
78
|
+
value,
|
|
79
|
+
writable: true
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
define("getBoundingClientRect", createLayoutRect);
|
|
83
|
+
define("getClientRects", getClientRects);
|
|
84
|
+
define("scrollTo", noop);
|
|
85
|
+
define("scrollBy", noop);
|
|
86
|
+
define("scrollIntoView", noop);
|
|
87
|
+
define("focus", noop);
|
|
88
|
+
define("blur", noop);
|
|
89
|
+
for (const prop of numericProps) {
|
|
90
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
91
|
+
if (desc)
|
|
92
|
+
continue;
|
|
93
|
+
Object.defineProperty(proto, prop, {
|
|
94
|
+
configurable: true,
|
|
95
|
+
get: () => 0
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
layoutPatchApplied = true;
|
|
100
|
+
};
|
|
101
|
+
var applyPatches = async () => {
|
|
102
|
+
const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
|
|
103
|
+
const { ɵDominoAdapter } = await import(spec);
|
|
104
|
+
if (!ɵDominoAdapter?.prototype) {
|
|
105
|
+
console.warn("[Angular Patch] ɵDominoAdapter not found, skipping patches");
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const adapter = new ɵDominoAdapter;
|
|
110
|
+
const resolveSeedDoc = () => {
|
|
111
|
+
if (typeof adapter.createHtmlDocument === "function")
|
|
112
|
+
return adapter.createHtmlDocument();
|
|
113
|
+
if (typeof adapter.getDefaultDocument === "function")
|
|
114
|
+
return adapter.getDefaultDocument();
|
|
115
|
+
return null;
|
|
116
|
+
};
|
|
117
|
+
const seedDoc = resolveSeedDoc();
|
|
118
|
+
if (seedDoc) {
|
|
119
|
+
patchElementLayout(seedDoc);
|
|
120
|
+
const probe = seedDoc.createElement("div");
|
|
121
|
+
if (typeof probe.getBoundingClientRect !== "function") {
|
|
122
|
+
console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
|
|
127
|
+
}
|
|
128
|
+
const proto = ɵDominoAdapter.prototype;
|
|
129
|
+
const origGetBaseHref = proto.getBaseHref;
|
|
130
|
+
proto.getBaseHref = function(doc) {
|
|
131
|
+
if (!doc || !doc.head || typeof doc.head.children === "undefined") {
|
|
132
|
+
return "";
|
|
133
|
+
}
|
|
134
|
+
return origGetBaseHref.call(this, doc);
|
|
135
|
+
};
|
|
136
|
+
const origCreateHtmlDocument = proto.createHtmlDocument;
|
|
137
|
+
proto.createHtmlDocument = function() {
|
|
138
|
+
const doc = origCreateHtmlDocument.call(this);
|
|
139
|
+
ensureHead(doc);
|
|
140
|
+
patchElementLayout(doc);
|
|
141
|
+
return doc;
|
|
142
|
+
};
|
|
143
|
+
const origGetDefaultDocument = proto.getDefaultDocument;
|
|
144
|
+
proto.getDefaultDocument = function() {
|
|
145
|
+
const doc = origGetDefaultDocument.call(this);
|
|
146
|
+
ensureHead(doc);
|
|
147
|
+
patchElementLayout(doc);
|
|
148
|
+
return doc;
|
|
149
|
+
};
|
|
150
|
+
return true;
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
applyPatches
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
//# debugId=CE12054E3565B4C864756E2164756E21
|
|
157
|
+
//# sourceMappingURL=angularPatch-arh4sr68.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/angular/angularPatch.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { resolveAngularRuntimePath } from './resolveAngularPackage';\nimport { isProductionRuntime } from '../utils/runtimeMode';\n\n// Patches Angular SSR's DominoAdapter to guard against null doc.head\n\nconst ensureHead = (doc: Document) => {\n\tif (!doc || doc.head || !doc.documentElement) {\n\t\treturn;\n\t}\n\n\tconst head = doc.createElement('head');\n\tdoc.documentElement.insertBefore(head, doc.documentElement.firstChild);\n};\n\n// Domino's Element does not implement layout APIs that browser components\n// (e.g. ngx-datatable, swiper, drag-drop) call eagerly during change detection.\n// Returning a zeroed DOMRect lets those components render in SSR without\n// crashing — the real values get computed once the page hydrates client-side.\nconst SSR_LAYOUT_RECT = Object.freeze({\n\tbottom: 0,\n\theight: 0,\n\tleft: 0,\n\tright: 0,\n\ttop: 0,\n\twidth: 0,\n\tx: 0,\n\ty: 0,\n\ttoJSON() {\n\t\treturn this;\n\t}\n});\nlet layoutPatchApplied = false;\nconst collectPrototypeChain = (instance: object | null) => {\n\tconst protos: object[] = [];\n\tlet current: object | null = instance\n\t\t? Object.getPrototypeOf(instance)\n\t\t: null;\n\twhile (current && current !== Object.prototype) {\n\t\tprotos.push(current);\n\t\tcurrent = Object.getPrototypeOf(current);\n\t}\n\n\treturn protos;\n};\n\nconst patchElementLayout = (doc: Document) => {\n\tif (layoutPatchApplied || !doc) {\n\t\treturn;\n\t}\n\tlet element: Element;\n\ttry {\n\t\telement = doc.createElement('div');\n\t} catch {\n\t\treturn;\n\t}\n\t// Walk the entire prototype chain so HTMLElement → Element → Node all get\n\t// the layout shims. Domino's base Element.prototype is several hops above\n\t// HTMLDivElement.prototype, and 3rd-party libs call methods anywhere along\n\t// the chain.\n\tconst protos = collectPrototypeChain(element);\n\tif (protos.length === 0) return;\n\n\tconst copyLayoutRect = (rect: typeof SSR_LAYOUT_RECT) => ({ ...rect });\n\tconst createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);\n\tconst getClientRects = () => [];\n\tconst noop = () => undefined;\n\tconst numericProps = [\n\t\t'clientWidth',\n\t\t'clientHeight',\n\t\t'clientLeft',\n\t\t'clientTop',\n\t\t'offsetWidth',\n\t\t'offsetHeight',\n\t\t'offsetLeft',\n\t\t'offsetTop',\n\t\t'scrollWidth',\n\t\t'scrollHeight',\n\t\t'scrollLeft',\n\t\t'scrollTop'\n\t];\n\n\tfor (const proto of protos) {\n\t\tconst define = (name: string, value: unknown) => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(proto, name);\n\t\t\tif (typeof descriptor?.value === 'function') return;\n\n\t\t\tObject.defineProperty(proto, name, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue,\n\t\t\t\twritable: true\n\t\t\t});\n\t\t};\n\n\t\tdefine('getBoundingClientRect', createLayoutRect);\n\t\tdefine('getClientRects', getClientRects);\n\t\tdefine('scrollTo', noop);\n\t\tdefine('scrollBy', noop);\n\t\tdefine('scrollIntoView', noop);\n\t\tdefine('focus', noop);\n\t\tdefine('blur', noop);\n\n\t\tfor (const prop of numericProps) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop);\n\t\t\tif (desc) continue;\n\t\t\tObject.defineProperty(proto, prop, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget: () => 0\n\t\t\t});\n\t\t}\n\t}\n\n\tlayoutPatchApplied = true;\n};\n\nexport const applyPatches = async () => {\n\t// §1.1 — bare specifier in dev shares Bun's module cache with bundled\n\t// server pages. Production stays on the resolved vendor path. Use\n\t// `isProductionRuntime()` instead of a direct `process.env.NODE_ENV`\n\t// read so Bun's bundler doesn't constant-fold this branch out of\n\t// dist/ at absolutejs build time.\n\tconst spec = isProductionRuntime()\n\t\t? resolveAngularRuntimePath('@angular/platform-server')\n\t\t: '@angular/platform-server';\n\tconst { ɵDominoAdapter } = await import(spec);\n\tif (!ɵDominoAdapter?.prototype) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] ɵDominoAdapter not found, skipping patches'\n\t\t);\n\n\t\treturn false;\n\t}\n\n\t// Patch the layout shims onto Domino's Element prototypes immediately\n\t// (don't wait for the first createHtmlDocument call). Components that\n\t// hold an ElementRef from the very first change-detection pass call\n\t// these methods before the lazy patch path would have run.\n\ttry {\n\t\tconst adapter = new ɵDominoAdapter();\n\t\tconst resolveSeedDoc = () => {\n\t\t\tif (typeof adapter.createHtmlDocument === 'function')\n\t\t\t\treturn adapter.createHtmlDocument();\n\t\t\tif (typeof adapter.getDefaultDocument === 'function')\n\t\t\t\treturn adapter.getDefaultDocument();\n\n\t\t\treturn null;\n\t\t};\n\t\tconst seedDoc = resolveSeedDoc();\n\t\tif (seedDoc) {\n\t\t\tpatchElementLayout(seedDoc);\n\t\t\tconst probe = seedDoc.createElement('div');\n\t\t\tif (typeof probe.getBoundingClientRect !== 'function') {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[Angular Patch] Layout shim did not stick on probe element prototype chain'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.warn(\n\t\t\t'[Angular Patch] Could not eagerly patch Element prototypes:',\n\t\t\terror\n\t\t);\n\t}\n\n\tconst proto = ɵDominoAdapter.prototype;\n\n\tconst origGetBaseHref = proto.getBaseHref;\n\tproto.getBaseHref = function (doc: Document) {\n\t\tif (!doc || !doc.head || typeof doc.head.children === 'undefined') {\n\t\t\treturn '';\n\t\t}\n\n\t\treturn origGetBaseHref.call(this, doc);\n\t};\n\n\tconst origCreateHtmlDocument = proto.createHtmlDocument;\n\tproto.createHtmlDocument = function () {\n\t\tconst doc = origCreateHtmlDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\tconst origGetDefaultDocument = proto.getDefaultDocument;\n\tproto.getDefaultDocument = function () {\n\t\tconst doc = origGetDefaultDocument.call(this);\n\t\tensureHead(doc);\n\t\tpatchElementLayout(doc);\n\n\t\treturn doc;\n\t};\n\n\treturn true;\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;AAKA,IAAM,aAAa,CAAC,QAAkB;AAAA,EACrC,IAAI,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,iBAAiB;AAAA,IAC7C;AAAA,EACD;AAAA,EAEA,MAAM,OAAO,IAAI,cAAc,MAAM;AAAA,EACrC,IAAI,gBAAgB,aAAa,MAAM,IAAI,gBAAgB,UAAU;AAAA;AAOtE,IAAM,kBAAkB,OAAO,OAAO;AAAA,EACrC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AAAA,EACL,OAAO;AAAA,EACP,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,GAAG;AAAA,IACR,OAAO;AAAA;AAET,CAAC;AACD,IAAI,qBAAqB;AACzB,IAAM,wBAAwB,CAAC,aAA4B;AAAA,EAC1D,MAAM,SAAmB,CAAC;AAAA,EAC1B,IAAI,UAAyB,WAC1B,OAAO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IAAI,QAAQ,OAAO,IAAI,KAAK,aAAa,aAAa;AAAA,MAClE,OAAO;AAAA,IACR;AAAA,IAEA,OAAO,gBAAgB,KAAK,MAAM,GAAG;AAAA;AAAA,EAGtC,MAAM,yBAAyB,MAAM;AAAA,EACrC,MAAM,qBAAqB,QAAS,GAAG;AAAA,IACtC,MAAM,MAAM,uBAAuB,KAAK,IAAI;AAAA,IAC5C,WAAW,GAAG;AAAA,IACd,mBAAmB,GAAG;AAAA,IAEtB,OAAO;AAAA;AAAA,EAGR,MAAM,yBAAyB,MAAM;AAAA,EACrC,MAAM,qBAAqB,QAAS,GAAG;AAAA,IACtC,MAAM,MAAM,uBAAuB,KAAK,IAAI;AAAA,IAC5C,WAAW,GAAG;AAAA,IACd,mBAAmB,GAAG;AAAA,IAEtB,OAAO;AAAA;AAAA,EAGR,OAAO;AAAA;",
|
|
8
|
+
"debugId": "CE12054E3565B4C864756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/client/browserTranslation.ts
|
|
2
|
+
var translationRestorer = (restore, hasTranslation) => Object.assign(restore, { hasTranslation });
|
|
3
|
+
var emptyTranslationRestorer = () => translationRestorer(() => {
|
|
4
|
+
return;
|
|
5
|
+
}, false);
|
|
6
|
+
var textNodeAt = (parent, index) => {
|
|
7
|
+
const node = parent.childNodes[index];
|
|
8
|
+
return node instanceof Text ? node : undefined;
|
|
9
|
+
};
|
|
10
|
+
var visitElements = (root, visit) => {
|
|
11
|
+
visit(root);
|
|
12
|
+
for (const element of root.querySelectorAll("*"))
|
|
13
|
+
visit(element);
|
|
14
|
+
};
|
|
15
|
+
var elementPath = (root, element) => {
|
|
16
|
+
const path = [];
|
|
17
|
+
let current = element;
|
|
18
|
+
while (current !== root) {
|
|
19
|
+
const parent = current.parentElement;
|
|
20
|
+
if (parent === null)
|
|
21
|
+
return null;
|
|
22
|
+
path.unshift([...parent.children].indexOf(current));
|
|
23
|
+
current = parent;
|
|
24
|
+
}
|
|
25
|
+
return path;
|
|
26
|
+
};
|
|
27
|
+
var elementAtPath = (root, path) => {
|
|
28
|
+
let current = root;
|
|
29
|
+
for (const index of path) {
|
|
30
|
+
const child = current.children[index];
|
|
31
|
+
if (!(child instanceof Element))
|
|
32
|
+
return null;
|
|
33
|
+
current = child;
|
|
34
|
+
}
|
|
35
|
+
return current;
|
|
36
|
+
};
|
|
37
|
+
var captureSsrTextBaselines = (root) => {
|
|
38
|
+
if (root === null || typeof window === "undefined")
|
|
39
|
+
return;
|
|
40
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap;
|
|
41
|
+
visitElements(root, (element) => {
|
|
42
|
+
const text = new Map;
|
|
43
|
+
for (const [index, node] of [...element.childNodes].entries()) {
|
|
44
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
45
|
+
text.set(index, node.nodeValue ?? "");
|
|
46
|
+
}
|
|
47
|
+
if (text.size > 0)
|
|
48
|
+
baselines.set(element, text);
|
|
49
|
+
});
|
|
50
|
+
window.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;
|
|
51
|
+
};
|
|
52
|
+
var prepareBrowserTranslationHydration = (root) => {
|
|
53
|
+
if (root === null || typeof window === "undefined")
|
|
54
|
+
return emptyTranslationRestorer();
|
|
55
|
+
const baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;
|
|
56
|
+
if (baselines === undefined)
|
|
57
|
+
return emptyTranslationRestorer();
|
|
58
|
+
const translated = [];
|
|
59
|
+
visitElements(root, (element) => {
|
|
60
|
+
const text = baselines.get(element);
|
|
61
|
+
const path = elementPath(root, element);
|
|
62
|
+
if (text === undefined || path === null)
|
|
63
|
+
return;
|
|
64
|
+
for (const [index, baseline] of text) {
|
|
65
|
+
const node = textNodeAt(element, index);
|
|
66
|
+
if (node === undefined || node.data === baseline)
|
|
67
|
+
continue;
|
|
68
|
+
translated.push({ baseline, index, path, translated: node.data });
|
|
69
|
+
node.data = baseline;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return translationRestorer(() => {
|
|
73
|
+
for (const snapshot of translated) {
|
|
74
|
+
const parent = elementAtPath(root, snapshot.path);
|
|
75
|
+
if (parent === null)
|
|
76
|
+
continue;
|
|
77
|
+
const node = textNodeAt(parent, snapshot.index);
|
|
78
|
+
if (node !== undefined && node.data === snapshot.baseline)
|
|
79
|
+
node.data = snapshot.translated;
|
|
80
|
+
}
|
|
81
|
+
}, translated.length > 0);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { captureSsrTextBaselines, prepareBrowserTranslationHydration };
|
|
85
|
+
|
|
86
|
+
//# debugId=7A942374163F685B64756E2164756E21
|
|
87
|
+
//# sourceMappingURL=index-5py90ctf.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/client/browserTranslation.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type TextBaseline = ReadonlyMap<number, string>;\ntype SsrTextBaselines = WeakMap<Element, TextBaseline>;\n\ndeclare global {\n\t// Window augmentation requires interface declaration merging.\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n\tinterface Window {\n\t\t__ABSOLUTE_SSR_TEXT_BASELINES__?: SsrTextBaselines;\n\t}\n}\n\ntype TranslatedText = {\n\tbaseline: string;\n\tindex: number;\n\tpath: number[];\n\ttranslated: string;\n};\n\nconst translationRestorer = (restore: () => void, hasTranslation: boolean) =>\n\tObject.assign(restore, { hasTranslation });\n\nconst emptyTranslationRestorer = () =>\n\ttranslationRestorer(() => undefined, false);\n\nconst textNodeAt = (parent: Element, index: number) => {\n\tconst node = parent.childNodes[index];\n\n\treturn node instanceof Text ? node : undefined;\n};\n\nconst visitElements = (root: Element, visit: (element: Element) => void) => {\n\tvisit(root);\n\tfor (const element of root.querySelectorAll('*')) visit(element);\n};\n\nconst elementPath = (root: Element, element: Element) => {\n\tconst path: number[] = [];\n\tlet current = element;\n\twhile (current !== root) {\n\t\tconst parent = current.parentElement;\n\t\tif (parent === null) return null;\n\t\tpath.unshift([...parent.children].indexOf(current));\n\t\tcurrent = parent;\n\t}\n\n\treturn path;\n};\n\nconst elementAtPath = (root: Element, path: number[]) => {\n\tlet current = root;\n\tfor (const index of path) {\n\t\tconst child = current.children[index];\n\t\tif (!(child instanceof Element)) return null;\n\t\tcurrent = child;\n\t}\n\n\treturn current;\n};\n\n/** Capture server-authored text before client modules load. Absolute page\n * handlers install the same snapshot inline; this export supports custom\n * documents and non-standard bootstraps. */\nexport const captureSsrTextBaselines = (root: Element | null) => {\n\tif (root === null || typeof window === 'undefined') return;\n\tconst baselines: SsrTextBaselines =\n\t\twindow.__ABSOLUTE_SSR_TEXT_BASELINES__ ?? new WeakMap();\n\tvisitElements(root, (element) => {\n\t\tconst text = new Map<number, string>();\n\t\tfor (const [index, node] of [...element.childNodes].entries()) {\n\t\t\tif (node.nodeType === Node.TEXT_NODE)\n\t\t\t\ttext.set(index, node.nodeValue ?? '');\n\t\t}\n\t\tif (text.size > 0) baselines.set(element, text);\n\t});\n\twindow.__ABSOLUTE_SSR_TEXT_BASELINES__ = baselines;\n};\n\n/** Temporarily restore server text while a framework attaches to SSR DOM,\n * then reapply translated text. Paths preserve translations even when a\n * framework replaces nodes while mounting. Genuine server/client mismatches\n * are left unchanged. */\nexport const prepareBrowserTranslationHydration = (root: Element | null) => {\n\tif (root === null || typeof window === 'undefined')\n\t\treturn emptyTranslationRestorer();\n\tconst baselines = window.__ABSOLUTE_SSR_TEXT_BASELINES__;\n\tif (baselines === undefined) return emptyTranslationRestorer();\n\tconst translated: TranslatedText[] = [];\n\tvisitElements(root, (element) => {\n\t\tconst text = baselines.get(element);\n\t\tconst path = elementPath(root, element);\n\t\tif (text === undefined || path === null) return;\n\t\tfor (const [index, baseline] of text) {\n\t\t\tconst node = textNodeAt(element, index);\n\t\t\tif (node === undefined || node.data === baseline) continue;\n\t\t\ttranslated.push({ baseline, index, path, translated: node.data });\n\t\t\tnode.data = baseline;\n\t\t}\n\t});\n\n\treturn translationRestorer(() => {\n\t\tfor (const snapshot of translated) {\n\t\t\tconst parent = elementAtPath(root, snapshot.path);\n\t\t\tif (parent === null) continue;\n\t\t\tconst node = textNodeAt(parent, snapshot.index);\n\t\t\tif (node !== undefined && node.data === snapshot.baseline)\n\t\t\t\tnode.data = snapshot.translated;\n\t\t}\n\t}, translated.length > 0);\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAkBA,IAAM,sBAAsB,CAAC,SAAqB,mBACjD,OAAO,OAAO,SAAS,EAAE,eAAe,CAAC;AAE1C,IAAM,2BAA2B,MAChC,oBAAoB,MAAG;AAAA,EAAG;AAAA,GAAW,KAAK;AAE3C,IAAM,aAAa,CAAC,QAAiB,UAAkB;AAAA,EACtD,MAAM,OAAO,OAAO,WAAW;AAAA,EAE/B,OAAO,gBAAgB,OAAO,OAAO;AAAA;AAGtC,IAAM,gBAAgB,CAAC,MAAe,UAAsC;AAAA,EAC3E,MAAM,IAAI;AAAA,EACV,WAAW,WAAW,KAAK,iBAAiB,GAAG;AAAA,IAAG,MAAM,OAAO;AAAA;AAGhE,IAAM,cAAc,CAAC,MAAe,YAAqB;AAAA,EACxD,MAAM,OAAiB,CAAC;AAAA,EACxB,IAAI,UAAU;AAAA,EACd,OAAO,YAAY,MAAM;AAAA,IACxB,MAAM,SAAS,QAAQ;AAAA,IACvB,IAAI,WAAW;AAAA,MAAM,OAAO;AAAA,IAC5B,KAAK,QAAQ,CAAC,GAAG,OAAO,QAAQ,EAAE,QAAQ,OAAO,CAAC;AAAA,IAClD,UAAU;AAAA,EACX;AAAA,EAEA,OAAO;AAAA;AAGR,IAAM,gBAAgB,CAAC,MAAe,SAAmB;AAAA,EACxD,IAAI,UAAU;AAAA,EACd,WAAW,SAAS,MAAM;AAAA,IACzB,MAAM,QAAQ,QAAQ,SAAS;AAAA,IAC/B,IAAI,EAAE,iBAAiB;AAAA,MAAU,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Y,YAAY;AAAA,MAClC,MAAM,SAAS,cAAc,MAAM,SAAS,IAAI;AAAA,MAChD,IAAI,WAAW;AAAA,QAAM;AAAA,MACrB,MAAM,OAAO,WAAW,QAAQ,SAAS,KAAK;AAAA,MAC9C,IAAI,SAAS,aAAa,KAAK,SAAS,SAAS;AAAA,QAChD,KAAK,OAAO,SAAS;AAAA,IACvB;AAAA,KACE,WAAW,SAAS,CAAC;AAAA;",
|
|
8
|
+
"debugId": "7A942374163F685B64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
// src/angular/resolveAngularPackage.ts
|
|
2
|
+
var {existsSync, readFileSync} = (() => ({}));
|
|
3
|
+
|
|
4
|
+
// node:path
|
|
5
|
+
function assertPath(path) {
|
|
6
|
+
if (typeof path !== "string")
|
|
7
|
+
throw TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
8
|
+
}
|
|
9
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
10
|
+
var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
|
|
11
|
+
for (var i = 0;i <= path.length; ++i) {
|
|
12
|
+
if (i < path.length)
|
|
13
|
+
code = path.charCodeAt(i);
|
|
14
|
+
else if (code === 47)
|
|
15
|
+
break;
|
|
16
|
+
else
|
|
17
|
+
code = 47;
|
|
18
|
+
if (code === 47) {
|
|
19
|
+
if (lastSlash === i - 1 || dots === 1)
|
|
20
|
+
;
|
|
21
|
+
else if (lastSlash !== i - 1 && dots === 2) {
|
|
22
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
|
|
23
|
+
if (res.length > 2) {
|
|
24
|
+
var lastSlashIndex = res.lastIndexOf("/");
|
|
25
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
26
|
+
if (lastSlashIndex === -1)
|
|
27
|
+
res = "", lastSegmentLength = 0;
|
|
28
|
+
else
|
|
29
|
+
res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
30
|
+
lastSlash = i, dots = 0;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
34
|
+
res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (allowAboveRoot) {
|
|
39
|
+
if (res.length > 0)
|
|
40
|
+
res += "/..";
|
|
41
|
+
else
|
|
42
|
+
res = "..";
|
|
43
|
+
lastSegmentLength = 2;
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
if (res.length > 0)
|
|
47
|
+
res += "/" + path.slice(lastSlash + 1, i);
|
|
48
|
+
else
|
|
49
|
+
res = path.slice(lastSlash + 1, i);
|
|
50
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
51
|
+
}
|
|
52
|
+
lastSlash = i, dots = 0;
|
|
53
|
+
} else if (code === 46 && dots !== -1)
|
|
54
|
+
++dots;
|
|
55
|
+
else
|
|
56
|
+
dots = -1;
|
|
57
|
+
}
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
60
|
+
function _format(sep, pathObject) {
|
|
61
|
+
var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
62
|
+
if (!dir)
|
|
63
|
+
return base;
|
|
64
|
+
if (dir === pathObject.root)
|
|
65
|
+
return dir + base;
|
|
66
|
+
return dir + sep + base;
|
|
67
|
+
}
|
|
68
|
+
function resolve() {
|
|
69
|
+
var resolvedPath = "", resolvedAbsolute = false, cwd;
|
|
70
|
+
for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
|
|
71
|
+
var path;
|
|
72
|
+
if (i >= 0)
|
|
73
|
+
path = arguments[i];
|
|
74
|
+
else {
|
|
75
|
+
if (cwd === undefined)
|
|
76
|
+
cwd = process.cwd();
|
|
77
|
+
path = cwd;
|
|
78
|
+
}
|
|
79
|
+
if (assertPath(path), path.length === 0)
|
|
80
|
+
continue;
|
|
81
|
+
resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
|
|
82
|
+
}
|
|
83
|
+
if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
|
|
84
|
+
if (resolvedPath.length > 0)
|
|
85
|
+
return "/" + resolvedPath;
|
|
86
|
+
else
|
|
87
|
+
return "/";
|
|
88
|
+
else if (resolvedPath.length > 0)
|
|
89
|
+
return resolvedPath;
|
|
90
|
+
else
|
|
91
|
+
return ".";
|
|
92
|
+
}
|
|
93
|
+
function normalize(path) {
|
|
94
|
+
if (assertPath(path), path.length === 0)
|
|
95
|
+
return ".";
|
|
96
|
+
var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
|
|
97
|
+
if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
|
|
98
|
+
path = ".";
|
|
99
|
+
if (path.length > 0 && trailingSeparator)
|
|
100
|
+
path += "/";
|
|
101
|
+
if (isAbsolute)
|
|
102
|
+
return "/" + path;
|
|
103
|
+
return path;
|
|
104
|
+
}
|
|
105
|
+
function isAbsolute(path) {
|
|
106
|
+
return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
|
|
107
|
+
}
|
|
108
|
+
function join() {
|
|
109
|
+
if (arguments.length === 0)
|
|
110
|
+
return ".";
|
|
111
|
+
var joined;
|
|
112
|
+
for (var i = 0;i < arguments.length; ++i) {
|
|
113
|
+
var arg = arguments[i];
|
|
114
|
+
if (assertPath(arg), arg.length > 0)
|
|
115
|
+
if (joined === undefined)
|
|
116
|
+
joined = arg;
|
|
117
|
+
else
|
|
118
|
+
joined += "/" + arg;
|
|
119
|
+
}
|
|
120
|
+
if (joined === undefined)
|
|
121
|
+
return ".";
|
|
122
|
+
return normalize(joined);
|
|
123
|
+
}
|
|
124
|
+
function relative(from, to) {
|
|
125
|
+
if (assertPath(from), assertPath(to), from === to)
|
|
126
|
+
return "";
|
|
127
|
+
if (from = resolve(from), to = resolve(to), from === to)
|
|
128
|
+
return "";
|
|
129
|
+
var fromStart = 1;
|
|
130
|
+
for (;fromStart < from.length; ++fromStart)
|
|
131
|
+
if (from.charCodeAt(fromStart) !== 47)
|
|
132
|
+
break;
|
|
133
|
+
var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
|
|
134
|
+
for (;toStart < to.length; ++toStart)
|
|
135
|
+
if (to.charCodeAt(toStart) !== 47)
|
|
136
|
+
break;
|
|
137
|
+
var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
|
|
138
|
+
for (;i <= length; ++i) {
|
|
139
|
+
if (i === length) {
|
|
140
|
+
if (toLen > length) {
|
|
141
|
+
if (to.charCodeAt(toStart + i) === 47)
|
|
142
|
+
return to.slice(toStart + i + 1);
|
|
143
|
+
else if (i === 0)
|
|
144
|
+
return to.slice(toStart + i);
|
|
145
|
+
} else if (fromLen > length) {
|
|
146
|
+
if (from.charCodeAt(fromStart + i) === 47)
|
|
147
|
+
lastCommonSep = i;
|
|
148
|
+
else if (i === 0)
|
|
149
|
+
lastCommonSep = 0;
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
|
|
154
|
+
if (fromCode !== toCode)
|
|
155
|
+
break;
|
|
156
|
+
else if (fromCode === 47)
|
|
157
|
+
lastCommonSep = i;
|
|
158
|
+
}
|
|
159
|
+
var out = "";
|
|
160
|
+
for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
|
|
161
|
+
if (i === fromEnd || from.charCodeAt(i) === 47)
|
|
162
|
+
if (out.length === 0)
|
|
163
|
+
out += "..";
|
|
164
|
+
else
|
|
165
|
+
out += "/..";
|
|
166
|
+
if (out.length > 0)
|
|
167
|
+
return out + to.slice(toStart + lastCommonSep);
|
|
168
|
+
else {
|
|
169
|
+
if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
|
|
170
|
+
++toStart;
|
|
171
|
+
return to.slice(toStart);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function _makeLong(path) {
|
|
175
|
+
return path;
|
|
176
|
+
}
|
|
177
|
+
function dirname(path) {
|
|
178
|
+
if (assertPath(path), path.length === 0)
|
|
179
|
+
return ".";
|
|
180
|
+
var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
|
|
181
|
+
for (var i = path.length - 1;i >= 1; --i)
|
|
182
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
183
|
+
if (!matchedSlash) {
|
|
184
|
+
end = i;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
} else
|
|
188
|
+
matchedSlash = false;
|
|
189
|
+
if (end === -1)
|
|
190
|
+
return hasRoot ? "/" : ".";
|
|
191
|
+
if (hasRoot && end === 1)
|
|
192
|
+
return "//";
|
|
193
|
+
return path.slice(0, end);
|
|
194
|
+
}
|
|
195
|
+
function basename(path, ext) {
|
|
196
|
+
if (ext !== undefined && typeof ext !== "string")
|
|
197
|
+
throw TypeError('"ext" argument must be a string');
|
|
198
|
+
assertPath(path);
|
|
199
|
+
var start = 0, end = -1, matchedSlash = true, i;
|
|
200
|
+
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
201
|
+
if (ext.length === path.length && ext === path)
|
|
202
|
+
return "";
|
|
203
|
+
var extIdx = ext.length - 1, firstNonSlashEnd = -1;
|
|
204
|
+
for (i = path.length - 1;i >= 0; --i) {
|
|
205
|
+
var code = path.charCodeAt(i);
|
|
206
|
+
if (code === 47) {
|
|
207
|
+
if (!matchedSlash) {
|
|
208
|
+
start = i + 1;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
if (firstNonSlashEnd === -1)
|
|
213
|
+
matchedSlash = false, firstNonSlashEnd = i + 1;
|
|
214
|
+
if (extIdx >= 0)
|
|
215
|
+
if (code === ext.charCodeAt(extIdx)) {
|
|
216
|
+
if (--extIdx === -1)
|
|
217
|
+
end = i;
|
|
218
|
+
} else
|
|
219
|
+
extIdx = -1, end = firstNonSlashEnd;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (start === end)
|
|
223
|
+
end = firstNonSlashEnd;
|
|
224
|
+
else if (end === -1)
|
|
225
|
+
end = path.length;
|
|
226
|
+
return path.slice(start, end);
|
|
227
|
+
} else {
|
|
228
|
+
for (i = path.length - 1;i >= 0; --i)
|
|
229
|
+
if (path.charCodeAt(i) === 47) {
|
|
230
|
+
if (!matchedSlash) {
|
|
231
|
+
start = i + 1;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
} else if (end === -1)
|
|
235
|
+
matchedSlash = false, end = i + 1;
|
|
236
|
+
if (end === -1)
|
|
237
|
+
return "";
|
|
238
|
+
return path.slice(start, end);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function extname(path) {
|
|
242
|
+
assertPath(path);
|
|
243
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
|
|
244
|
+
for (var i = path.length - 1;i >= 0; --i) {
|
|
245
|
+
var code = path.charCodeAt(i);
|
|
246
|
+
if (code === 47) {
|
|
247
|
+
if (!matchedSlash) {
|
|
248
|
+
startPart = i + 1;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
if (end === -1)
|
|
254
|
+
matchedSlash = false, end = i + 1;
|
|
255
|
+
if (code === 46) {
|
|
256
|
+
if (startDot === -1)
|
|
257
|
+
startDot = i;
|
|
258
|
+
else if (preDotState !== 1)
|
|
259
|
+
preDotState = 1;
|
|
260
|
+
} else if (startDot !== -1)
|
|
261
|
+
preDotState = -1;
|
|
262
|
+
}
|
|
263
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
|
|
264
|
+
return "";
|
|
265
|
+
return path.slice(startDot, end);
|
|
266
|
+
}
|
|
267
|
+
function format(pathObject) {
|
|
268
|
+
if (pathObject === null || typeof pathObject !== "object")
|
|
269
|
+
throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
270
|
+
return _format("/", pathObject);
|
|
271
|
+
}
|
|
272
|
+
function parse(path) {
|
|
273
|
+
assertPath(path);
|
|
274
|
+
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
275
|
+
if (path.length === 0)
|
|
276
|
+
return ret;
|
|
277
|
+
var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
|
|
278
|
+
if (isAbsolute2)
|
|
279
|
+
ret.root = "/", start = 1;
|
|
280
|
+
else
|
|
281
|
+
start = 0;
|
|
282
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
|
|
283
|
+
for (;i >= start; --i) {
|
|
284
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
285
|
+
if (!matchedSlash) {
|
|
286
|
+
startPart = i + 1;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
if (end === -1)
|
|
292
|
+
matchedSlash = false, end = i + 1;
|
|
293
|
+
if (code === 46) {
|
|
294
|
+
if (startDot === -1)
|
|
295
|
+
startDot = i;
|
|
296
|
+
else if (preDotState !== 1)
|
|
297
|
+
preDotState = 1;
|
|
298
|
+
} else if (startDot !== -1)
|
|
299
|
+
preDotState = -1;
|
|
300
|
+
}
|
|
301
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
302
|
+
if (end !== -1)
|
|
303
|
+
if (startPart === 0 && isAbsolute2)
|
|
304
|
+
ret.base = ret.name = path.slice(1, end);
|
|
305
|
+
else
|
|
306
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
307
|
+
} else {
|
|
308
|
+
if (startPart === 0 && isAbsolute2)
|
|
309
|
+
ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
|
|
310
|
+
else
|
|
311
|
+
ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
|
|
312
|
+
ret.ext = path.slice(startDot, end);
|
|
313
|
+
}
|
|
314
|
+
if (startPart > 0)
|
|
315
|
+
ret.dir = path.slice(0, startPart - 1);
|
|
316
|
+
else if (isAbsolute2)
|
|
317
|
+
ret.dir = "/";
|
|
318
|
+
return ret;
|
|
319
|
+
}
|
|
320
|
+
var sep = "/";
|
|
321
|
+
var delimiter = ":";
|
|
322
|
+
var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
|
|
323
|
+
|
|
324
|
+
// src/angular/resolveAngularPackage.ts
|
|
325
|
+
var resolveAngularPackageDir = (specifier) => {
|
|
326
|
+
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
327
|
+
if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
|
|
328
|
+
return fromCompiledRuntime;
|
|
329
|
+
}
|
|
330
|
+
const fromProject = resolve(process.cwd(), "node_modules", specifier);
|
|
331
|
+
if (existsSync(fromProject)) {
|
|
332
|
+
return fromProject;
|
|
333
|
+
}
|
|
334
|
+
return null;
|
|
335
|
+
};
|
|
336
|
+
var resolvePackageEntry = (packageDir) => {
|
|
337
|
+
try {
|
|
338
|
+
const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
|
|
339
|
+
const rootExport = pkg.exports?.["."];
|
|
340
|
+
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
341
|
+
return join(packageDir, entry);
|
|
342
|
+
} catch {
|
|
343
|
+
return packageDir;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
var resolveAngularPackage = (specifier) => {
|
|
347
|
+
const packageDir = resolveAngularPackageDir(specifier);
|
|
348
|
+
if (packageDir)
|
|
349
|
+
return resolvePackageEntry(packageDir);
|
|
350
|
+
return specifier;
|
|
351
|
+
};
|
|
352
|
+
var toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_");
|
|
353
|
+
var resolveAngularRuntimePath = (specifier) => {
|
|
354
|
+
const buildDirs = [
|
|
355
|
+
process.env.ABSOLUTE_BUILD_DIR,
|
|
356
|
+
resolve(process.cwd(), "build")
|
|
357
|
+
].filter((value) => Boolean(value));
|
|
358
|
+
for (const buildDir of buildDirs) {
|
|
359
|
+
const vendorPath = join(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
|
|
360
|
+
if (existsSync(vendorPath))
|
|
361
|
+
return vendorPath;
|
|
362
|
+
}
|
|
363
|
+
return resolveAngularPackage(specifier);
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// src/utils/runtimeMode.ts
|
|
367
|
+
var ENV_VAR = "NODE_ENV";
|
|
368
|
+
var isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
|
|
369
|
+
var isProductionRuntime = () => process.env[ENV_VAR] === "production";
|
|
370
|
+
|
|
371
|
+
export { resolveAngularRuntimePath, isDevelopmentRuntime, isProductionRuntime };
|
|
372
|
+
|
|
373
|
+
//# debugId=FBC668DD8DB2CD9E64756E2164756E21
|
|
374
|
+
//# sourceMappingURL=index-m35nbkdp.js.map
|