@veryfront/ext-content-mdx 0.1.1232 → 0.1.1234
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/_dnt.shims.js +19 -4
- package/esm/deno.d.ts +2 -0
- package/esm/deno.js +9 -7
- package/esm/src/errors/error-registry/deploy.d.ts +11 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
- package/esm/src/errors/error-registry/deploy.js +24 -0
- package/esm/src/errors/error-registry.d.ts +2 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/platform/adapters/native-file-system-provenance.d.ts +23 -0
- package/esm/src/platform/adapters/native-file-system-provenance.d.ts.map +1 -1
- package/esm/src/platform/adapters/native-file-system-provenance.js +25 -0
- package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.js +2 -2
- package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.js +2 -2
- package/esm/src/platform/compat/process/env.d.ts +4 -0
- package/esm/src/platform/compat/process/env.d.ts.map +1 -1
- package/esm/src/platform/compat/process/env.js +25 -7
- package/esm/src/platform/compat/process/runtime-process.d.ts +8 -0
- package/esm/src/platform/compat/process/runtime-process.d.ts.map +1 -1
- package/esm/src/platform/compat/process/runtime-process.js +8 -0
- package/esm/src/platform/compat/process/scoped-process-env.d.ts +29 -0
- package/esm/src/platform/compat/process/scoped-process-env.d.ts.map +1 -0
- package/esm/src/platform/compat/process/scoped-process-env.js +221 -0
- 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/_dnt.shims.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
import { Deno as dntShimDeno } from "@deno/shim-deno";
|
|
2
1
|
const dntNativeDeno = globalThis.Deno;
|
|
3
2
|
// Prefer the host runtime's own Deno. The `@deno/shim-deno` fallback exists
|
|
4
3
|
// for Node and Bun; under Deno it shadows working native APIs with node:net
|
|
5
4
|
// reimplementations that throw (e.g. Deno.listen reads `server._handle.fd`,
|
|
6
5
|
// which is null on Deno's node compatibility layer).
|
|
6
|
+
//
|
|
7
|
+
// It loads lazily so Deno never resolves it at all. The esm transform
|
|
8
|
+
// rewrites the bare specifier to an absolute file:// bundle, and Deno
|
|
9
|
+
// refuses to prepare that graph node when node_modules is unmanaged, which
|
|
10
|
+
// is what `deno install -g` produces (`nodeModulesDir: "manual"`). A static
|
|
11
|
+
// import therefore failed every request with "Loading unprepared module"
|
|
12
|
+
// naming a bundle that was present on disk, on the one runtime that never
|
|
13
|
+
// reads the value.
|
|
7
14
|
export const Deno = typeof dntNativeDeno?.version?.deno === "string"
|
|
8
15
|
? dntNativeDeno
|
|
9
|
-
:
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
: (await import("@deno/shim-deno")).Deno;
|
|
17
|
+
const dntNativeCrypto = globalThis.crypto;
|
|
18
|
+
// Web Crypto is a global on every runtime the framework supports (Deno,
|
|
19
|
+
// Node 19+, Bun), so `@deno/shim-crypto` is a fallback for runtimes that no
|
|
20
|
+
// longer exist in practice. It loads lazily for the same reason the Deno
|
|
21
|
+
// shim does: the esm transform rewrites the bare specifier to an absolute
|
|
22
|
+
// file:// bundle, and Deno cannot prepare that graph node when node_modules
|
|
23
|
+
// is unmanaged.
|
|
24
|
+
export const crypto = dntNativeCrypto !== undefined
|
|
25
|
+
? dntNativeCrypto
|
|
26
|
+
: (await import("@deno/shim-crypto")).crypto;
|
|
12
27
|
import { setInterval, setTimeout } from "@deno/shim-timers";
|
|
13
28
|
export { setInterval, setTimeout } from "@deno/shim-timers";
|
|
14
29
|
const dntGlobals = {
|
package/esm/deno.d.ts
CHANGED
|
@@ -403,6 +403,7 @@ declare namespace _default {
|
|
|
403
403
|
"test:unit:cwd-exclusion": string;
|
|
404
404
|
"test:integration": string;
|
|
405
405
|
"test:integration:cli": string;
|
|
406
|
+
"test:local-inference": string;
|
|
406
407
|
"test:record": string;
|
|
407
408
|
"test:coverage": string;
|
|
408
409
|
"test:coverage:unit": string;
|
|
@@ -467,6 +468,7 @@ declare namespace _default {
|
|
|
467
468
|
"lint:sanitizer-baseline": string;
|
|
468
469
|
"lint:skipped-tests": string;
|
|
469
470
|
"lint:cwd-relative-test-reads": string;
|
|
471
|
+
"lint:dnt-meta-properties": string;
|
|
470
472
|
"test:scripts": string;
|
|
471
473
|
"test:sentry-runtime-packages": string;
|
|
472
474
|
"test:tool-search-live": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1234",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -469,7 +469,7 @@ export default {
|
|
|
469
469
|
"build:prepare": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno run -A scripts/build/prepare-framework-sources.ts",
|
|
470
470
|
"build": "deno task build:prepare && deno run -A scripts/build/compile-binary.ts --output ./bin/veryfront",
|
|
471
471
|
"build:proxy-lock": "deno cache --node-modules-dir=none --lock scripts/build/proxy-deno.lock cli/proxy-main.ts",
|
|
472
|
-
"build:npm": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno run --config=scripts/test.deno.json --frozen -A scripts/build/build-npm-dnt.ts",
|
|
472
|
+
"build:npm": "deno run -A scripts/build/generate-integrations-module.ts && deno task generate && deno task lint:dnt-meta-properties && deno run --config=scripts/test.deno.json --frozen -A scripts/build/build-npm-dnt.ts",
|
|
473
473
|
"verify:dist": "deno task build && deno task build:npm",
|
|
474
474
|
"release": "deno run -A scripts/release.ts",
|
|
475
475
|
"test": "deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/testing/preload.ts --no-check --parallel --allow-all '--ignore=tests/e2e,tests/integration/compiled-binary-e2e.test.ts,scripts' --unstable-worker-options --unstable-net",
|
|
@@ -479,6 +479,7 @@ export default {
|
|
|
479
479
|
"test:unit:cwd-exclusion": "DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/testing/preload.ts --no-check --parallel --allow-all --v8-flags=--max-old-space-size=8192 --unstable-worker-options --unstable-net src/testing/cwd-exclusion-a.test.ts src/testing/cwd-exclusion-b.test.ts",
|
|
480
480
|
"test:integration": "deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/testing/preload.ts --no-check --parallel --allow-all '--ignore=tests/e2e,tests/integration/compiled-binary-e2e.test.ts' tests --unstable-worker-options --unstable-net",
|
|
481
481
|
"test:integration:cli": "DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --no-check --parallel --allow-all --unstable-worker-options --unstable-net $(find cli -name '*.integration.test.ts')",
|
|
482
|
+
"test:local-inference": "deno run -A src/provider/_openai-compatible-smoke-test.ts",
|
|
482
483
|
"test:record": "VCR=record deno test --no-check --allow-all $(find cli -name '*.integration.test.ts' -path '*/commands/*')",
|
|
483
484
|
"test:coverage": "rm -rf coverage && deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/testing/preload.ts --no-check --parallel --fail-fast --allow-all --v8-flags=--max-old-space-size=8192 --coverage=coverage '--ignore=tests/integration/compiled-binary-e2e.test.ts' --unstable-worker-options --unstable-net || exit 1",
|
|
484
485
|
"test:coverage:unit": "rm -rf coverage && deno task generate && DENO_TESTING=1 VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --preload=src/testing/preload.ts --no-check --parallel --fail-fast --allow-all --v8-flags=--max-old-space-size=8192 --coverage=coverage '--ignore=tests,src/workflow/__tests__' --unstable-worker-options --unstable-net $(find src cli templates -name '*.test.ts*' ! -name '*.integration.test.ts*') || exit 1",
|
|
@@ -494,10 +495,10 @@ export default {
|
|
|
494
495
|
"storybook": "npm --prefix storybook run storybook",
|
|
495
496
|
"build:storybook": "npm --prefix storybook run build-storybook",
|
|
496
497
|
"storybook:check": "deno test --no-lock --config=scripts/test.deno.json --no-check --allow-read scripts/storybook/storybook-workbench.test.ts",
|
|
497
|
-
"lint": "DENO_NO_PACKAGE_JSON=1 deno lint && deno lint --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/npm-package-metadata.test.ts scripts/build/prepare-framework-sources.test.ts && deno lint --config=scripts/codemods/deno.json scripts/codemods/",
|
|
498
|
-
"lint:ci": "deno task lint && deno task lint:core-deps && deno task lint:cross-runtime-jsr && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:chat-ratchets && deno task lint:chat-composability && deno task lint:rfc-status && deno task lint:esm-sh-codemod && deno task lint:test-typecheck && deno task lint:cwd-relative-test-reads && deno task storybook:check && deno task docs:api-reference:check && deno task docs:errors:check && deno task docs:public:check && deno test --frozen --config=scripts/test.deno.json --no-check --allow-read --allow-write --allow-run=bash scripts/ci/setup-deno-workflow.test.ts scripts/ci/prepare-rc-build.test.ts scripts/build/generated-artifact-checks.test.ts",
|
|
499
|
-
"fmt": "deno fmt src/ cli/ react/ templates/ && deno fmt --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/prepare-framework-sources.test.ts && deno fmt --config=scripts/codemods/deno.json scripts/codemods/",
|
|
500
|
-
"fmt:check": "deno fmt --check src/ cli/ react/ templates/ && deno fmt --check --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/prepare-framework-sources.test.ts && deno fmt --check --config=scripts/codemods/deno.json scripts/codemods/",
|
|
498
|
+
"lint": "DENO_NO_PACKAGE_JSON=1 deno lint && deno lint --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-meta-property-safety.ts scripts/build/dnt-meta-property-safety.test.ts scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/npm-package-metadata.test.ts scripts/build/prepare-framework-sources.test.ts && deno lint --config=scripts/codemods/deno.json scripts/codemods/",
|
|
499
|
+
"lint:ci": "deno task lint && deno task lint:core-deps && deno task lint:cross-runtime-jsr && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:chat-ratchets && deno task lint:chat-composability && deno task lint:rfc-status && deno task lint:esm-sh-codemod && deno task lint:test-typecheck && deno task lint:cwd-relative-test-reads && deno task lint:dnt-meta-properties && deno task storybook:check && deno task docs:api-reference:check && deno task docs:errors:check && deno task docs:public:check && deno test --frozen --config=scripts/test.deno.json --no-check --allow-read --allow-write --allow-run=bash scripts/ci/setup-deno-workflow.test.ts scripts/ci/prepare-rc-build.test.ts scripts/build/generated-artifact-checks.test.ts",
|
|
500
|
+
"fmt": "deno fmt src/ cli/ react/ templates/ && deno fmt --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-meta-property-safety.ts scripts/build/dnt-meta-property-safety.test.ts scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/prepare-framework-sources.test.ts && deno fmt --config=scripts/codemods/deno.json scripts/codemods/",
|
|
501
|
+
"fmt:check": "deno fmt --check src/ cli/ react/ templates/ && deno fmt --check --config=scripts/test.deno.json scripts/test/ scripts/build/dnt-meta-property-safety.ts scripts/build/dnt-meta-property-safety.test.ts scripts/build/dnt-polyfill.ts scripts/build/dnt-polyfill.test.ts scripts/build/prepare-framework-sources.test.ts && deno fmt --check --config=scripts/codemods/deno.json scripts/codemods/",
|
|
501
502
|
"typecheck": "deno task generate:manifests:check && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/html/hydration-script-builder/runtime/main.ts src/modules/index.ts src/proxy/main.ts src/react/components/ui/index.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/eval/index.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/runs/index.ts src/mcp/index.ts src/provider/index.ts",
|
|
502
503
|
"verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:rfc-status && deno task lint:chat-ratchets && deno task lint:esm-sh-codemod && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:cwd-relative-test-reads && deno task lint:core-deps && deno task lint:cross-runtime-jsr && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:api-reference:check && deno task docs:errors:check && deno task docs:validate && deno task typecheck && deno task typecheck:consumer && deno task test && deno task test:scripts && deno task test:e2e:binary",
|
|
503
504
|
"verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:rfc-status && deno task lint:chat-ratchets && deno task lint:esm-sh-codemod && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:cwd-relative-test-reads && deno task lint:core-deps && deno task lint:cross-runtime-jsr && deno task lint:dependency-boundaries && deno task lint:module-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:api-reference:check && deno task docs:errors:check && deno task docs:validate && deno task typecheck",
|
|
@@ -543,7 +544,8 @@ export default {
|
|
|
543
544
|
"lint:sanitizer-baseline": "deno run --allow-read scripts/lint/check-sanitizer-baseline.ts",
|
|
544
545
|
"lint:skipped-tests": "deno run --allow-read scripts/lint/check-skipped-tests-baseline.ts",
|
|
545
546
|
"lint:cwd-relative-test-reads": "deno run --allow-read scripts/lint/audit-cwd-relative-test-reads.ts",
|
|
546
|
-
"
|
|
547
|
+
"lint:dnt-meta-properties": "deno run --config=scripts/test.deno.json --frozen --allow-read scripts/build/dnt-meta-property-safety.ts",
|
|
548
|
+
"test:scripts": "deno test --config=scripts/test.deno.json --no-check --allow-read --allow-write --allow-run scripts/ci/prepare-rc-build.test.ts scripts/ci/publish-npm-packages.test.ts scripts/ci/setup-deno-workflow.test.ts scripts/build/compile-binary.test.ts scripts/build/dnt-meta-property-safety.test.ts scripts/build/dnt-polyfill.test.ts scripts/build/generate-sbom.test.ts scripts/build/generated-artifact-checks.test.ts scripts/build/npm-dependency-sources.test.ts scripts/build/npm-extension-package-metadata.test.ts scripts/build/npm-package-metadata.test.ts scripts/build/npm-react-shims.test.ts scripts/build/npm-runtime-helper-contract.test.ts scripts/build/prepare-framework-sources.test.ts scripts/docs/docs-coverage.test.ts scripts/docs/generate-api-reference.test.ts scripts/docs/guide-validation.test.ts scripts/lint/audit-chat-composability.test.ts scripts/lint/audit-rfc-status.test.ts scripts/lint/audit-core-deps.test.ts scripts/lint/audit-cwd-relative-test-reads.test.ts scripts/lint/audit-cross-runtime-jsr.test.ts scripts/lint/audit-dependency-boundaries.test.ts scripts/lint/audit-extension-capabilities.test.ts scripts/lint/audit-extension-contracts.test.ts scripts/lint/audit-deps.test.ts scripts/lint/check-module-boundaries.test.ts scripts/lint/lint-config.test.ts scripts/lint/ban-test-only.test.ts scripts/lint/check-sanitizer-baseline.test.ts scripts/lint/check-skipped-tests-baseline.test.ts scripts/lint/check-test-typecheck-baseline.test.ts scripts/lint/check-coverage.test.ts scripts/security/audit-npm.test.ts scripts/security/submit-dependency-snapshot.test.ts scripts/test/template-runtime-e2e.test.ts && deno task test:tool-search-live",
|
|
547
549
|
"test:sentry-runtime-packages": "deno test --config=scripts/test.deno.json --no-check --no-lock --allow-read --allow-write --allow-run --allow-env=DENO_DIR,HOME,XDG_CACHE_HOME,LOCALAPPDATA,USERPROFILE scripts/build/sentry-runtime-packages.test.ts",
|
|
548
550
|
"test:tool-search-live": "VF_DISABLE_LRU_INTERVAL=1 deno test --no-check -A tests/agent/verify-tool-search-live.test.ts",
|
|
549
551
|
"test:cross-runtime": "deno run --allow-all src/platform/compat/cross-runtime.test.ts",
|
|
@@ -3,6 +3,7 @@ export declare const PLATFORM_ERROR: import("../types.js").RegisteredError;
|
|
|
3
3
|
export declare const ENV_VAR_MISSING: import("../types.js").RegisteredError;
|
|
4
4
|
export declare const PRODUCTION_BUILD_REQUIRED: import("../types.js").RegisteredError;
|
|
5
5
|
export declare const ENVIRONMENT_NOT_FOUND: import("../types.js").RegisteredError;
|
|
6
|
+
export declare const ENVIRONMENT_NOT_ROUTABLE: import("../types.js").RegisteredError;
|
|
6
7
|
export declare const RELEASE_MISSING_VERSION: import("../types.js").RegisteredError;
|
|
7
8
|
export declare const RELEASE_BUILD_TIMEOUT: import("../types.js").RegisteredError;
|
|
8
9
|
export declare const DEPLOYMENT_VERIFICATION_TIMEOUT: import("../types.js").RegisteredError;
|
|
@@ -10,13 +11,23 @@ export declare const PUSH_RECEIPT_MISSING: import("../types.js").RegisteredError
|
|
|
10
11
|
export declare const SOURCE_DIGEST_MISMATCH: import("../types.js").RegisteredError;
|
|
11
12
|
export declare const PREVIEW_HOSTNAME_TOO_LONG: import("../types.js").RegisteredError;
|
|
12
13
|
export declare const BRANCH_NOT_FOUND: import("../types.js").RegisteredError;
|
|
14
|
+
/**
|
|
15
|
+
* The project's configuration file uses a construct Veryfront Cloud's
|
|
16
|
+
* configuration evaluator can never accept, so the release would answer 500 to
|
|
17
|
+
* every request. Raised before a release is created; the detail names the file,
|
|
18
|
+
* the change that makes the project deployable, and the line when the evaluator
|
|
19
|
+
* located the construct it refused.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CONFIG_NOT_DEPLOYABLE: import("../types.js").RegisteredError;
|
|
13
22
|
/** Registry fragment for DEPLOY errors (slug → definition). */
|
|
14
23
|
export declare const DEPLOY_REGISTRY: {
|
|
24
|
+
readonly "config-not-deployable": import("../types.js").RegisteredError;
|
|
15
25
|
readonly "deployment-error": import("../types.js").RegisteredError;
|
|
16
26
|
readonly "platform-error": import("../types.js").RegisteredError;
|
|
17
27
|
readonly "env-var-missing": import("../types.js").RegisteredError;
|
|
18
28
|
readonly "production-build-required": import("../types.js").RegisteredError;
|
|
19
29
|
readonly "environment-not-found": import("../types.js").RegisteredError;
|
|
30
|
+
readonly "environment-not-routable": import("../types.js").RegisteredError;
|
|
20
31
|
readonly "release-missing-version": import("../types.js").RegisteredError;
|
|
21
32
|
readonly "release-build-timeout": import("../types.js").RegisteredError;
|
|
22
33
|
readonly "deployment-verification-timeout": import("../types.js").RegisteredError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../../src/src/errors/error-registry/deploy.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,uCAM3B,CAAC;AAEH,eAAO,MAAM,cAAc,uCAMzB,CAAC;AAEH,eAAO,MAAM,eAAe,uCAM1B,CAAC;AAEH,eAAO,MAAM,yBAAyB,uCAMpC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,uBAAuB,uCAMlC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,+BAA+B,uCAM1C,CAAC;AAEH,eAAO,MAAM,oBAAoB,uCAM/B,CAAC;AAEH,eAAO,MAAM,sBAAsB,uCAMjC,CAAC;AAEH,eAAO,MAAM,yBAAyB,uCAMpC,CAAC;AAEH,eAAO,MAAM,gBAAgB,uCAM3B,CAAC;AAEH,+DAA+D;AAC/D,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../../src/src/errors/error-registry/deploy.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,uCAM3B,CAAC;AAEH,eAAO,MAAM,cAAc,uCAMzB,CAAC;AAEH,eAAO,MAAM,eAAe,uCAM1B,CAAC;AAEH,eAAO,MAAM,yBAAyB,uCAMpC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,wBAAwB,uCAOnC,CAAC;AAEH,eAAO,MAAM,uBAAuB,uCAMlC,CAAC;AAEH,eAAO,MAAM,qBAAqB,uCAMhC,CAAC;AAEH,eAAO,MAAM,+BAA+B,uCAM1C,CAAC;AAEH,eAAO,MAAM,oBAAoB,uCAM/B,CAAC;AAEH,eAAO,MAAM,sBAAsB,uCAMjC,CAAC;AAEH,eAAO,MAAM,yBAAyB,uCAMpC,CAAC;AAEH,eAAO,MAAM,gBAAgB,uCAM3B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,uCAQhC,CAAC;AAEH,+DAA+D;AAC/D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;CAelB,CAAC"}
|
|
@@ -34,6 +34,13 @@ export const ENVIRONMENT_NOT_FOUND = defineError({
|
|
|
34
34
|
title: "Deployment environment not found",
|
|
35
35
|
suggestion: "Check environment names with: veryfront config",
|
|
36
36
|
});
|
|
37
|
+
export const ENVIRONMENT_NOT_ROUTABLE = defineError({
|
|
38
|
+
slug: "environment-not-routable",
|
|
39
|
+
category: "DEPLOY",
|
|
40
|
+
status: 400,
|
|
41
|
+
title: "Environment name has no Veryfront-hosted address",
|
|
42
|
+
suggestion: "Deploy to preview, staging, or production, or attach a custom domain to this environment in Studio",
|
|
43
|
+
});
|
|
37
44
|
export const RELEASE_MISSING_VERSION = defineError({
|
|
38
45
|
slug: "release-missing-version",
|
|
39
46
|
category: "DEPLOY",
|
|
@@ -83,13 +90,30 @@ export const BRANCH_NOT_FOUND = defineError({
|
|
|
83
90
|
title: "Branch not found",
|
|
84
91
|
suggestion: "List branches in Studio or push a new one with: veryfront push --branch <name>",
|
|
85
92
|
});
|
|
93
|
+
/**
|
|
94
|
+
* The project's configuration file uses a construct Veryfront Cloud's
|
|
95
|
+
* configuration evaluator can never accept, so the release would answer 500 to
|
|
96
|
+
* every request. Raised before a release is created; the detail names the file,
|
|
97
|
+
* the change that makes the project deployable, and the line when the evaluator
|
|
98
|
+
* located the construct it refused.
|
|
99
|
+
*/
|
|
100
|
+
export const CONFIG_NOT_DEPLOYABLE = defineError({
|
|
101
|
+
slug: "config-not-deployable",
|
|
102
|
+
category: "DEPLOY",
|
|
103
|
+
status: 400,
|
|
104
|
+
title: "Configuration cannot be deployed to Veryfront Cloud",
|
|
105
|
+
suggestion: "Veryfront Cloud reads veryfront.config.ts as data: keep it to literals and the veryfront configuration helpers",
|
|
106
|
+
exitCode: 2,
|
|
107
|
+
});
|
|
86
108
|
/** Registry fragment for DEPLOY errors (slug → definition). */
|
|
87
109
|
export const DEPLOY_REGISTRY = {
|
|
110
|
+
"config-not-deployable": CONFIG_NOT_DEPLOYABLE,
|
|
88
111
|
"deployment-error": DEPLOYMENT_ERROR,
|
|
89
112
|
"platform-error": PLATFORM_ERROR,
|
|
90
113
|
"env-var-missing": ENV_VAR_MISSING,
|
|
91
114
|
"production-build-required": PRODUCTION_BUILD_REQUIRED,
|
|
92
115
|
"environment-not-found": ENVIRONMENT_NOT_FOUND,
|
|
116
|
+
"environment-not-routable": ENVIRONMENT_NOT_ROUTABLE,
|
|
93
117
|
"release-missing-version": RELEASE_MISSING_VERSION,
|
|
94
118
|
"release-build-timeout": RELEASE_BUILD_TIMEOUT,
|
|
95
119
|
"deployment-verification-timeout": DEPLOYMENT_VERIFICATION_TIMEOUT,
|
|
@@ -111,11 +111,13 @@ export declare const ERROR_REGISTRY: Readonly<{
|
|
|
111
111
|
readonly "error-overlay-error": import("./types.js").RegisteredError;
|
|
112
112
|
readonly "source-map-error": import("./types.js").RegisteredError;
|
|
113
113
|
} & {
|
|
114
|
+
readonly "config-not-deployable": import("./types.js").RegisteredError;
|
|
114
115
|
readonly "deployment-error": import("./types.js").RegisteredError;
|
|
115
116
|
readonly "platform-error": import("./types.js").RegisteredError;
|
|
116
117
|
readonly "env-var-missing": import("./types.js").RegisteredError;
|
|
117
118
|
readonly "production-build-required": import("./types.js").RegisteredError;
|
|
118
119
|
readonly "environment-not-found": import("./types.js").RegisteredError;
|
|
120
|
+
readonly "environment-not-routable": import("./types.js").RegisteredError;
|
|
119
121
|
readonly "release-missing-version": import("./types.js").RegisteredError;
|
|
120
122
|
readonly "release-build-timeout": import("./types.js").RegisteredError;
|
|
121
123
|
readonly "deployment-verification-timeout": import("./types.js").RegisteredError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-registry.d.ts","sourceRoot":"","sources":["../../../src/src/errors/error-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAgBhD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"error-registry.d.ts","sourceRoot":"","sources":["../../../src/src/errors/error-registry.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAgBhD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY1B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,cAAc,CAAC;AAEpD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,wCAE7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,0CAE1D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,SAAS,EAAE,CAEzC"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import type { FileSystemAdapter } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* Whether `instance` was constructed directly as `constructorRef` rather than as
|
|
4
|
+
* a subclass of it.
|
|
5
|
+
*
|
|
6
|
+
* `new.target === constructorRef` is the natural spelling and cannot be used
|
|
7
|
+
* here: DNT rewrites every meta-property into its `import.meta` ponyfill when it
|
|
8
|
+
* emits the npm package, so in the published build `new.target` is an
|
|
9
|
+
* `ImportMeta`, the comparison is unconditionally false, and no adapter is ever
|
|
10
|
+
* registered (see `scripts/build/dnt-meta-property-safety.ts`).
|
|
11
|
+
*
|
|
12
|
+
* `this.constructor === constructorRef` survives that transform but is
|
|
13
|
+
* forgeable: a subclass that deletes or overwrites its own
|
|
14
|
+
* `prototype.constructor` inherits the base's, so a subclass instance would be
|
|
15
|
+
* classified as a directly constructed built-in.
|
|
16
|
+
*
|
|
17
|
+
* Prototype identity survives the transform and is not forgeable that way. A
|
|
18
|
+
* class's `prototype` is a non-writable, non-configurable own property, and
|
|
19
|
+
* `[[Construct]]` takes the new object's prototype from `new.target.prototype`,
|
|
20
|
+
* so `new Subclass()` always arrives here carrying `Subclass.prototype`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isDirectConstruction(instance: object, constructorRef: {
|
|
23
|
+
readonly prototype: object;
|
|
24
|
+
}): boolean;
|
|
2
25
|
/** Register a directly constructed built-in adapter backed by the host filesystem. */
|
|
3
26
|
export declare function markNativeFileSystemAdapter(adapter: FileSystemAdapter): void;
|
|
4
27
|
/** Return true only for the exact built-in adapter object registered at construction. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-file-system-provenance.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/native-file-system-provenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"native-file-system-provenance.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/adapters/native-file-system-provenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAYnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC7C,OAAO,CAGT;AAED,sFAAsF;AACtF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAE5E;AAED,yFAAyF;AACzF,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAMT"}
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
const IntrinsicWeakSet = WeakSet;
|
|
2
2
|
const ReflectApply = Reflect.apply;
|
|
3
|
+
const ObjectGetPrototypeOf = Object.getPrototypeOf;
|
|
3
4
|
const WeakSetPrototypeAdd = IntrinsicWeakSet.prototype.add;
|
|
4
5
|
const WeakSetPrototypeHas = IntrinsicWeakSet.prototype.has;
|
|
5
6
|
// Exact-object provenance only. Wrappers and proxies must not inherit this
|
|
6
7
|
// classification because they may translate paths into a non-native namespace.
|
|
7
8
|
const nativeFileSystemAdapters = new IntrinsicWeakSet();
|
|
9
|
+
/**
|
|
10
|
+
* Whether `instance` was constructed directly as `constructorRef` rather than as
|
|
11
|
+
* a subclass of it.
|
|
12
|
+
*
|
|
13
|
+
* `new.target === constructorRef` is the natural spelling and cannot be used
|
|
14
|
+
* here: DNT rewrites every meta-property into its `import.meta` ponyfill when it
|
|
15
|
+
* emits the npm package, so in the published build `new.target` is an
|
|
16
|
+
* `ImportMeta`, the comparison is unconditionally false, and no adapter is ever
|
|
17
|
+
* registered (see `scripts/build/dnt-meta-property-safety.ts`).
|
|
18
|
+
*
|
|
19
|
+
* `this.constructor === constructorRef` survives that transform but is
|
|
20
|
+
* forgeable: a subclass that deletes or overwrites its own
|
|
21
|
+
* `prototype.constructor` inherits the base's, so a subclass instance would be
|
|
22
|
+
* classified as a directly constructed built-in.
|
|
23
|
+
*
|
|
24
|
+
* Prototype identity survives the transform and is not forgeable that way. A
|
|
25
|
+
* class's `prototype` is a non-writable, non-configurable own property, and
|
|
26
|
+
* `[[Construct]]` takes the new object's prototype from `new.target.prototype`,
|
|
27
|
+
* so `new Subclass()` always arrives here carrying `Subclass.prototype`.
|
|
28
|
+
*/
|
|
29
|
+
export function isDirectConstruction(instance, constructorRef) {
|
|
30
|
+
return ReflectApply(ObjectGetPrototypeOf, undefined, [instance]) ===
|
|
31
|
+
constructorRef.prototype;
|
|
32
|
+
}
|
|
8
33
|
/** Register a directly constructed built-in adapter backed by the host filesystem. */
|
|
9
34
|
export function markNativeFileSystemAdapter(adapter) {
|
|
10
35
|
ReflectApply(WeakSetPrototypeAdd, nativeFileSystemAdapters, [adapter]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/deno/filesystem-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAGR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/deno/filesystem-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAGR,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AAcvB,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAE9C,UAAU,c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CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKrC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKtC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKvC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKlD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW;CAoGrE;AAED,MAAM,WAAW,qBAAqB;IACpC,2BAA2B,CAAC,CAC1B,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,wBAAwB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E"}
|
|
@@ -4,7 +4,7 @@ import { createFileWatcher } from "../shared/watcher-queue.js";
|
|
|
4
4
|
import { resolve, sep } from "../../../compat/path/index.js";
|
|
5
5
|
import { validateTempDirectoryPrefix } from "../../../compat/temp-directory-prefix.js";
|
|
6
6
|
import { readBoundedFilePrefix, readFileWithinLimit, withFileHandle, } from "../../bounded-file-read.js";
|
|
7
|
-
import { markNativeFileSystemAdapter } from "../../native-file-system-provenance.js";
|
|
7
|
+
import { isDirectConstruction, markNativeFileSystemAdapter, } from "../../native-file-system-provenance.js";
|
|
8
8
|
import { NodeCompatibleFileSystemAdapter, } from "../shared/node-filesystem-adapter.js";
|
|
9
9
|
function hasOwn(value, property) {
|
|
10
10
|
return Object.prototype.hasOwnProperty.call(value, property);
|
|
@@ -100,7 +100,7 @@ export class DenoFileSystemAdapter {
|
|
|
100
100
|
enumerable: true,
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
103
|
+
if (isDirectConstruction(this, DenoFileSystemAdapter)) {
|
|
104
104
|
markNativeFileSystemAdapter(this);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-filesystem-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/shared/node-filesystem-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAER,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAA4C,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"node-filesystem-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/shared/node-filesystem-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EAER,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAA4C,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiBnG,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAGvC,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GA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
|
import { isProxyWithoutHooks } from "../../../compat/error-introspection.js";
|
|
5
5
|
import { isCanonicalNotFoundError } from "../../../compat/not-found-error.js";
|
|
6
6
|
import { readBoundedFilePrefix, readFileWithinLimit, withFileHandle, } from "../../bounded-file-read.js";
|
|
7
|
-
import { markNativeFileSystemAdapter } from "../../native-file-system-provenance.js";
|
|
7
|
+
import { isDirectConstruction, markNativeFileSystemAdapter, } from "../../native-file-system-provenance.js";
|
|
8
8
|
import { constants as nodeFsConstants } from "node:fs";
|
|
9
9
|
import { resolve } from "../../../compat/path/index.js";
|
|
10
10
|
import { runtimeUsesWindowsPaths } from "../../../compat/path/portable.js";
|
|
@@ -283,7 +283,7 @@ export class NodeCompatibleFileSystemAdapter {
|
|
|
283
283
|
enumerable: true,
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
286
|
+
if (isDirectConstruction(this, NodeCompatibleFileSystemAdapter)) {
|
|
287
287
|
markNativeFileSystemAdapter(this);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
@@ -17,6 +17,10 @@ export declare function getHostEnv(key: string): string | undefined;
|
|
|
17
17
|
* Kept out of the public process barrel so project code cannot replace the
|
|
18
18
|
* callback through a supported package export. Re-registering a different
|
|
19
19
|
* function is rejected rather than silently widening an isolation boundary.
|
|
20
|
+
*
|
|
21
|
+
* Registering the bridge also installs the matching view over `process.env`, so
|
|
22
|
+
* the raw environment object and `getEnv()` are scoped by the same act and
|
|
23
|
+
* cannot drift apart.
|
|
20
24
|
*/
|
|
21
25
|
export declare function registerTrustedProjectEnvSnapshot(getter: () => ProjectEnvSnapshot | undefined): void;
|
|
22
26
|
/** Return the active server-owned project env snapshot, if registered. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/env.ts"],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YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;AAapE,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,UAAQ,EAChB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAmBT;AAED,gBAAgB;AAChB,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAiBvD;AAED,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAiB3C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,GAAG,IAAI,CAS/D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
2
|
import { getDenoRuntime, isDeno as IS_DENO } from "../runtime.js";
|
|
3
|
-
import { runtimeProcess } from "./runtime-process.js";
|
|
3
|
+
import { hostProcessEnv, runtimeProcess } from "./runtime-process.js";
|
|
4
|
+
import { installProjectScopedProcessEnv, projectScopedEnvRecord, readProjectScopedEnv, } from "./scoped-process-env.js";
|
|
4
5
|
function getEnvOverlayStore() {
|
|
5
6
|
const storage = getEnvOverlayStorage();
|
|
6
7
|
const store = storage?.getStore();
|
|
@@ -15,11 +16,19 @@ function getOverlayEnvValue(store, key) {
|
|
|
15
16
|
}
|
|
16
17
|
/** Read and write process environment variables. */
|
|
17
18
|
export function env() {
|
|
19
|
+
const projectEnv = getTrustedProjectEnvSnapshot();
|
|
20
|
+
// Same rule as getEnv(): while a project scope is active its snapshot is the
|
|
21
|
+
// whole environment, so the bulk accessor cannot report a wider set of
|
|
22
|
+
// variables than the single-key one. Built from the scoped view rather than
|
|
23
|
+
// the raw snapshot, so a write the raw object has already accepted is not
|
|
24
|
+
// missing here.
|
|
25
|
+
if (projectEnv !== undefined)
|
|
26
|
+
return projectScopedEnvRecord(projectEnv);
|
|
18
27
|
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
19
28
|
const base = deno
|
|
20
29
|
? deno.env.toObject()
|
|
21
|
-
:
|
|
22
|
-
? { ...
|
|
30
|
+
: hostProcessEnv
|
|
31
|
+
? { ...hostProcessEnv }
|
|
23
32
|
: {};
|
|
24
33
|
const overlay = getEnvOverlayStore();
|
|
25
34
|
if (!overlay)
|
|
@@ -56,8 +65,11 @@ export function getHostEnv(key) {
|
|
|
56
65
|
return undefined;
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
|
-
|
|
60
|
-
|
|
68
|
+
// Read the captured host record rather than `runtimeProcess.env`, so the
|
|
69
|
+
// narrower view installed over `process.env` cannot redirect a host-scoped
|
|
70
|
+
// read back into a project scope.
|
|
71
|
+
if (hostProcessEnv)
|
|
72
|
+
return hostProcessEnv[key];
|
|
61
73
|
return undefined;
|
|
62
74
|
}
|
|
63
75
|
let _trustedProjectEnvSnapshot = null;
|
|
@@ -67,12 +79,17 @@ let _trustedProjectEnvSnapshot = null;
|
|
|
67
79
|
* Kept out of the public process barrel so project code cannot replace the
|
|
68
80
|
* callback through a supported package export. Re-registering a different
|
|
69
81
|
* function is rejected rather than silently widening an isolation boundary.
|
|
82
|
+
*
|
|
83
|
+
* Registering the bridge also installs the matching view over `process.env`, so
|
|
84
|
+
* the raw environment object and `getEnv()` are scoped by the same act and
|
|
85
|
+
* cannot drift apart.
|
|
70
86
|
*/
|
|
71
87
|
export function registerTrustedProjectEnvSnapshot(getter) {
|
|
72
88
|
if (_trustedProjectEnvSnapshot && _trustedProjectEnvSnapshot !== getter) {
|
|
73
89
|
throw new Error("Project environment snapshot bridge is already registered");
|
|
74
90
|
}
|
|
75
91
|
_trustedProjectEnvSnapshot = getter;
|
|
92
|
+
installProjectScopedProcessEnv(getTrustedProjectEnvSnapshot);
|
|
76
93
|
}
|
|
77
94
|
/** Return the active server-owned project env snapshot, if registered. */
|
|
78
95
|
export function getTrustedProjectEnvSnapshot() {
|
|
@@ -85,8 +102,9 @@ export function getEnv(key) {
|
|
|
85
102
|
// The registered snapshot is authoritative even when the requested key is
|
|
86
103
|
// absent. Falling through here would expose host process configuration to
|
|
87
104
|
// a remote project. Never discover this boundary through replaceable
|
|
88
|
-
// globalThis hooks.
|
|
89
|
-
|
|
105
|
+
// globalThis hooks. Reads go through the scoped view so this accessor and
|
|
106
|
+
// the raw object resolve a key by the same rule, writes included.
|
|
107
|
+
return readProjectScopedEnv(projectEnv, key);
|
|
90
108
|
}
|
|
91
109
|
return getHostEnv(key);
|
|
92
110
|
}
|
|
@@ -6,5 +6,13 @@ export type RuntimeProcess = typeof import("node:process");
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function testHasRuntimeProcess(processLike: unknown): processLike is RuntimeProcess;
|
|
8
8
|
export declare const runtimeProcess: RuntimeProcess | null;
|
|
9
|
+
/**
|
|
10
|
+
* The host environment record, captured before any narrower view is installed
|
|
11
|
+
* over `process.env`.
|
|
12
|
+
*
|
|
13
|
+
* Host-scoped accessors read through this reference so that installing a
|
|
14
|
+
* scoped view over `process.env` cannot redirect them.
|
|
15
|
+
*/
|
|
16
|
+
export declare const hostProcessEnv: RuntimeProcess["env"] | null;
|
|
9
17
|
export declare function isWindowsPlatform(): boolean;
|
|
10
18
|
//# sourceMappingURL=runtime-process.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-process.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/runtime-process.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,cAAc,cAAc,CAAC,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,cAAc,CAIzF;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,GAAG,IAEtC,CAAC;AAET,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
|
|
1
|
+
{"version":3,"file":"runtime-process.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/runtime-process.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,cAAc,cAAc,CAAC,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,cAAc,CAIzF;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,GAAG,IAEtC,CAAC;AAET;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,IAAkC,CAAC;AAExF,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
|
|
@@ -15,6 +15,14 @@ export function testHasRuntimeProcess(processLike) {
|
|
|
15
15
|
export const runtimeProcess = testHasRuntimeProcess(nodeProcess)
|
|
16
16
|
? nodeProcess
|
|
17
17
|
: null;
|
|
18
|
+
/**
|
|
19
|
+
* The host environment record, captured before any narrower view is installed
|
|
20
|
+
* over `process.env`.
|
|
21
|
+
*
|
|
22
|
+
* Host-scoped accessors read through this reference so that installing a
|
|
23
|
+
* scoped view over `process.env` cannot redirect them.
|
|
24
|
+
*/
|
|
25
|
+
export const hostProcessEnv = runtimeProcess?.env ?? null;
|
|
18
26
|
export function isWindowsPlatform() {
|
|
19
27
|
const deno = IS_DENO ? getDenoRuntime() : undefined;
|
|
20
28
|
if (deno)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProjectEnvSnapshot } from "./project-env-contract.js";
|
|
2
|
+
/** Returns the active project environment snapshot, or undefined outside one. */
|
|
3
|
+
export type ProjectEnvSnapshotGetter = () => ProjectEnvSnapshot | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Read a key as the scoped view presents it: snapshot entry, then any write
|
|
6
|
+
* recorded against that snapshot.
|
|
7
|
+
*
|
|
8
|
+
* Exported so the accessors (`getEnv()`, `env()`) resolve keys through exactly
|
|
9
|
+
* the same rule as the raw object, instead of reading the immutable snapshot
|
|
10
|
+
* and missing writes the object has already accepted.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readProjectScopedEnv(snapshot: ProjectEnvSnapshot, key: string): string | undefined;
|
|
13
|
+
/** The scoped view as a plain record, for the bulk accessor. */
|
|
14
|
+
export declare function projectScopedEnvRecord(snapshot: ProjectEnvSnapshot): Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Install the project-scoped view over `process.env`.
|
|
17
|
+
*
|
|
18
|
+
* Idempotent: the first installation owns the view for the process lifetime, so
|
|
19
|
+
* the record captured as the host view is always the pre-installation one.
|
|
20
|
+
* Outside a project scope every operation passes straight through to it.
|
|
21
|
+
*
|
|
22
|
+
* The view is installed as a non-configurable accessor, so code running later
|
|
23
|
+
* cannot detach it by assigning to or redefining `process.env` — an assignment
|
|
24
|
+
* is applied through the view (see `applyEnvReplacement`) rather than replacing
|
|
25
|
+
* it. Without that, one assignment would drop the view for every scope in the
|
|
26
|
+
* process, not only the one that made it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function installProjectScopedProcessEnv(getSnapshot: ProjectEnvSnapshotGetter): void;
|
|
29
|
+
//# sourceMappingURL=scoped-process-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoped-process-env.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/scoped-process-env.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,iFAAiF;AACjF,MAAM,MAAM,wBAAwB,GAAG,MAAM,kBAAkB,GAAG,SAAS,CAAC;AA0B5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAEpB;AAED,gEAAgE;AAChE,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAyID;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,wBAAwB,GACpC,IAAI,CAqBN"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-scoped view of the raw process environment object.
|
|
3
|
+
*
|
|
4
|
+
* A project environment snapshot is the complete environment a project sees.
|
|
5
|
+
* `getEnv()` already serves that snapshot and nothing else while it is active,
|
|
6
|
+
* but `process.env` is an ordinary object reachable without going through any
|
|
7
|
+
* accessor, so the two surfaces disagreed about what the project environment
|
|
8
|
+
* contains. Installing this view makes them agree.
|
|
9
|
+
*
|
|
10
|
+
* Host-scoped configuration keeps its own accessor (`getHostEnv()`), which
|
|
11
|
+
* reads the captured host record and is unaffected by the installed view.
|
|
12
|
+
*
|
|
13
|
+
* Writes made while a snapshot is active are recorded per snapshot, so a
|
|
14
|
+
* project scope observes its own mutations and nothing outside it does.
|
|
15
|
+
*
|
|
16
|
+
* @module platform/compat/process/scoped-process-env
|
|
17
|
+
*/
|
|
18
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
19
|
+
const ObjectKeys = Object.keys;
|
|
20
|
+
const ObjectDefineProperty = Object.defineProperty;
|
|
21
|
+
const ReflectDefineProperty = Reflect.defineProperty;
|
|
22
|
+
const ReflectDeleteProperty = Reflect.deleteProperty;
|
|
23
|
+
const ReflectGet = Reflect.get;
|
|
24
|
+
const ReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor;
|
|
25
|
+
const ReflectHas = Reflect.has;
|
|
26
|
+
const ReflectOwnKeys = Reflect.ownKeys;
|
|
27
|
+
const ReflectSet = Reflect.set;
|
|
28
|
+
// Keyed by the snapshot object, which the scope owns for exactly its lifetime.
|
|
29
|
+
const writesBySnapshot = new WeakMap();
|
|
30
|
+
function writesFor(snapshot) {
|
|
31
|
+
const existing = writesBySnapshot.get(snapshot);
|
|
32
|
+
if (existing)
|
|
33
|
+
return existing;
|
|
34
|
+
const created = new Map();
|
|
35
|
+
writesBySnapshot.set(snapshot, created);
|
|
36
|
+
return created;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Read a key as the scoped view presents it: snapshot entry, then any write
|
|
40
|
+
* recorded against that snapshot.
|
|
41
|
+
*
|
|
42
|
+
* Exported so the accessors (`getEnv()`, `env()`) resolve keys through exactly
|
|
43
|
+
* the same rule as the raw object, instead of reading the immutable snapshot
|
|
44
|
+
* and missing writes the object has already accepted.
|
|
45
|
+
*/
|
|
46
|
+
export function readProjectScopedEnv(snapshot, key) {
|
|
47
|
+
return readScoped(snapshot, key);
|
|
48
|
+
}
|
|
49
|
+
/** The scoped view as a plain record, for the bulk accessor. */
|
|
50
|
+
export function projectScopedEnvRecord(snapshot) {
|
|
51
|
+
const record = {};
|
|
52
|
+
for (const key of scopedKeys(snapshot)) {
|
|
53
|
+
const value = readScoped(snapshot, key);
|
|
54
|
+
if (value !== undefined)
|
|
55
|
+
record[key] = value;
|
|
56
|
+
}
|
|
57
|
+
return record;
|
|
58
|
+
}
|
|
59
|
+
function readScoped(snapshot, key) {
|
|
60
|
+
const writes = writesBySnapshot.get(snapshot);
|
|
61
|
+
if (writes?.has(key)) {
|
|
62
|
+
const written = writes.get(key);
|
|
63
|
+
return written === null ? undefined : written;
|
|
64
|
+
}
|
|
65
|
+
const value = snapshot[key];
|
|
66
|
+
return typeof value === "string" ? value : undefined;
|
|
67
|
+
}
|
|
68
|
+
function scopedKeys(snapshot) {
|
|
69
|
+
const keys = new Set(ObjectKeys(snapshot));
|
|
70
|
+
const writes = writesBySnapshot.get(snapshot);
|
|
71
|
+
if (writes) {
|
|
72
|
+
for (const [key, value] of writes) {
|
|
73
|
+
if (value === null)
|
|
74
|
+
keys.delete(key);
|
|
75
|
+
else
|
|
76
|
+
keys.add(key);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return [...keys];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Reject descriptors the raw environment object never accepts.
|
|
83
|
+
*
|
|
84
|
+
* Both Node and Deno back `process.env` with an object that only takes a
|
|
85
|
+
* configurable, writable, enumerable data descriptor and throws a `TypeError`
|
|
86
|
+
* for anything else. Recording the value instead would let the view report a
|
|
87
|
+
* property shape the host object would have refused, which is the kind of
|
|
88
|
+
* disagreement between the two surfaces this module exists to remove.
|
|
89
|
+
*/
|
|
90
|
+
function assertEnvDataDescriptor(descriptor) {
|
|
91
|
+
if ("get" in descriptor || "set" in descriptor) {
|
|
92
|
+
throw new TypeError("'process.env' does not accept an accessor(getter/setter) descriptor");
|
|
93
|
+
}
|
|
94
|
+
if (!("value" in descriptor) || descriptor.writable !== true ||
|
|
95
|
+
descriptor.enumerable !== true || descriptor.configurable !== true) {
|
|
96
|
+
throw new TypeError("'process.env' only accepts a configurable, writable, and enumerable data descriptor");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function createHandler(getSnapshot) {
|
|
100
|
+
/** Resolve the snapshot for a string key, or undefined to defer to the host record. */
|
|
101
|
+
const scopeFor = (prop) => typeof prop === "string" ? getSnapshot() : undefined;
|
|
102
|
+
return {
|
|
103
|
+
get(target, prop) {
|
|
104
|
+
const snapshot = scopeFor(prop);
|
|
105
|
+
if (!snapshot)
|
|
106
|
+
return ReflectGet(target, prop);
|
|
107
|
+
return readScoped(snapshot, prop);
|
|
108
|
+
},
|
|
109
|
+
set(target, prop, value) {
|
|
110
|
+
const snapshot = scopeFor(prop);
|
|
111
|
+
if (!snapshot)
|
|
112
|
+
return ReflectSet(target, prop, value);
|
|
113
|
+
writesFor(snapshot).set(prop, String(value));
|
|
114
|
+
return true;
|
|
115
|
+
},
|
|
116
|
+
deleteProperty(target, prop) {
|
|
117
|
+
const snapshot = scopeFor(prop);
|
|
118
|
+
if (!snapshot)
|
|
119
|
+
return ReflectDeleteProperty(target, prop);
|
|
120
|
+
writesFor(snapshot).set(prop, null);
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
has(target, prop) {
|
|
124
|
+
const snapshot = scopeFor(prop);
|
|
125
|
+
if (!snapshot)
|
|
126
|
+
return ReflectHas(target, prop);
|
|
127
|
+
return readScoped(snapshot, prop) !== undefined;
|
|
128
|
+
},
|
|
129
|
+
ownKeys(target) {
|
|
130
|
+
const snapshot = getSnapshot();
|
|
131
|
+
if (!snapshot)
|
|
132
|
+
return ReflectOwnKeys(target);
|
|
133
|
+
return scopedKeys(snapshot);
|
|
134
|
+
},
|
|
135
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
136
|
+
const snapshot = scopeFor(prop);
|
|
137
|
+
if (!snapshot)
|
|
138
|
+
return ReflectGetOwnPropertyDescriptor(target, prop);
|
|
139
|
+
const value = readScoped(snapshot, prop);
|
|
140
|
+
if (value === undefined)
|
|
141
|
+
return undefined;
|
|
142
|
+
return { value, writable: true, enumerable: true, configurable: true };
|
|
143
|
+
},
|
|
144
|
+
defineProperty(target, prop, descriptor) {
|
|
145
|
+
const snapshot = scopeFor(prop);
|
|
146
|
+
if (!snapshot)
|
|
147
|
+
return ReflectDefineProperty(target, prop, descriptor);
|
|
148
|
+
assertEnvDataDescriptor(descriptor);
|
|
149
|
+
writesFor(snapshot).set(prop, String(descriptor.value));
|
|
150
|
+
return true;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Apply `process.env = record` without giving up the installed view.
|
|
156
|
+
*
|
|
157
|
+
* A plain assignment would swap the object identity and drop the view for the
|
|
158
|
+
* whole process, so the property is an accessor and assignment is applied
|
|
159
|
+
* through the view instead:
|
|
160
|
+
*
|
|
161
|
+
* - Inside a project scope the result is contained to that scope, so the
|
|
162
|
+
* replacement is applied exactly: keys the assigned record omits are masked.
|
|
163
|
+
* - Outside one, the record is the host's and is shared with child processes,
|
|
164
|
+
* so entries are merged and nothing is removed. `process.env = {...}` at host
|
|
165
|
+
* level therefore adds and overwrites but never clears.
|
|
166
|
+
*/
|
|
167
|
+
function applyEnvReplacement(view, getSnapshot, replacement) {
|
|
168
|
+
// `process.env = process.env` is an identity assignment; clearing first would
|
|
169
|
+
// turn it into a wipe.
|
|
170
|
+
if (replacement === view)
|
|
171
|
+
return;
|
|
172
|
+
if (getSnapshot() !== undefined) {
|
|
173
|
+
for (const key of ObjectKeys(view))
|
|
174
|
+
delete view[key];
|
|
175
|
+
}
|
|
176
|
+
if (replacement === null || typeof replacement !== "object")
|
|
177
|
+
return;
|
|
178
|
+
for (const key of ObjectKeys(replacement)) {
|
|
179
|
+
const value = replacement[key];
|
|
180
|
+
if (value === undefined)
|
|
181
|
+
continue;
|
|
182
|
+
view[key] = value;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
let installed = false;
|
|
186
|
+
/**
|
|
187
|
+
* Install the project-scoped view over `process.env`.
|
|
188
|
+
*
|
|
189
|
+
* Idempotent: the first installation owns the view for the process lifetime, so
|
|
190
|
+
* the record captured as the host view is always the pre-installation one.
|
|
191
|
+
* Outside a project scope every operation passes straight through to it.
|
|
192
|
+
*
|
|
193
|
+
* The view is installed as a non-configurable accessor, so code running later
|
|
194
|
+
* cannot detach it by assigning to or redefining `process.env` — an assignment
|
|
195
|
+
* is applied through the view (see `applyEnvReplacement`) rather than replacing
|
|
196
|
+
* it. Without that, one assignment would drop the view for every scope in the
|
|
197
|
+
* process, not only the one that made it.
|
|
198
|
+
*/
|
|
199
|
+
export function installProjectScopedProcessEnv(getSnapshot) {
|
|
200
|
+
if (installed)
|
|
201
|
+
return;
|
|
202
|
+
const processLike = dntShim.dntGlobalThis.process;
|
|
203
|
+
const hostEnv = processLike?.env;
|
|
204
|
+
if (!processLike || !hostEnv)
|
|
205
|
+
return;
|
|
206
|
+
installed = true;
|
|
207
|
+
const view = new Proxy(hostEnv, createHandler(getSnapshot));
|
|
208
|
+
try {
|
|
209
|
+
ObjectDefineProperty(processLike, "env", {
|
|
210
|
+
get: () => view,
|
|
211
|
+
set: (replacement) => applyEnvReplacement(view, getSnapshot, replacement),
|
|
212
|
+
enumerable: true,
|
|
213
|
+
configurable: false,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// A runtime that refuses to redefine the property still gets the view; it
|
|
218
|
+
// just keeps the weaker guarantee a plain assignment gives.
|
|
219
|
+
processLike.env = view;
|
|
220
|
+
}
|
|
221
|
+
}
|
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.1234",
|
|
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.1234"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|