@veryfront/ext-content-mdx 0.1.1239 → 0.1.1241
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/esm/deno.d.ts +14 -5
- package/esm/deno.js +23 -7
- package/esm/src/errors/error-registry/runtime.d.ts +2 -0
- package/esm/src/errors/error-registry/runtime.d.ts.map +1 -1
- package/esm/src/errors/error-registry/runtime.js +8 -0
- package/esm/src/errors/error-registry.d.ts +1 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/veryfront-error.d.ts.map +1 -1
- package/esm/src/observability/telemetry-error.js +2 -2
- package/esm/src/observability/tracing/telemetry-env.js +1 -1
- package/esm/src/platform/compat/process/lifecycle.d.ts +10 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -1
- package/esm/src/platform/compat/process/lifecycle.js +23 -0
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +2 -19
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/url-builder.js +2 -67
- package/esm/src/transforms/shared/esm-sh-specifier.d.ts +18 -0
- package/esm/src/transforms/shared/esm-sh-specifier.d.ts.map +1 -0
- package/esm/src/transforms/shared/esm-sh-specifier.js +253 -0
- package/esm/src/utils/feature-flags.js +1 -1
- package/esm/src/utils/perf-timer.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
- package/esm/src/platform/compat/abort-signal.d.ts +0 -20
- package/esm/src/platform/compat/abort-signal.d.ts.map +0 -1
- package/esm/src/platform/compat/abort-signal.js +0 -64
- package/esm/src/platform/compat/dynamic-import.d.ts +0 -11
- package/esm/src/platform/compat/dynamic-import.d.ts.map +0 -1
- package/esm/src/platform/compat/dynamic-import.js +0 -10
- package/esm/src/platform/compat/process/command.d.ts +0 -56
- package/esm/src/platform/compat/process/command.d.ts.map +0 -1
- package/esm/src/platform/compat/process/command.js +0 -525
- package/esm/src/platform/compat/process.d.ts +0 -5
- package/esm/src/platform/compat/process.d.ts.map +0 -1
- package/esm/src/platform/compat/process.js +0 -4
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
const ReflectApply = Reflect.apply;
|
|
2
|
+
const SetHas = Set.prototype.has;
|
|
3
|
+
const StringCharCodeAt = String.prototype.charCodeAt;
|
|
4
|
+
const StringIncludes = String.prototype.includes;
|
|
5
|
+
const StringIndexOf = String.prototype.indexOf;
|
|
6
|
+
const StringLastIndexOf = String.prototype.lastIndexOf;
|
|
7
|
+
const StringSlice = String.prototype.slice;
|
|
8
|
+
const StringSplit = String.prototype.split;
|
|
9
|
+
const StringStartsWith = String.prototype.startsWith;
|
|
10
|
+
const URLConstructor = URL;
|
|
11
|
+
const DecodeURIComponent = decodeURIComponent;
|
|
12
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
13
|
+
const URLOriginGetter = getOwnPropertyDescriptor(URL.prototype, "origin").get;
|
|
14
|
+
const URLPathnameGetter = getOwnPropertyDescriptor(URL.prototype, "pathname").get;
|
|
15
|
+
const URLProtocolGetter = getOwnPropertyDescriptor(URL.prototype, "protocol").get;
|
|
16
|
+
const URLHostnameGetter = getOwnPropertyDescriptor(URL.prototype, "hostname").get;
|
|
17
|
+
const URLPortGetter = getOwnPropertyDescriptor(URL.prototype, "port").get;
|
|
18
|
+
const URLSearchGetter = getOwnPropertyDescriptor(URL.prototype, "search").get;
|
|
19
|
+
const URLHashGetter = getOwnPropertyDescriptor(URL.prototype, "hash").get;
|
|
20
|
+
const ESM_SH_NON_NPM_PREFIXES = new Set([
|
|
21
|
+
"stable",
|
|
22
|
+
"gh",
|
|
23
|
+
"jsr",
|
|
24
|
+
"pr",
|
|
25
|
+
"node",
|
|
26
|
+
]);
|
|
27
|
+
const ESM_SH_BUILD_TARGETS = new Set([
|
|
28
|
+
"es2015",
|
|
29
|
+
"es2016",
|
|
30
|
+
"es2017",
|
|
31
|
+
"es2018",
|
|
32
|
+
"es2019",
|
|
33
|
+
"es2020",
|
|
34
|
+
"es2021",
|
|
35
|
+
"es2022",
|
|
36
|
+
"es2023",
|
|
37
|
+
"es2024",
|
|
38
|
+
"esnext",
|
|
39
|
+
"deno",
|
|
40
|
+
"denonext",
|
|
41
|
+
"node",
|
|
42
|
+
]);
|
|
43
|
+
const CONFIGURED_EXTERNAL_URL_BASE = "https://veryfront.invalid/";
|
|
44
|
+
function stringIncludes(value, search) {
|
|
45
|
+
return ReflectApply(StringIncludes, value, [search]);
|
|
46
|
+
}
|
|
47
|
+
function stringCharCodeAt(value, index) {
|
|
48
|
+
return ReflectApply(StringCharCodeAt, value, [index]);
|
|
49
|
+
}
|
|
50
|
+
function stringLastIndexOf(value, search) {
|
|
51
|
+
return ReflectApply(StringLastIndexOf, value, [search]);
|
|
52
|
+
}
|
|
53
|
+
function stringIndexOf(value, search) {
|
|
54
|
+
return ReflectApply(StringIndexOf, value, [search]);
|
|
55
|
+
}
|
|
56
|
+
function stringSlice(value, start, end) {
|
|
57
|
+
return ReflectApply(StringSlice, value, end === undefined ? [start] : [start, end]);
|
|
58
|
+
}
|
|
59
|
+
function stringSplit(value, separator) {
|
|
60
|
+
return ReflectApply(StringSplit, value, [separator]);
|
|
61
|
+
}
|
|
62
|
+
function stringStartsWith(value, search) {
|
|
63
|
+
return ReflectApply(StringStartsWith, value, [search]);
|
|
64
|
+
}
|
|
65
|
+
function setHas(set, value) {
|
|
66
|
+
return ReflectApply(SetHas, set, [value]);
|
|
67
|
+
}
|
|
68
|
+
function stringEndsWith(value, suffix) {
|
|
69
|
+
return suffix.length <= value.length &&
|
|
70
|
+
stringLastIndexOf(value, suffix) === value.length - suffix.length;
|
|
71
|
+
}
|
|
72
|
+
function getUrlString(url, getter) {
|
|
73
|
+
return ReflectApply(getter, url, []);
|
|
74
|
+
}
|
|
75
|
+
function isVersionedBuildPrefix(value) {
|
|
76
|
+
if (value.length < 2 || value[0] !== "v")
|
|
77
|
+
return false;
|
|
78
|
+
for (let index = 1; index < value.length; index++) {
|
|
79
|
+
const code = stringCharCodeAt(value, index);
|
|
80
|
+
if (code < 48 || code > 57)
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
function isValidEsmShBuildArgsPrefix(value) {
|
|
86
|
+
if (!stringStartsWith(value, "X-"))
|
|
87
|
+
return false;
|
|
88
|
+
const encodedLength = value.length - "X-".length;
|
|
89
|
+
if (encodedLength === 0 || encodedLength % 4 === 1)
|
|
90
|
+
return false;
|
|
91
|
+
for (let index = "X-".length; index < value.length; index++) {
|
|
92
|
+
const code = stringCharCodeAt(value, index);
|
|
93
|
+
const isAlphaNumeric = (code >= 48 && code <= 57) ||
|
|
94
|
+
(code >= 65 && code <= 90) ||
|
|
95
|
+
(code >= 97 && code <= 122);
|
|
96
|
+
if (!isAlphaNumeric && code !== 45 && code !== 95)
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function stripEsmShBuildModeSuffix(value) {
|
|
102
|
+
let stripped = value;
|
|
103
|
+
if (stringEndsWith(value, ".nobundle")) {
|
|
104
|
+
stripped = stringSlice(value, 0, -".nobundle".length);
|
|
105
|
+
}
|
|
106
|
+
else if (stringEndsWith(value, ".bundle")) {
|
|
107
|
+
stripped = stringSlice(value, 0, -".bundle".length);
|
|
108
|
+
}
|
|
109
|
+
return stringEndsWith(stripped, ".development")
|
|
110
|
+
? stringSlice(stripped, 0, -".development".length)
|
|
111
|
+
: stripped;
|
|
112
|
+
}
|
|
113
|
+
/** Recover an installed package subpath when the remaining URL is a generated esm.sh artifact. */
|
|
114
|
+
function getEsmShBuildArtifactSubpath(segments, startIndex, segmentCount, packageName, hasBuildPathEvidence) {
|
|
115
|
+
let targetIndex = startIndex;
|
|
116
|
+
if (targetIndex >= segmentCount)
|
|
117
|
+
return null;
|
|
118
|
+
const hasBuildArgsPrefix = isValidEsmShBuildArgsPrefix(segments[targetIndex]);
|
|
119
|
+
if (hasBuildArgsPrefix)
|
|
120
|
+
targetIndex++;
|
|
121
|
+
if (targetIndex >= segmentCount || !setHas(ESM_SH_BUILD_TARGETS, segments[targetIndex])) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const artifactStart = targetIndex + 1;
|
|
125
|
+
const lastArtifactSegment = segments[segmentCount - 1];
|
|
126
|
+
if (artifactStart >= segmentCount || !lastArtifactSegment)
|
|
127
|
+
return null;
|
|
128
|
+
if (!stringEndsWith(lastArtifactSegment, ".mjs"))
|
|
129
|
+
return null;
|
|
130
|
+
if (artifactStart < segmentCount - 1 && !hasBuildPathEvidence && !hasBuildArgsPrefix)
|
|
131
|
+
return null;
|
|
132
|
+
let artifactSubpath = "";
|
|
133
|
+
for (let index = artifactStart; index < segmentCount - 1; index++) {
|
|
134
|
+
artifactSubpath += `${segments[index]}/`;
|
|
135
|
+
}
|
|
136
|
+
artifactSubpath += stripEsmShBuildModeSuffix(stringSlice(lastArtifactSegment, 0, -".mjs".length));
|
|
137
|
+
const packageSeparator = stringLastIndexOf(packageName, "/");
|
|
138
|
+
const packageBasenameWithExtension = packageSeparator < 0
|
|
139
|
+
? packageName
|
|
140
|
+
: stringSlice(packageName, packageSeparator + 1);
|
|
141
|
+
const packageBasename = stringEndsWith(packageBasenameWithExtension, ".js")
|
|
142
|
+
? stringSlice(packageBasenameWithExtension, 0, -".js".length)
|
|
143
|
+
: packageBasenameWithExtension;
|
|
144
|
+
if (artifactSubpath === packageBasename)
|
|
145
|
+
return "";
|
|
146
|
+
if (artifactSubpath === `__${packageBasename}`)
|
|
147
|
+
return `/${packageBasename}`;
|
|
148
|
+
return `/${artifactSubpath}`;
|
|
149
|
+
}
|
|
150
|
+
/** Check if a URL is hosted by the canonical esm.sh origin. */
|
|
151
|
+
export function isEsmShUrl(url) {
|
|
152
|
+
return stringStartsWith(url, "https://esm.sh/") || stringStartsWith(url, "http://esm.sh/");
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Split an esm.sh URL into its npm coordinates. Returns null for anything that
|
|
156
|
+
* is not a plain `pkg`, `pkg@version`, or `@scope/pkg` path.
|
|
157
|
+
*/
|
|
158
|
+
export function parseEsmShUrl(url) {
|
|
159
|
+
if (!isEsmShUrl(url))
|
|
160
|
+
return null;
|
|
161
|
+
const parsed = constructUrl(url);
|
|
162
|
+
return parsed === null ? null : parseClassifiedEsmShUrl(parsed, false);
|
|
163
|
+
}
|
|
164
|
+
/** Parse esm.sh spellings accepted by browser URL resolution for policy enforcement. */
|
|
165
|
+
export function parseConfiguredExternalEsmShUrl(url) {
|
|
166
|
+
const parsed = constructUrl(url, CONFIGURED_EXTERNAL_URL_BASE);
|
|
167
|
+
if (parsed === null)
|
|
168
|
+
return null;
|
|
169
|
+
const protocol = getUrlString(parsed, URLProtocolGetter);
|
|
170
|
+
const hostname = getUrlString(parsed, URLHostnameGetter);
|
|
171
|
+
const port = getUrlString(parsed, URLPortGetter);
|
|
172
|
+
if ((protocol !== "https:" && protocol !== "http:") ||
|
|
173
|
+
(hostname !== "esm.sh" && hostname !== "esm.sh.") || port !== "") {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
return parseClassifiedEsmShUrl(parsed, true);
|
|
177
|
+
}
|
|
178
|
+
function constructUrl(url, base) {
|
|
179
|
+
try {
|
|
180
|
+
return base === undefined ? new URLConstructor(url) : new URLConstructor(url, base);
|
|
181
|
+
}
|
|
182
|
+
catch (_) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function parseClassifiedEsmShUrl(parsed, enforcementMode) {
|
|
187
|
+
let pathname = stringSlice(getUrlString(parsed, URLPathnameGetter), 1);
|
|
188
|
+
if (enforcementMode) {
|
|
189
|
+
try {
|
|
190
|
+
pathname = ReflectApply(DecodeURIComponent, undefined, [pathname]);
|
|
191
|
+
}
|
|
192
|
+
catch (_) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
const backslashIndex = stringIndexOf(pathname, "\\");
|
|
196
|
+
if (backslashIndex >= 0)
|
|
197
|
+
pathname = stringSlice(pathname, 0, backslashIndex);
|
|
198
|
+
}
|
|
199
|
+
const segments = stringSplit(pathname, "/");
|
|
200
|
+
let segmentCount = segments.length;
|
|
201
|
+
if (enforcementMode && segmentCount > 1 && segments[segmentCount - 1].length === 0) {
|
|
202
|
+
segmentCount--;
|
|
203
|
+
}
|
|
204
|
+
for (let index = 0; index < segmentCount; index++) {
|
|
205
|
+
if (segments[index].length === 0)
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
let coordinateIndex = 0;
|
|
209
|
+
const leading = segments[0];
|
|
210
|
+
if (enforcementMode && leading !== undefined &&
|
|
211
|
+
(isVersionedBuildPrefix(leading) || leading === "stable")) {
|
|
212
|
+
coordinateIndex = 1;
|
|
213
|
+
}
|
|
214
|
+
if (coordinateIndex >= segmentCount)
|
|
215
|
+
return null;
|
|
216
|
+
let first = segments[coordinateIndex];
|
|
217
|
+
const hasExternalAllPrefix = enforcementMode && stringStartsWith(first, "*");
|
|
218
|
+
if (hasExternalAllPrefix)
|
|
219
|
+
first = stringSlice(first, 1);
|
|
220
|
+
if (!first || isVersionedBuildPrefix(first) || setHas(ESM_SH_NON_NPM_PREFIXES, first) ||
|
|
221
|
+
stringIncludes(first, ":")) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
const isScoped = stringStartsWith(first, "@");
|
|
225
|
+
if (isScoped && segmentCount < coordinateIndex + 2)
|
|
226
|
+
return null;
|
|
227
|
+
const packageSegmentIndex = isScoped ? coordinateIndex + 1 : coordinateIndex;
|
|
228
|
+
const last = packageSegmentIndex === coordinateIndex ? first : segments[packageSegmentIndex];
|
|
229
|
+
const versionIndex = stringLastIndexOf(last, "@");
|
|
230
|
+
if (versionIndex > 0 && versionIndex === last.length - 1)
|
|
231
|
+
return null;
|
|
232
|
+
const version = versionIndex > 0 ? stringSlice(last, versionIndex + 1) : null;
|
|
233
|
+
const unversionedLast = versionIndex > 0 ? stringSlice(last, 0, versionIndex) : last;
|
|
234
|
+
const packageName = isScoped ? `${first}/${unversionedLast}` : unversionedLast;
|
|
235
|
+
const firstSubpathIndex = packageSegmentIndex + 1;
|
|
236
|
+
const artifactSubpath = enforcementMode
|
|
237
|
+
? getEsmShBuildArtifactSubpath(segments, firstSubpathIndex, segmentCount, packageName, hasExternalAllPrefix)
|
|
238
|
+
: null;
|
|
239
|
+
let subpath = artifactSubpath ?? "";
|
|
240
|
+
if (artifactSubpath === null) {
|
|
241
|
+
for (let index = firstSubpathIndex; index < segmentCount; index++) {
|
|
242
|
+
subpath += `/${segments[index]}`;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
origin: getUrlString(parsed, URLOriginGetter),
|
|
247
|
+
packageName,
|
|
248
|
+
version: version && version.length > 0 ? version : null,
|
|
249
|
+
subpath,
|
|
250
|
+
search: getUrlString(parsed, URLSearchGetter),
|
|
251
|
+
hash: getUrlString(parsed, URLHashGetter),
|
|
252
|
+
};
|
|
253
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1241",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1241"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Captured AbortSignal operations for hostile JavaScript boundaries.
|
|
3
|
-
*
|
|
4
|
-
* Callers can shadow instance properties or mutate public prototypes after
|
|
5
|
-
* module initialization. These helpers validate the native brand and dispatch
|
|
6
|
-
* through captured intrinsics so cancellation cannot execute those hooks.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
/** Test the native AbortSignal brand without reading overridable properties. */
|
|
11
|
-
export declare function isAbortSignalWithoutHooks(value: unknown): value is AbortSignal;
|
|
12
|
-
/** Read cancellation state through the captured native getter. */
|
|
13
|
-
export declare function isAbortSignalAborted(signal: AbortSignal): boolean;
|
|
14
|
-
/** Read the native cancellation reason without consulting an own accessor. */
|
|
15
|
-
export declare function getAbortSignalReason(signal: AbortSignal): unknown;
|
|
16
|
-
/** Attach one native abort listener without consulting instance methods. */
|
|
17
|
-
export declare function addAbortSignalListenerOnce(signal: AbortSignal, listener: () => void): void;
|
|
18
|
-
/** Remove a native abort listener without consulting instance methods. */
|
|
19
|
-
export declare function removeAbortSignalListener(signal: AbortSignal, listener: () => void): void;
|
|
20
|
-
//# sourceMappingURL=abort-signal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abort-signal.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/abort-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8BH,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAc9E;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAKjE;AAED,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAGjE;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,IAAI,GACnB,IAAI,CAEN;AAED,0EAA0E;AAC1E,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,IAAI,GACnB,IAAI,CAEN"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Captured AbortSignal operations for hostile JavaScript boundaries.
|
|
3
|
-
*
|
|
4
|
-
* Callers can shadow instance properties or mutate public prototypes after
|
|
5
|
-
* module initialization. These helpers validate the native brand and dispatch
|
|
6
|
-
* through captured intrinsics so cancellation cannot execute those hooks.
|
|
7
|
-
*
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
import { isProxyWithoutHooks } from "./error-introspection.js";
|
|
11
|
-
const apply = Reflect.apply;
|
|
12
|
-
const createObject = Object.create;
|
|
13
|
-
const defineOwnProperty = Object.defineProperty;
|
|
14
|
-
const freeze = Object.freeze;
|
|
15
|
-
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
16
|
-
const NativeTypeError = TypeError;
|
|
17
|
-
const abortSignalAbortedGetter = getOwnPropertyDescriptor(AbortSignal.prototype, "aborted")?.get;
|
|
18
|
-
const abortSignalReasonGetter = getOwnPropertyDescriptor(AbortSignal.prototype, "reason")?.get;
|
|
19
|
-
const eventTargetAddEventListener = EventTarget.prototype.addEventListener;
|
|
20
|
-
const eventTargetRemoveEventListener = EventTarget.prototype.removeEventListener;
|
|
21
|
-
const onceOptions = createObject(null);
|
|
22
|
-
defineOwnProperty(onceOptions, "once", {
|
|
23
|
-
configurable: false,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
value: true,
|
|
26
|
-
writable: false,
|
|
27
|
-
});
|
|
28
|
-
freeze(onceOptions);
|
|
29
|
-
/** Test the native AbortSignal brand without reading overridable properties. */
|
|
30
|
-
export function isAbortSignalWithoutHooks(value) {
|
|
31
|
-
if (value === null ||
|
|
32
|
-
(typeof value !== "object" && typeof value !== "function") ||
|
|
33
|
-
isProxyWithoutHooks(value) ||
|
|
34
|
-
typeof abortSignalAbortedGetter !== "function") {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
return typeof apply(abortSignalAbortedGetter, value, []) === "boolean";
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/** Read cancellation state through the captured native getter. */
|
|
45
|
-
export function isAbortSignalAborted(signal) {
|
|
46
|
-
if (typeof abortSignalAbortedGetter !== "function") {
|
|
47
|
-
throw new NativeTypeError("AbortSignal is unavailable in this runtime");
|
|
48
|
-
}
|
|
49
|
-
return apply(abortSignalAbortedGetter, signal, []);
|
|
50
|
-
}
|
|
51
|
-
/** Read the native cancellation reason without consulting an own accessor. */
|
|
52
|
-
export function getAbortSignalReason(signal) {
|
|
53
|
-
if (typeof abortSignalReasonGetter !== "function")
|
|
54
|
-
return undefined;
|
|
55
|
-
return apply(abortSignalReasonGetter, signal, []);
|
|
56
|
-
}
|
|
57
|
-
/** Attach one native abort listener without consulting instance methods. */
|
|
58
|
-
export function addAbortSignalListenerOnce(signal, listener) {
|
|
59
|
-
apply(eventTargetAddEventListener, signal, ["abort", listener, onceOptions]);
|
|
60
|
-
}
|
|
61
|
-
/** Remove a native abort listener without consulting instance methods. */
|
|
62
|
-
export function removeAbortSignalListener(signal, listener) {
|
|
63
|
-
apply(eventTargetRemoveEventListener, signal, ["abort", listener]);
|
|
64
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opaque dynamic import helper.
|
|
3
|
-
*
|
|
4
|
-
* Uses `new Function` to hide the `import()` call from static analysis
|
|
5
|
-
* by bundlers and `deno compile`, preventing them from tracing into
|
|
6
|
-
* the imported specifier.
|
|
7
|
-
*
|
|
8
|
-
* @module platform/compat
|
|
9
|
-
*/
|
|
10
|
-
export declare const dynamicImport: <T = unknown>(specifier: string) => Promise<T>;
|
|
11
|
-
//# sourceMappingURL=dynamic-import.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-import.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/dynamic-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,aAAa,EAA4D,CACpF,CAAC,GAAG,OAAO,EAEX,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opaque dynamic import helper.
|
|
3
|
-
*
|
|
4
|
-
* Uses `new Function` to hide the `import()` call from static analysis
|
|
5
|
-
* by bundlers and `deno compile`, preventing them from tracing into
|
|
6
|
-
* the imported specifier.
|
|
7
|
-
*
|
|
8
|
-
* @module platform/compat
|
|
9
|
-
*/
|
|
10
|
-
export const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export interface CommandResult {
|
|
2
|
-
success: boolean;
|
|
3
|
-
code: number;
|
|
4
|
-
stdout?: string;
|
|
5
|
-
stderr?: string;
|
|
6
|
-
/** True when captured output exceeded the configured byte limit. */
|
|
7
|
-
outputTruncated?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface CommandOptions {
|
|
10
|
-
args?: string[];
|
|
11
|
-
cwd?: string;
|
|
12
|
-
env?: Record<string, string>;
|
|
13
|
-
/** Start from an empty environment before applying `env`. */
|
|
14
|
-
clearEnv?: boolean;
|
|
15
|
-
/** Capture stdout/stderr to return in result */
|
|
16
|
-
capture?: boolean;
|
|
17
|
-
/** Inherit stdio from parent process (shows output in terminal) */
|
|
18
|
-
inherit?: boolean;
|
|
19
|
-
/** Use shell to run the command (needed for .cmd files on Windows) */
|
|
20
|
-
shell?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Kill the command after this duration in milliseconds. Positive values are
|
|
23
|
-
* floored to whole milliseconds and clamped to the portable timer maximum;
|
|
24
|
-
* `undefined`, non-positive values, and NaN disable the timeout.
|
|
25
|
-
*/
|
|
26
|
-
timeoutMs?: number;
|
|
27
|
-
/** Terminate the command when the caller cancels. */
|
|
28
|
-
signal?: AbortSignal;
|
|
29
|
-
/**
|
|
30
|
-
* Best-effort process-tree cleanup after the managed command settles.
|
|
31
|
-
* Disabled by default so generic callers retain normal daemon/background
|
|
32
|
-
* process behavior. Sandboxed or otherwise lifecycle-owning callers can
|
|
33
|
-
* enable it to prevent ordinary descendants from outliving the command.
|
|
34
|
-
*/
|
|
35
|
-
terminateProcessTreeOnExit?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Maximum combined stdout and stderr bytes retained when `capture` is true.
|
|
38
|
-
*
|
|
39
|
-
* @default 16777216
|
|
40
|
-
*/
|
|
41
|
-
maxOutputBytes?: number;
|
|
42
|
-
}
|
|
43
|
-
/** @internal Exported so Windows tree-termination arguments can be tested on every host. */
|
|
44
|
-
export declare function buildWindowsTaskkillArgs(pid: number, force: boolean): string[];
|
|
45
|
-
/**
|
|
46
|
-
* Run a command and return the result.
|
|
47
|
-
* Works across Deno, Node.js, and Bun.
|
|
48
|
-
*
|
|
49
|
-
* @param cmd - Command to run
|
|
50
|
-
* @param options - Command options
|
|
51
|
-
* @param options.capture - Capture stdout/stderr to return in result
|
|
52
|
-
* @param options.inherit - Inherit stdio from parent (shows output in terminal)
|
|
53
|
-
* @param options.shell - Use shell to run command (needed for .cmd on Windows)
|
|
54
|
-
*/
|
|
55
|
-
export declare function runCommand(cmd: string, options?: CommandOptions): Promise<CommandResult>;
|
|
56
|
-
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/command.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAuED,4FAA4F;AAC5F,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAK9E;AAoTD;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAmVxB"}
|