reactive-md 0.9.0 → 0.9.2
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/CHANGELOG-ch.md +333 -306
- package/CHANGELOG.md +334 -307
- package/CONTRIBUTING-ch.md +22 -22
- package/CONTRIBUTING.md +22 -22
- package/README-ch.md +431 -431
- package/README-en.md +431 -431
- package/README.md +429 -429
- package/SECURITY-ch.md +83 -83
- package/SECURITY.md +83 -83
- package/THIRD_PARTY_NOTICES.md +111 -1
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +263 -263
- package/cli/assets.mjs +395 -395
- package/cli/build.mjs +445 -444
- package/cli/check.mjs +444 -444
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +323 -323
- package/cli/init.mjs +1577 -1577
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +65 -65
- package/cli/migrate.mjs +368 -368
- package/cli/package-loader.mjs +41 -41
- package/cli/package.mjs +211 -211
- package/dist-library/{LocalDocumentView-K7Y-2bRJ.js → LocalDocumentView-BuqgJZEY.js} +11 -11
- package/dist-library/LocalDocumentViewCore-DXE0I0Qc.js +9830 -0
- package/dist-library/LocalReactiveDocumentCore-CWBe4Mm5.js +275 -0
- package/dist-library/{authoring-Co_TiE-P.js → authoring-Ci_KzJ0q.js} +87 -67
- package/dist-library/{compile-LhpTKqCR.js → compile-Dx6Uw3D9.js} +11 -11
- package/dist-library/{compiler-core-DTxY-qYz.js → compiler-core-DDDdvuLy.js} +2618 -1846
- package/dist-library/compiler-dxLPB9Ym.js +86 -0
- package/dist-library/{component-state-BBJ08vML.js → component-state-BRwvTV0d.js} +15 -14
- package/dist-library/component-state-CwKX_SN5.js +763 -0
- package/dist-library/{config-BUo-8O5C.js → config-DXLvctiZ.js} +68 -66
- package/dist-library/config-validation-D3D7Dy2J.js +586 -0
- package/dist-library/{controls-BWiLLtBO.js → controls-DoZyLCrV.js} +2434 -2410
- package/dist-library/{coordinate-BSl6enWV.js → coordinate-B1VFK9fd.js} +108 -107
- package/dist-library/{data-table-DfvytZKQ.js → data-table-8-3F15Jf.js} +69 -66
- package/dist-library/{default-components-BwQf0oP-.js → default-components-s21NevON.js} +29 -28
- package/dist-library/{display-lw3BT1TA.js → display-B_uutKkN.js} +1 -1
- package/dist-library/{config-validation-C5kJYk-J.js → document-theme-C8J6UyNO.js} +241 -731
- package/dist-library/export-CIAIPBov.js +370 -0
- package/dist-library/{gallery-B8kSt1oI.js → gallery-Dv1rOvL0.js} +151 -147
- package/dist-library/html-Cr4CBwAH.js +758 -0
- package/dist-library/identity-BUx0Q_-d.js +40 -0
- package/dist-library/{incremental-D_6vwAAE.js → incremental-9nx92u9c.js} +407 -143
- package/dist-library/layout-BBB2VF0S.js +562 -0
- package/dist-library/{mount-preset-C5s9ebEH.js → mount-preset-DMZ5wd3t.js} +3 -3
- package/dist-library/observability-4KqXhIEU.js +421 -0
- package/dist-library/observability-core-Bcu7vpnl.js +24 -0
- package/dist-library/options-BBp9IcHm.js +121 -0
- package/dist-library/{package-core-D0POW4Gd.js → package-core-K5xesGqy.js} +30 -29
- package/dist-library/{parser-standard-OToYcOBL.js → parser-standard-CBA1-hdG.js} +3332 -3840
- package/dist-library/{plugin-packs-B1XPWcFs.js → plugin-packs-Bh1HhLym.js} +3 -2
- package/dist-library/preset-core-DeZPA8IE.js +1298 -0
- package/dist-library/react-0DCh-Mar.js +7 -0
- package/dist-library/reactive-md-authoring.js +28 -30
- package/dist-library/reactive-md-build.js +99 -61
- package/dist-library/reactive-md-compiler-standard.js +10 -9
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-default-packs.js +3 -2
- package/dist-library/reactive-md-default-preset.js +3 -2
- package/dist-library/reactive-md-export.js +4 -4
- package/dist-library/reactive-md-minimal-preset.js +2 -2
- package/dist-library/reactive-md-minimal-react-preset.js +3 -3
- package/dist-library/reactive-md-observability.js +4 -0
- package/dist-library/reactive-md-pdf.js +127 -3
- package/dist-library/reactive-md-plugin-chart.js +3 -3
- package/dist-library/reactive-md-plugin-data.js +5 -5
- package/dist-library/reactive-md-plugin-diagram.js +4 -4
- package/dist-library/reactive-md-plugin-forms.js +4 -4
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +3 -3
- package/dist-library/reactive-md-plugin-network.js +119 -116
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-print.css +304 -304
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-server.js +6 -6
- package/dist-library/reactive-md-react-unstyled.js +11 -12
- package/dist-library/reactive-md-react.js +11 -12
- package/dist-library/reactive-md-runtime-browser.js +2 -1
- package/dist-library/reactive-md-runtime.js +4 -3
- package/dist-library/reactive-md-sdk.js +8 -7
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +5 -5
- package/dist-library/reactive-md.js +649 -373
- package/dist-library/{registry-05JiqmEp.js → registry-D6OGkOcX.js} +3 -3
- package/dist-library/{registry-core-Bbad9Bm2.js → registry-core-C9xOunaw.js} +1 -1
- package/dist-library/{resources-IeJomeUT.js → resources-B0x_w3s9.js} +71 -46
- package/dist-library/{runtime-B2fxeveq.js → runtime-BDnnimPA.js} +17 -16
- package/dist-library/{runtime-CuOyRe9f.js → runtime-BpQdZmFI.js} +269 -263
- package/dist-library/{schema-C-AeByPp.js → schema-BryM_VRW.js} +14 -14
- package/dist-library/{sdk-core-BJLJaVR5.js → sdk-core-ChslheKs.js} +499 -158
- package/dist-library/{session-core-BGka5D1J.js → session-core-dxQCJBNa.js} +171 -156
- package/dist-library/{shareable-jkGi2g6y.js → shareable-B8xMoGEa.js} +265 -297
- package/dist-library/types/authoring/catalog.d.ts +1 -2
- package/dist-library/types/build/diagnostics.d.ts +1 -1
- package/dist-library/types/components/shared/visual-frame.d.ts +6 -2
- package/dist-library/types/local/compilation/compiler-capabilities.d.ts +3 -0
- package/dist-library/types/local/compilation/compiler-core.d.ts +11 -3
- package/dist-library/types/local/compilation/compiler-services.d.ts +8 -4
- package/dist-library/types/local/compilation/compiler.d.ts +3 -3
- package/dist-library/types/local/compilation/session/incremental.d.ts +20 -5
- package/dist-library/types/local/compilation/streaming.d.ts +27 -0
- package/dist-library/types/local/configuration/capability-policy.d.ts +3 -0
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +48 -0
- package/dist-library/types/local/configuration/options-core.d.ts +1 -2
- package/dist-library/types/local/configuration/options.d.ts +1 -0
- package/dist-library/types/local/css/author-css.d.ts +66 -0
- package/dist-library/types/local/html/extended-fragment.d.ts +41 -0
- package/dist-library/types/local/html/html.d.ts +39 -3
- package/dist-library/types/local/index.d.ts +7 -1
- package/dist-library/types/local/observability-codes.d.ts +2 -0
- package/dist-library/types/local/observability-core.d.ts +25 -0
- package/dist-library/types/local/observability-messages.d.ts +6 -0
- package/dist-library/types/local/observability.d.ts +43 -0
- package/dist-library/types/local/parsing/author-markdown.d.ts +11 -0
- package/dist-library/types/local/parsing/parse-session.d.ts +2 -2
- package/dist-library/types/local/parsing/parser-convert.d.ts +2 -1
- package/dist-library/types/local/parsing/parser-core.d.ts +8 -1
- package/dist-library/types/local/parsing/parser-internals.d.ts +2 -1
- package/dist-library/types/local/parsing/parser.d.ts +2 -2
- package/dist-library/types/local/rendering/document/ExtendedHtmlFragment.d.ts +14 -0
- package/dist-library/types/local/rendering/document/LocalDocumentViewCore.d.ts +25 -1
- package/dist-library/types/local/rendering/document/LocalReactiveDocumentCore.d.ts +1 -1
- package/dist-library/types/local/rendering/document/use-author-script.d.ts +3 -0
- package/dist-library/types/local/rendering/document/view-render-context.d.ts +11 -1
- package/dist-library/types/local/runtime/author-script-protocol.d.ts +59 -0
- package/dist-library/types/local/transport/worker.d.ts +79 -5
- package/dist-library/types/local/types.d.ts +60 -16
- package/dist-library/types/observability.d.ts +7 -0
- package/dist-library/types/react/component-api.d.ts +10 -1
- package/dist-library/types/react/component-utils.d.ts +9 -1
- package/dist-library/types/react/sdk-core.d.ts +4 -1
- package/dist-library/types/shareable.d.ts +5 -4
- package/dist-library/types/standalone/prepare.d.ts +1 -1
- package/dist-library/types/standalone/session-core.d.ts +3 -2
- package/dist-library/{types-BFC5rzC4.js → types-Ib5kSScP.js} +1 -1
- package/dist-library/types-daDo2c_w.js +3 -0
- package/dist-library/{validation-BlDL2uD9.js → validation-B3RI0xOk.js} +218 -200
- package/dist-library/version-DAxuGOG2.js +147 -0
- package/dist-library/{visual-frame-G8PHoj1e.js → visual-frame-_rcd5HUv.js} +6 -5
- package/dist-library/{visuals-BkYRmYGO.js → visuals-DkDhNdEZ.js} +24191 -24190
- package/dist-standalone/reactive-md-standalone.js +124 -117
- package/docs/README-ch.md +101 -94
- package/docs/README.md +101 -94
- package/docs/compatibility/api-stability-ch.md +25 -0
- package/docs/compatibility/api-stability-en.md +25 -0
- package/docs/compatibility/compatibility-ch.md +146 -129
- package/docs/compatibility/compatibility-en.md +146 -129
- package/docs/compatibility/compatibility-manifest.schema.json +161 -0
- package/docs/compatibility/deprecation-ch.md +21 -0
- package/docs/compatibility/deprecation-en.md +21 -0
- package/docs/compatibility/source-versioning-ch.md +162 -162
- package/docs/compatibility/source-versioning-en.md +162 -162
- package/docs/compatibility/support-matrix-ch.md +108 -0
- package/docs/compatibility/support-matrix-en.md +108 -0
- package/docs/development/component-development-ch.md +66 -66
- package/docs/development/component-development-en.md +66 -66
- package/docs/development/component-development-reference-ch.md +253 -253
- package/docs/development/component-development-reference-en.md +238 -238
- package/docs/development/component-protocol-ch.md +748 -748
- package/docs/development/component-protocol-en.md +750 -750
- package/docs/development/extension-tutorial-ch.md +308 -308
- package/docs/development/extension-tutorial-en.md +308 -308
- package/docs/development/performance-overview-ch.md +422 -422
- package/docs/development/performance-overview-en.md +422 -422
- package/docs/guides/local-guide-ch.md +532 -532
- package/docs/guides/local-guide-en.md +532 -532
- package/docs/integration/author-tools-ch.md +64 -64
- package/docs/integration/author-tools-en.md +64 -64
- package/docs/integration/compiler-ch.md +49 -47
- package/docs/integration/compiler-en.md +36 -34
- package/docs/integration/directory-discovery-en.md +1 -1
- package/docs/integration/editor-ch.md +295 -295
- package/docs/integration/editor-en.md +303 -303
- package/docs/integration/extension-sdk-ch.md +394 -394
- package/docs/integration/extension-sdk-en.md +379 -379
- package/docs/integration/local-integration-ch.md +646 -524
- package/docs/integration/local-integration-en.md +662 -540
- package/docs/integration/shareable-export-ch.md +307 -305
- package/docs/integration/shareable-export-en.md +309 -307
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/html-compatibility-ch.md +93 -140
- package/docs/reference/html-compatibility-en.md +95 -140
- package/docs/reference/local-interaction-syntax-ch.md +724 -724
- package/docs/reference/local-interaction-syntax-en.md +722 -722
- package/docs/reference/public-api-ch.md +39 -7
- package/docs/reference/public-api-en.md +39 -7
- package/docs/reference/theme-protocol-ch.md +198 -198
- package/docs/reference/theme-protocol-en.md +217 -217
- package/docs/releases/release-0.4.0-ch.md +91 -91
- package/docs/releases/release-0.4.0-en.md +91 -91
- package/docs/releases/release-0.4.1-ch.md +25 -25
- package/docs/releases/release-0.4.1-en.md +25 -25
- package/docs/releases/release-0.5.0-ch.md +43 -43
- package/docs/releases/release-0.5.0-en.md +43 -43
- package/docs/releases/release-0.5.1-ch.md +41 -41
- package/docs/releases/release-0.5.1-en.md +41 -41
- package/docs/releases/release-0.5.2-ch.md +37 -37
- package/docs/releases/release-0.5.2-en.md +37 -37
- package/docs/releases/release-0.5.3-ch.md +26 -26
- package/docs/releases/release-0.5.3-en.md +26 -26
- package/docs/releases/release-0.6.0-ch.md +59 -59
- package/docs/releases/release-0.6.0-en.md +59 -59
- package/docs/releases/release-0.6.1-ch.md +29 -29
- package/docs/releases/release-0.6.1-en.md +29 -29
- package/docs/releases/release-0.7.0-ch.md +86 -86
- package/docs/releases/release-0.7.0-en.md +86 -86
- package/docs/releases/release-0.9.1-ch.md +29 -0
- package/docs/releases/release-0.9.1-en.md +29 -0
- package/docs/releases/release-0.9.2-ch.md +33 -0
- package/docs/releases/release-0.9.2-en.md +33 -0
- package/examples/component-package/README-ch.md +101 -101
- package/examples/component-package/README.md +133 -133
- package/examples/conformance/README-ch.md +55 -55
- package/examples/conformance/README.md +55 -55
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/game-2048-package/LICENSE +21 -21
- package/examples/game-2048-package/NOTICES.md +11 -11
- package/examples/game-2048-package/README-ch.md +91 -91
- package/examples/game-2048-package/README.md +98 -98
- package/examples/game-2048-package/package.json +35 -35
- package/examples/game-2048-package/sample/document.reactive.md +17 -17
- package/examples/game-2048-package/scripts/build-export.mjs +44 -44
- package/examples/game-2048-package/scripts/build.mjs +130 -130
- package/examples/game-2048-package/scripts/verify.mjs +180 -180
- package/examples/game-2048-package/src/component.css +161 -161
- package/examples/game-2048-package/src/components.tsx +326 -326
- package/examples/game-2048-package/src/game-engine.ts +228 -228
- package/examples/game-2048-package/src/harness.tsx +34 -34
- package/examples/game-2048-package/src/manifest.ts +85 -85
- package/examples/game-2048-package/src/node-entry.ts +30 -30
- package/examples/game-2048-package/src/sample.ts +4 -4
- package/examples/game-2048-package/tsconfig.json +15 -15
- package/examples/integration/README-ch.md +82 -63
- package/examples/integration/README.md +82 -63
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/extension-sdk/README-ch.md +24 -24
- package/examples/integration/extension-sdk/README.md +24 -24
- package/examples/integration/streaming/index.html +48 -0
- package/examples/integration/streaming/main.js +175 -0
- package/examples/integration/streaming/package.json +13 -0
- package/examples/integration/streaming/worker.js +3 -0
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README-ch.md +76 -76
- package/examples/local/README.md +76 -76
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README-ch.md +22 -22
- package/examples/local/showcase/README.md +31 -31
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/examples/minimal-extension/README-ch.md +78 -78
- package/examples/minimal-extension/README.md +78 -78
- package/examples/minimal-extension/index.html +15 -15
- package/examples/minimal-extension/package.json +26 -26
- package/examples/minimal-extension/sample/document.reactive.md +10 -10
- package/examples/minimal-extension/scripts/build.mjs +32 -32
- package/examples/minimal-extension/scripts/export.mjs +72 -72
- package/examples/minimal-extension/scripts/test-node.mjs +75 -75
- package/examples/minimal-extension/src/extension.tsx +90 -90
- package/examples/minimal-extension/src/preview.tsx +12 -12
- package/examples/minimal-extension/src/source.ts +4 -4
- package/examples/minimal-extension/tsconfig.json +14 -14
- package/examples/sci-fi-theme/README-ch.md +133 -133
- package/examples/sci-fi-theme/README.md +148 -148
- package/examples/sci-fi-theme/demo/acceptance.reactive.md +454 -454
- package/examples/sci-fi-theme/demo/demo.css +638 -638
- package/examples/sci-fi-theme/demo/document.reactive.md +206 -206
- package/examples/sci-fi-theme/demo/index.html +13 -13
- package/examples/sci-fi-theme/demo/main.tsx +215 -215
- package/examples/sci-fi-theme/docs/design-system-ch.md +245 -245
- package/examples/sci-fi-theme/docs/design-system.md +474 -474
- package/examples/sci-fi-theme/package.json +28 -28
- package/examples/sci-fi-theme/scripts/screenshot.mjs +98 -98
- package/examples/sci-fi-theme/src/components.css +2370 -2370
- package/examples/sci-fi-theme/src/index.ts +6 -6
- package/examples/sci-fi-theme/src/notch.css +142 -142
- package/examples/sci-fi-theme/src/sci-fi.css +7 -7
- package/examples/sci-fi-theme/src/theme.ts +39 -39
- package/examples/sci-fi-theme/tsconfig.json +20 -20
- package/examples/sci-fi-theme/vite.config.ts +24 -24
- package/examples/tetris-package/LICENSE +21 -21
- package/examples/tetris-package/NOTICES.md +11 -11
- package/examples/tetris-package/README-ch.md +91 -91
- package/examples/tetris-package/README.md +95 -95
- package/examples/tetris-package/package.json +35 -35
- package/examples/tetris-package/sample/document.reactive.md +16 -16
- package/examples/tetris-package/scripts/build-export.mjs +44 -44
- package/examples/tetris-package/scripts/build.mjs +130 -130
- package/examples/tetris-package/scripts/verify.mjs +173 -173
- package/examples/tetris-package/src/component.css +145 -145
- package/examples/tetris-package/src/components.tsx +334 -334
- package/examples/tetris-package/src/harness.tsx +34 -34
- package/examples/tetris-package/src/manifests.ts +93 -93
- package/examples/tetris-package/src/node-entry.ts +16 -16
- package/examples/tetris-package/src/sample.ts +4 -4
- package/examples/tetris-package/src/tetris-engine.ts +325 -325
- package/examples/tetris-package/tsconfig.json +15 -15
- package/package.json +12 -1
- package/dist-library/LocalDocumentViewCore-BLG4hMuO.js +0 -9535
- package/dist-library/LocalReactiveDocumentCore-DVQ6WA9G.js +0 -259
- package/dist-library/compiler-DfGbQhyD.js +0 -62
- package/dist-library/component-state-BoLCGee4.js +0 -801
- package/dist-library/component-utils-BvHL8VGt.js +0 -298
- package/dist-library/export-C7IDW9ul.js +0 -311
- package/dist-library/layout-C22VjZh0.js +0 -542
- package/dist-library/options-CdSKOi7p.js +0 -116
- package/dist-library/preset-core-CKc5YXSM.js +0 -1443
- package/dist-library/react-LY5qsVeP.js +0 -7
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { a as e, i as t, r as n, s as r } from "./latex-1w7aQgD5.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { i as
|
|
15
|
-
import {
|
|
16
|
-
import { t as
|
|
2
|
+
import { _ as i, a, c as o, d as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v } from "./document-theme-C8J6UyNO.js";
|
|
3
|
+
import { a as y, t as b } from "./compile-Dx6Uw3D9.js";
|
|
4
|
+
import { d as x } from "./compiler-core-DDDdvuLy.js";
|
|
5
|
+
import { g as S } from "./validation-B3RI0xOk.js";
|
|
6
|
+
import { t as C } from "./types-daDo2c_w.js";
|
|
7
|
+
import { c as ee } from "./config-DXLvctiZ.js";
|
|
8
|
+
import { t as te } from "./options-BBp9IcHm.js";
|
|
9
|
+
import { n as w, r as T, t as ne } from "./observability-core-Bcu7vpnl.js";
|
|
10
|
+
import { t as re } from "./compiler-dxLPB9Ym.js";
|
|
11
|
+
import { i as ie, n as ae, r as oe, t as se } from "./authoring-Ci_KzJ0q.js";
|
|
12
|
+
import { c as E } from "./schema-BryM_VRW.js";
|
|
13
|
+
import { n as D, t as ce } from "./incremental-9nx92u9c.js";
|
|
14
|
+
import { a as le, i as ue, n as de, o as fe, r as pe } from "./runtime-BpQdZmFI.js";
|
|
15
|
+
import { i as me } from "./identity-BUx0Q_-d.js";
|
|
16
|
+
import { i as he, n as ge, r as _e, t as ve } from "./sample-bP4zHB3L.js";
|
|
17
|
+
import { _ as ye, a as be, f as xe, g as Se, h as Ce, i as we, m as Te, n as Ee, p as De, r as Oe, t as ke, v as Ae, y as je } from "./shareable-B8xMoGEa.js";
|
|
18
|
+
import { n as O, t as Me } from "./observability-4KqXhIEU.js";
|
|
19
|
+
import { t as Ne } from "./component-state-BRwvTV0d.js";
|
|
17
20
|
// src/local/source/source-migration.ts
|
|
18
|
-
var
|
|
21
|
+
var Pe = /* @__PURE__ */ new Set([
|
|
19
22
|
"sum",
|
|
20
23
|
"average",
|
|
21
24
|
"minOf",
|
|
@@ -33,7 +36,7 @@ var E = /* @__PURE__ */ new Set([
|
|
|
33
36
|
"slice",
|
|
34
37
|
"dateCompare",
|
|
35
38
|
"dateDiff"
|
|
36
|
-
]),
|
|
39
|
+
]), Fe = /* @__PURE__ */ new Set([
|
|
37
40
|
"jump",
|
|
38
41
|
"anchor",
|
|
39
42
|
"text",
|
|
@@ -50,12 +53,12 @@ var E = /* @__PURE__ */ new Set([
|
|
|
50
53
|
"data-table",
|
|
51
54
|
"column",
|
|
52
55
|
"external"
|
|
53
|
-
]),
|
|
56
|
+
]), Ie = /* @__PURE__ */ new Set(["external"]), Le = /* @__PURE__ */ new Set([
|
|
54
57
|
"local-draft-1",
|
|
55
58
|
"local-draft-2",
|
|
56
|
-
|
|
57
|
-
]),
|
|
58
|
-
function
|
|
59
|
+
C
|
|
60
|
+
]), Re = `<!-- reactive-md: ${C} -->`;
|
|
61
|
+
function ze(e) {
|
|
59
62
|
let t = e.diagnostics.filter((t) => t.code.startsWith("local.version.") || t.code === "local.budget" || t.code === "local.parse" && !e.nodes.length), n = e.versionDeclaration?.version ?? null;
|
|
60
63
|
return {
|
|
61
64
|
declaredVersion: n,
|
|
@@ -65,27 +68,27 @@ function Ne(e) {
|
|
|
65
68
|
diagnostics: t
|
|
66
69
|
};
|
|
67
70
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
71
|
+
function Be(e) {
|
|
72
|
+
return ze(E(e));
|
|
70
73
|
}
|
|
71
|
-
function
|
|
72
|
-
let a =
|
|
74
|
+
function Ve(e, t, n, r, i = "error") {
|
|
75
|
+
let a = l(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
|
|
73
76
|
return {
|
|
74
77
|
code: t,
|
|
75
78
|
severity: i,
|
|
76
79
|
range: { ...n },
|
|
77
|
-
message:
|
|
80
|
+
message: f(a),
|
|
78
81
|
line: o.split("\n").length,
|
|
79
82
|
column: n.start - s,
|
|
80
83
|
messageKey: a.key,
|
|
81
84
|
...a.params ? { params: a.params } : {}
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
|
-
function
|
|
85
|
-
let n =
|
|
87
|
+
function He(e, t = {}) {
|
|
88
|
+
let n = E(e), r = ze(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
|
|
86
89
|
ok: !1,
|
|
87
90
|
fromVersion: o,
|
|
88
|
-
toVersion:
|
|
91
|
+
toVersion: C,
|
|
89
92
|
needsMigration: !n.versionDeclaration || o !== "local-draft-3",
|
|
90
93
|
diagnostics: r.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
91
94
|
}, c = {
|
|
@@ -106,15 +109,15 @@ function Ie(e, t = {}) {
|
|
|
106
109
|
}
|
|
107
110
|
s.diagnostics.push(e);
|
|
108
111
|
}, d = (t, n, r, i) => {
|
|
109
|
-
u(
|
|
112
|
+
u(Ve(e, t, n, r, i));
|
|
110
113
|
};
|
|
111
|
-
if (!i || typeof a != "string" || !
|
|
114
|
+
if (!i || typeof a != "string" || !Le.has(o) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && r.declaredVersion !== null && o !== r.declaredVersion) return d("local.upgrade.from-version", l, {
|
|
112
115
|
from: o,
|
|
113
116
|
detail: "use local-draft-1, local-draft-2 or local-draft-3 and match the source declaration"
|
|
114
117
|
}), c;
|
|
115
|
-
let f = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, p = n.versionDeclaration ?
|
|
118
|
+
let f = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, p = n.versionDeclaration ? E(f) : n;
|
|
116
119
|
if (o === "local-draft-1" || o === "local-draft-2") {
|
|
117
|
-
let e = o === "local-draft-1" ?
|
|
120
|
+
let e = o === "local-draft-1" ? Fe : Ie, n = (r) => {
|
|
118
121
|
for (let i of r) if (i.name && e.has(i.name)) d("local.upgrade.tag", i.range, { name: i.name });
|
|
119
122
|
else {
|
|
120
123
|
if (o === "local-draft-1") {
|
|
@@ -126,13 +129,13 @@ function Ie(e, t = {}) {
|
|
|
126
129
|
"bind-y"
|
|
127
130
|
]) {
|
|
128
131
|
let t = i.attrs?.[e];
|
|
129
|
-
t &&
|
|
132
|
+
t && Pe.has(t) && d("local.upgrade.reserved-binding", i.range, { name: t });
|
|
130
133
|
}
|
|
131
134
|
(i.name === "input" || i.name === "textarea") && (i.attrs?.["max-length"] !== void 0 || Number(i.attrs?.["min-length"] ?? 0) > 0) && d("local.upgrade.text-length", i.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
132
135
|
let e = [...i.type === "interpolation" ? [i.value ?? ""] : [], ...Object.values(i.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
133
136
|
for (let t of e) {
|
|
134
137
|
let e = t.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
135
|
-
(e.includes("[") || [...
|
|
138
|
+
(e.includes("[") || [...Pe].some((t) => RegExp(`\\b${t}\\s*\\(`).test(e))) && d("local.upgrade.expression", i.range);
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
i.type !== "fallback" && i.children && n(i.children);
|
|
@@ -141,18 +144,18 @@ function Ie(e, t = {}) {
|
|
|
141
144
|
n(p.nodes);
|
|
142
145
|
}
|
|
143
146
|
if (s.diagnostics.some((e) => e.severity === "error")) return c;
|
|
144
|
-
let m =
|
|
147
|
+
let m = re(f);
|
|
145
148
|
for (let e of m.diagnostics) u(e);
|
|
146
149
|
return m.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && d("local.upgrade.version-missing", {
|
|
147
150
|
start: +(e.charCodeAt(0) === 65279),
|
|
148
151
|
end: +(e.charCodeAt(0) === 65279)
|
|
149
|
-
}, { version:
|
|
152
|
+
}, { version: C }, "warning"), s.ok = !0), c;
|
|
150
153
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
154
|
+
function Ue(e, t) {
|
|
155
|
+
return He(e, t).report;
|
|
153
156
|
}
|
|
154
|
-
function
|
|
155
|
-
let { report: n, declaration: r } =
|
|
157
|
+
function We(e, t) {
|
|
158
|
+
let { report: n, declaration: r } = He(e, t), i = {
|
|
156
159
|
...n,
|
|
157
160
|
source: e,
|
|
158
161
|
changed: !1,
|
|
@@ -162,7 +165,7 @@ function Re(e, t) {
|
|
|
162
165
|
let a = +(e.charCodeAt(0) === 65279), o = r?.range ?? {
|
|
163
166
|
start: a,
|
|
164
167
|
end: a
|
|
165
|
-
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ?
|
|
168
|
+
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ? Re : `${Re}${s}${s}`, l = e.slice(0, o.start) + c + e.slice(o.end);
|
|
166
169
|
return {
|
|
167
170
|
...n,
|
|
168
171
|
source: l,
|
|
@@ -174,7 +177,7 @@ function Re(e, t) {
|
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
// src/local/transport/compile-patch.ts
|
|
177
|
-
var
|
|
180
|
+
var k = "patch-v1", Ge = 1, Ke = 4096, A = [
|
|
178
181
|
"initialState",
|
|
179
182
|
"bindings",
|
|
180
183
|
"bindingSlots",
|
|
@@ -182,16 +185,16 @@ var D = "patch-v1", O = 1, ze = 4096, k = [
|
|
|
182
185
|
"dependencies",
|
|
183
186
|
"tableShapes"
|
|
184
187
|
];
|
|
185
|
-
function
|
|
188
|
+
function j(e) {
|
|
186
189
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
187
190
|
}
|
|
188
|
-
function
|
|
189
|
-
return
|
|
191
|
+
function M(e) {
|
|
192
|
+
return j(e) && typeof e.start == "number" && Number.isFinite(e.start) && typeof e.end == "number" && Number.isFinite(e.end);
|
|
190
193
|
}
|
|
191
|
-
function
|
|
194
|
+
function N() {
|
|
192
195
|
throw TypeError("Invalid local compile result patch");
|
|
193
196
|
}
|
|
194
|
-
function
|
|
197
|
+
function P(e, t) {
|
|
195
198
|
if (e === t) return !0;
|
|
196
199
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
197
200
|
let n = Array.isArray(e);
|
|
@@ -199,18 +202,18 @@ function N(e, t) {
|
|
|
199
202
|
if (n) {
|
|
200
203
|
let n = e, r = t;
|
|
201
204
|
if (n.length !== r.length) return !1;
|
|
202
|
-
for (let e = 0; e < n.length; e += 1) if (!
|
|
205
|
+
for (let e = 0; e < n.length; e += 1) if (!P(n[e], r[e])) return !1;
|
|
203
206
|
return !0;
|
|
204
207
|
}
|
|
205
208
|
let r = e, i = t, a = Object.keys(r);
|
|
206
209
|
if (a.length !== Object.keys(i).length) return !1;
|
|
207
|
-
for (let e of a) if (!Object.hasOwn(i, e) || !
|
|
210
|
+
for (let e of a) if (!Object.hasOwn(i, e) || !P(r[e], i[e])) return !1;
|
|
208
211
|
return !0;
|
|
209
212
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
213
|
+
function F(e) {
|
|
214
|
+
return x(e, !1);
|
|
212
215
|
}
|
|
213
|
-
function
|
|
216
|
+
function I(e, t) {
|
|
214
217
|
if (typeof e != "string" || typeof t != "string" || e === t) return null;
|
|
215
218
|
let n = Math.min(e.length, t.length), r = 0;
|
|
216
219
|
for (; r < n && e.charCodeAt(r) === t.charCodeAt(r);) r += 1;
|
|
@@ -222,8 +225,8 @@ function F(e, t) {
|
|
|
222
225
|
insert: t.slice(r, a)
|
|
223
226
|
};
|
|
224
227
|
}
|
|
225
|
-
function
|
|
226
|
-
if (!
|
|
228
|
+
function L(e) {
|
|
229
|
+
if (!j(e)) return null;
|
|
227
230
|
let { from: t, to: n, insert: r } = e;
|
|
228
231
|
return typeof t != "number" || !Number.isSafeInteger(t) || typeof n != "number" || !Number.isSafeInteger(n) || typeof r != "string" || t < 0 || n < t ? null : {
|
|
229
232
|
from: t,
|
|
@@ -231,42 +234,42 @@ function Be(e) {
|
|
|
231
234
|
insert: r
|
|
232
235
|
};
|
|
233
236
|
}
|
|
234
|
-
function
|
|
235
|
-
let n =
|
|
237
|
+
function qe(e, t) {
|
|
238
|
+
let n = L(t);
|
|
236
239
|
return n === null || typeof e != "string" || n.to > e.length ? null : e.slice(0, n.from) + n.insert + e.slice(n.to);
|
|
237
240
|
}
|
|
238
|
-
function
|
|
241
|
+
function R(e) {
|
|
239
242
|
let t = {};
|
|
240
243
|
for (let [n, r] of Object.entries(e)) n !== "children" && (t[n] = r);
|
|
241
244
|
return t;
|
|
242
245
|
}
|
|
243
|
-
function
|
|
246
|
+
function Je(e, t) {
|
|
244
247
|
let n = Object.keys(e).filter((e) => e !== "children"), r = Object.keys(t).filter((e) => e !== "children");
|
|
245
248
|
if (n.length !== r.length) return !1;
|
|
246
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !
|
|
249
|
+
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return !1;
|
|
247
250
|
return !0;
|
|
248
251
|
}
|
|
249
252
|
function z(e) {
|
|
250
253
|
return e.children === void 0 ? void 0 : e.children.map((e) => e.id);
|
|
251
254
|
}
|
|
252
|
-
function
|
|
255
|
+
function Ye(e, t) {
|
|
253
256
|
let n = z(e), r = z(t);
|
|
254
257
|
if (n === void 0 || r === void 0) return n === r;
|
|
255
258
|
if (n.length !== r.length) return !1;
|
|
256
259
|
for (let e = 0; e < n.length; e += 1) if (n[e] !== r[e]) return !1;
|
|
257
260
|
return !0;
|
|
258
261
|
}
|
|
259
|
-
function
|
|
260
|
-
if (!
|
|
262
|
+
function Xe(e, t) {
|
|
263
|
+
if (!Je(e, t) || !Ye(e, t)) return !1;
|
|
261
264
|
if (!e.children || !t.children) return !0;
|
|
262
|
-
for (let n = 0; n < e.children.length; n += 1) if (!
|
|
265
|
+
for (let n = 0; n < e.children.length; n += 1) if (!Xe(e.children[n], t.children[n])) return !1;
|
|
263
266
|
return !0;
|
|
264
267
|
}
|
|
265
|
-
function
|
|
268
|
+
function Ze(e, t) {
|
|
266
269
|
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
267
270
|
if (n.length !== r.length) return null;
|
|
268
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !
|
|
269
|
-
if (!
|
|
271
|
+
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return null;
|
|
272
|
+
if (!M(e.range) || !M(t.range)) return null;
|
|
270
273
|
let i = e.range.start - t.range.start;
|
|
271
274
|
if (e.range.end !== t.range.end + i) return null;
|
|
272
275
|
let a = z(e), o = z(t);
|
|
@@ -274,19 +277,19 @@ function Ve(e, t) {
|
|
|
274
277
|
if (a !== o) return null;
|
|
275
278
|
} else {
|
|
276
279
|
if (a.length !== o.length) return null;
|
|
277
|
-
for (let n = 0; n < a.length; n += 1) if (a[n] !== o[n] ||
|
|
280
|
+
for (let n = 0; n < a.length; n += 1) if (a[n] !== o[n] || Ze(e.children[n], t.children[n]) !== i) return null;
|
|
278
281
|
}
|
|
279
282
|
return i;
|
|
280
283
|
}
|
|
281
|
-
function
|
|
284
|
+
function Qe(e, t) {
|
|
282
285
|
let n = Object.keys(e).filter((e) => e !== "children" && e !== "range"), r = Object.keys(t).filter((e) => e !== "children" && e !== "range");
|
|
283
286
|
if (n.length !== r.length) return null;
|
|
284
|
-
for (let r of n) if (!Object.hasOwn(t, r) || !
|
|
285
|
-
if (!
|
|
287
|
+
for (let r of n) if (!Object.hasOwn(t, r) || !P(e[r], t[r])) return null;
|
|
288
|
+
if (!M(e.range) || !M(t.range)) return null;
|
|
286
289
|
let i = e.range.start - t.range.start;
|
|
287
290
|
return e.range.end === t.range.end + i ? i : null;
|
|
288
291
|
}
|
|
289
|
-
function
|
|
292
|
+
function B(e) {
|
|
290
293
|
let t = /* @__PURE__ */ new Map(), n = [...e].reverse();
|
|
291
294
|
for (; n.length > 0;) {
|
|
292
295
|
let e = n.pop();
|
|
@@ -294,8 +297,8 @@ function Ue(e) {
|
|
|
294
297
|
}
|
|
295
298
|
return t;
|
|
296
299
|
}
|
|
297
|
-
function
|
|
298
|
-
if (t !== void 0 &&
|
|
300
|
+
function $e(e, t, n, r) {
|
|
301
|
+
if (t !== void 0 && Xe(e, t)) return;
|
|
299
302
|
if (t === void 0) {
|
|
300
303
|
r.push({
|
|
301
304
|
id: e.id,
|
|
@@ -303,7 +306,7 @@ function We(e, t, n, r) {
|
|
|
303
306
|
});
|
|
304
307
|
return;
|
|
305
308
|
}
|
|
306
|
-
let i =
|
|
309
|
+
let i = Ze(e, t);
|
|
307
310
|
if (i !== null) {
|
|
308
311
|
i !== 0 && r.push({
|
|
309
312
|
id: e.id,
|
|
@@ -313,27 +316,27 @@ function We(e, t, n, r) {
|
|
|
313
316
|
return;
|
|
314
317
|
}
|
|
315
318
|
let a = { id: e.id };
|
|
316
|
-
if (!
|
|
317
|
-
let n =
|
|
318
|
-
n !== null && n !== 0 ? a.shift = n : a.data =
|
|
319
|
+
if (!Je(e, t)) {
|
|
320
|
+
let n = Qe(e, t);
|
|
321
|
+
n !== null && n !== 0 ? a.shift = n : a.data = R(e);
|
|
319
322
|
}
|
|
320
|
-
|
|
323
|
+
Ye(e, t) || (a.children = e.children === void 0 ? null : e.children.map((e) => e.id));
|
|
321
324
|
let o = r.length;
|
|
322
|
-
if (e.children) for (let t of e.children)
|
|
325
|
+
if (e.children) for (let t of e.children) $e(t, n.get(t.id), n, r);
|
|
323
326
|
Object.keys(a).length > 1 ? r.splice(o, 0, a) : r.length > o && r.splice(o, 0, { id: e.id });
|
|
324
327
|
}
|
|
325
|
-
function
|
|
326
|
-
if (!
|
|
328
|
+
function et(e, t) {
|
|
329
|
+
if (!j(e)) return { set: t };
|
|
327
330
|
let n = {}, r = [];
|
|
328
|
-
for (let [r, i] of Object.entries(t)) Object.hasOwn(e, r) &&
|
|
331
|
+
for (let [r, i] of Object.entries(t)) Object.hasOwn(e, r) && P(e[r], i) || (n[r] = i);
|
|
329
332
|
for (let n of Object.keys(e)) Object.hasOwn(t, n) || r.push(n);
|
|
330
333
|
return Object.keys(n).length === 0 && r.length === 0 ? null : {
|
|
331
334
|
...Object.keys(n).length === 0 ? {} : { set: n },
|
|
332
335
|
...r.length === 0 ? {} : { remove: r }
|
|
333
336
|
};
|
|
334
337
|
}
|
|
335
|
-
var
|
|
336
|
-
function
|
|
338
|
+
var tt = /* @__PURE__ */ new WeakMap();
|
|
339
|
+
function nt(e) {
|
|
337
340
|
let t = 2;
|
|
338
341
|
for (let n = 0; n < e.length; n++) {
|
|
339
342
|
let r = e.charCodeAt(n);
|
|
@@ -348,14 +351,14 @@ function qe(e) {
|
|
|
348
351
|
}
|
|
349
352
|
return t;
|
|
350
353
|
}
|
|
351
|
-
function
|
|
354
|
+
function V(e, t) {
|
|
352
355
|
if (e === null) return {
|
|
353
356
|
bytes: 4,
|
|
354
357
|
nodes: 0
|
|
355
358
|
};
|
|
356
359
|
let n = typeof e;
|
|
357
360
|
if (n === "string") return {
|
|
358
|
-
bytes:
|
|
361
|
+
bytes: nt(e),
|
|
359
362
|
nodes: 0
|
|
360
363
|
};
|
|
361
364
|
if (n === "number") return {
|
|
@@ -370,19 +373,19 @@ function H(e, t) {
|
|
|
370
373
|
bytes: 0,
|
|
371
374
|
nodes: 0
|
|
372
375
|
};
|
|
373
|
-
let r = e, i =
|
|
376
|
+
let r = e, i = tt.get(r);
|
|
374
377
|
if (i !== void 0) return i;
|
|
375
378
|
if (t.has(r)) return {
|
|
376
379
|
bytes: 0,
|
|
377
380
|
nodes: 0
|
|
378
381
|
};
|
|
379
382
|
t.add(r);
|
|
380
|
-
let a, o = +!!
|
|
383
|
+
let a, o = +!!lt(e);
|
|
381
384
|
if (Array.isArray(e)) {
|
|
382
385
|
a = 2;
|
|
383
386
|
for (let n = 0; n < e.length; n += 1) {
|
|
384
387
|
n > 0 && (a += 1);
|
|
385
|
-
let r =
|
|
388
|
+
let r = V(e[n], t);
|
|
386
389
|
a += r.bytes || 4, o += r.nodes;
|
|
387
390
|
}
|
|
388
391
|
} else {
|
|
@@ -392,8 +395,8 @@ function H(e, t) {
|
|
|
392
395
|
if (!Object.hasOwn(r, n)) continue;
|
|
393
396
|
let i = r[n];
|
|
394
397
|
if (i === void 0) continue;
|
|
395
|
-
e > 0 && (a += 1), e += 1, a +=
|
|
396
|
-
let s =
|
|
398
|
+
e > 0 && (a += 1), e += 1, a += nt(n) + 1;
|
|
399
|
+
let s = V(i, t);
|
|
397
400
|
a += s.bytes, o += s.nodes;
|
|
398
401
|
}
|
|
399
402
|
}
|
|
@@ -402,20 +405,20 @@ function H(e, t) {
|
|
|
402
405
|
bytes: a,
|
|
403
406
|
nodes: o
|
|
404
407
|
};
|
|
405
|
-
return
|
|
408
|
+
return tt.set(r, s), s;
|
|
406
409
|
}
|
|
407
|
-
function
|
|
410
|
+
function rt(e, t) {
|
|
408
411
|
let n = e.document.nodes ?? [];
|
|
409
412
|
try {
|
|
410
|
-
let r =
|
|
411
|
-
if (r.bytes <= Math.max(i,
|
|
413
|
+
let r = V(e, /* @__PURE__ */ new Set()), i = t.ok && typeof t.document.source == "string" ? t.document.source.length : 0;
|
|
414
|
+
if (r.bytes <= Math.max(i, Ke)) return {
|
|
412
415
|
patchBytes: r.bytes,
|
|
413
416
|
patchNodes: n.length,
|
|
414
417
|
preferFull: !1
|
|
415
418
|
};
|
|
416
|
-
let a =
|
|
417
|
-
for (let e of n) e.node === void 0 ? e.data !== void 0 && (o += 1) : o +=
|
|
418
|
-
let s = r.bytes *
|
|
419
|
+
let a = V(t, /* @__PURE__ */ new Set()), o = 0;
|
|
420
|
+
for (let e of n) e.node === void 0 ? e.data !== void 0 && (o += 1) : o += V(e.node, /* @__PURE__ */ new Set()).nodes;
|
|
421
|
+
let s = r.bytes * Ge >= a.bytes, c = a.nodes > 0 && o * Ge >= a.nodes;
|
|
419
422
|
return {
|
|
420
423
|
patchBytes: r.bytes,
|
|
421
424
|
fullBytes: a.bytes,
|
|
@@ -432,55 +435,55 @@ function Je(e, t) {
|
|
|
432
435
|
};
|
|
433
436
|
}
|
|
434
437
|
}
|
|
435
|
-
function
|
|
436
|
-
return
|
|
438
|
+
function it(e, t) {
|
|
439
|
+
return st(e, t);
|
|
437
440
|
}
|
|
438
|
-
function
|
|
439
|
-
let n =
|
|
441
|
+
function at(e, t) {
|
|
442
|
+
let n = st(e, t);
|
|
440
443
|
return n ? {
|
|
441
444
|
patch: n,
|
|
442
|
-
cost:
|
|
445
|
+
cost: rt(n, t)
|
|
443
446
|
} : null;
|
|
444
447
|
}
|
|
445
|
-
function
|
|
448
|
+
function ot(e, t) {
|
|
446
449
|
let n = e.recoveries, r = t.recoveries;
|
|
447
|
-
return n === void 0 ? r === void 0 ? {} : { recoveries: r } : r !== void 0 &&
|
|
450
|
+
return n === void 0 ? r === void 0 ? {} : { recoveries: r } : r !== void 0 && P(n, r) ? {} : { recoveries: r === void 0 ? null : r };
|
|
448
451
|
}
|
|
449
|
-
function
|
|
452
|
+
function st(e, t) {
|
|
450
453
|
try {
|
|
451
454
|
if (!e.ok || !t.ok) return null;
|
|
452
455
|
let n = e.document, r = t.document;
|
|
453
|
-
if (!
|
|
456
|
+
if (!j(n) || !j(r)) return null;
|
|
454
457
|
let i = {};
|
|
455
458
|
if (typeof n.source == "string" && typeof r.source == "string") {
|
|
456
|
-
let e =
|
|
459
|
+
let e = I(n.source, r.source);
|
|
457
460
|
e !== null && (i.source = e);
|
|
458
461
|
} else if (n.source !== r.source) return null;
|
|
459
|
-
let a = [], o = {}, s = {}, c = new Set(
|
|
462
|
+
let a = [], o = {}, s = {}, c = new Set(A), l = /* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(r)]);
|
|
460
463
|
for (let e of l) {
|
|
461
464
|
if (e === "source" || e === "nodes" || c.has(e)) continue;
|
|
462
465
|
let t = Object.hasOwn(r, e) && r[e] !== void 0, i = Object.hasOwn(n, e) && n[e] !== void 0;
|
|
463
|
-
t ? i &&
|
|
466
|
+
t ? i && P(n[e], r[e]) || (o[e] = r[e]) : i && a.push(e);
|
|
464
467
|
}
|
|
465
|
-
for (let e of
|
|
468
|
+
for (let e of A) {
|
|
466
469
|
let t = Object.hasOwn(r, e) && r[e] !== void 0, i = Object.hasOwn(n, e) && n[e] !== void 0, c = i ? n[e] : void 0, l = t ? r[e] : void 0;
|
|
467
470
|
if (!t) {
|
|
468
471
|
i && a.push(e);
|
|
469
472
|
continue;
|
|
470
473
|
}
|
|
471
|
-
if (!
|
|
472
|
-
i &&
|
|
474
|
+
if (!j(l)) {
|
|
475
|
+
i && P(c, l) || (o[e] = l);
|
|
473
476
|
continue;
|
|
474
477
|
}
|
|
475
478
|
if (!i) {
|
|
476
479
|
s[e] = { set: l };
|
|
477
480
|
continue;
|
|
478
481
|
}
|
|
479
|
-
if (!
|
|
482
|
+
if (!j(c)) {
|
|
480
483
|
o[e] = l;
|
|
481
484
|
continue;
|
|
482
485
|
}
|
|
483
|
-
let u =
|
|
486
|
+
let u = et(c, l);
|
|
484
487
|
u !== null && (s[e] = u);
|
|
485
488
|
}
|
|
486
489
|
let u = Array.isArray(n.nodes) ? n.nodes : [], d = Array.isArray(r.nodes) ? r.nodes : [], f = u.map((e) => e.id), p = d.map((e) => e.id), m = f.length !== p.length;
|
|
@@ -490,55 +493,55 @@ function Qe(e, t) {
|
|
|
490
493
|
break;
|
|
491
494
|
}
|
|
492
495
|
}
|
|
493
|
-
let h = [], g =
|
|
494
|
-
for (let e of d)
|
|
496
|
+
let h = [], g = B(u);
|
|
497
|
+
for (let e of d) $e(e, g.get(e.id), g, h);
|
|
495
498
|
return m && (i.roots = p), h.length > 0 && (i.nodes = h), a.length > 0 && (i.removed = a), Object.keys(o).length > 0 && (i.values = o), Object.keys(s).length > 0 && (i.records = s), {
|
|
496
499
|
kind: "result-patch",
|
|
497
|
-
protocol:
|
|
500
|
+
protocol: k,
|
|
498
501
|
document: i,
|
|
499
|
-
...
|
|
500
|
-
...
|
|
502
|
+
...P(e.diagnostics, t.diagnostics) ? {} : { diagnostics: t.diagnostics },
|
|
503
|
+
...ot(e, t)
|
|
501
504
|
};
|
|
502
505
|
} catch {
|
|
503
506
|
return null;
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
|
-
function
|
|
507
|
-
let n =
|
|
508
|
-
return
|
|
509
|
+
function ct(e, t) {
|
|
510
|
+
let n = R(e);
|
|
511
|
+
return M(n.range) || N(), n.range = {
|
|
509
512
|
start: n.range.start + t,
|
|
510
513
|
end: n.range.end + t
|
|
511
|
-
}, e.children && (n.children = e.children.map((e) =>
|
|
514
|
+
}, e.children && (n.children = e.children.map((e) => ct(e, t))), n;
|
|
512
515
|
}
|
|
513
|
-
function
|
|
514
|
-
return
|
|
516
|
+
function lt(e) {
|
|
517
|
+
return j(e) && typeof e.id == "string" && typeof e.type == "string" && M(e.range);
|
|
515
518
|
}
|
|
516
|
-
function
|
|
517
|
-
|
|
519
|
+
function ut(e, t) {
|
|
520
|
+
j(t) || N(), t.set !== void 0 && !j(t.set) && N(), t.remove !== void 0 && !Array.isArray(t.remove) && N();
|
|
518
521
|
let n = {};
|
|
519
|
-
if (
|
|
522
|
+
if (j(e)) for (let [t, r] of Object.entries(e)) Object.defineProperty(n, t, {
|
|
520
523
|
value: r,
|
|
521
524
|
enumerable: !0,
|
|
522
525
|
configurable: !0,
|
|
523
526
|
writable: !0
|
|
524
527
|
});
|
|
525
|
-
else e !== void 0 &&
|
|
528
|
+
else e !== void 0 && N();
|
|
526
529
|
if (t.set) for (let [e, r] of Object.entries(t.set)) Object.defineProperty(n, e, {
|
|
527
|
-
value:
|
|
530
|
+
value: F(r),
|
|
528
531
|
enumerable: !0,
|
|
529
532
|
configurable: !0,
|
|
530
533
|
writable: !0
|
|
531
534
|
});
|
|
532
|
-
if (t.remove) for (let e of t.remove) typeof e != "string" &&
|
|
535
|
+
if (t.remove) for (let e of t.remove) typeof e != "string" && N(), delete n[e];
|
|
533
536
|
return n;
|
|
534
537
|
}
|
|
535
|
-
function
|
|
538
|
+
function dt(e, t) {
|
|
536
539
|
try {
|
|
537
|
-
if (!e.ok || !
|
|
540
|
+
if (!e.ok || !j(t) || t.kind !== "result-patch" || t.protocol !== "patch-v1") return null;
|
|
538
541
|
let n = t.document;
|
|
539
|
-
if (!
|
|
542
|
+
if (!j(n)) return null;
|
|
540
543
|
let r = e.document;
|
|
541
|
-
if (!
|
|
544
|
+
if (!j(r)) return null;
|
|
542
545
|
let i = {};
|
|
543
546
|
for (let [e, t] of Object.entries(r)) Object.defineProperty(i, e, {
|
|
544
547
|
value: t,
|
|
@@ -554,11 +557,11 @@ function nt(e, t) {
|
|
|
554
557
|
}
|
|
555
558
|
}
|
|
556
559
|
if (n.values !== void 0) {
|
|
557
|
-
if (!
|
|
560
|
+
if (!j(n.values)) return null;
|
|
558
561
|
for (let [e, t] of Object.entries(n.values)) {
|
|
559
562
|
if (e === "nodes" || e === "source") return null;
|
|
560
563
|
Object.defineProperty(i, e, {
|
|
561
|
-
value:
|
|
564
|
+
value: F(t),
|
|
562
565
|
enumerable: !0,
|
|
563
566
|
configurable: !0,
|
|
564
567
|
writable: !0
|
|
@@ -566,28 +569,28 @@ function nt(e, t) {
|
|
|
566
569
|
}
|
|
567
570
|
}
|
|
568
571
|
if (n.records !== void 0) {
|
|
569
|
-
if (!
|
|
572
|
+
if (!j(n.records)) return null;
|
|
570
573
|
for (let e of Object.keys(n.records)) {
|
|
571
|
-
if (!
|
|
574
|
+
if (!A.includes(e)) return null;
|
|
572
575
|
let t = n.records[e];
|
|
573
|
-
t !== void 0 && (i[e] =
|
|
576
|
+
t !== void 0 && (i[e] = ut(r[e], t));
|
|
574
577
|
}
|
|
575
578
|
}
|
|
576
579
|
let a = typeof r.source == "string" ? r.source : null;
|
|
577
580
|
if (a === null) return null;
|
|
578
581
|
if (n.source !== void 0) {
|
|
579
|
-
let e =
|
|
582
|
+
let e = L(n.source);
|
|
580
583
|
if (e === null) return null;
|
|
581
|
-
let t =
|
|
584
|
+
let t = qe(a, e);
|
|
582
585
|
if (t === null) return null;
|
|
583
586
|
a = t;
|
|
584
587
|
}
|
|
585
588
|
i.source = a;
|
|
586
|
-
let o = Array.isArray(r.nodes) ? r.nodes : [], s =
|
|
589
|
+
let o = Array.isArray(r.nodes) ? r.nodes : [], s = B(o), c = /* @__PURE__ */ new Map();
|
|
587
590
|
if (n.nodes !== void 0) {
|
|
588
591
|
if (!Array.isArray(n.nodes)) return null;
|
|
589
592
|
for (let e of n.nodes) {
|
|
590
|
-
if (!
|
|
593
|
+
if (!j(e) || typeof e.id != "string" || c.has(e.id)) return null;
|
|
591
594
|
c.set(e.id, e);
|
|
592
595
|
}
|
|
593
596
|
}
|
|
@@ -603,23 +606,23 @@ function nt(e, t) {
|
|
|
603
606
|
let u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), f = (e) => {
|
|
604
607
|
let t = u.get(e);
|
|
605
608
|
if (t !== void 0) return t;
|
|
606
|
-
d.has(e) &&
|
|
609
|
+
d.has(e) && N();
|
|
607
610
|
let n = c.get(e), r = s.get(e);
|
|
608
|
-
if (n === void 0) return r === void 0 &&
|
|
609
|
-
if (
|
|
610
|
-
(n.data !== void 0 || n.children !== void 0 || n.shift !== void 0 || n.subtree) &&
|
|
611
|
-
let t =
|
|
611
|
+
if (n === void 0) return r === void 0 && N(), u.set(e, r), r;
|
|
612
|
+
if (j(n) || N(), n.node !== void 0) {
|
|
613
|
+
(n.data !== void 0 || n.children !== void 0 || n.shift !== void 0 || n.subtree) && N(), lt(n.node) && n.node.id === e || N();
|
|
614
|
+
let t = F(n.node);
|
|
612
615
|
return u.set(e, t), t;
|
|
613
616
|
}
|
|
614
|
-
r === void 0 && n.data === void 0 &&
|
|
617
|
+
r === void 0 && n.data === void 0 && N(), n.subtree !== void 0 && n.subtree !== !0 && N(), n.shift !== void 0 && !Number.isSafeInteger(n.shift) && N(), n.data !== void 0 && n.shift !== void 0 && N(), n.children !== void 0 && n.children !== null && (!Array.isArray(n.children) || n.children.some((e) => typeof e != "string")) && N(), d.add(e);
|
|
615
618
|
let i;
|
|
616
|
-
if (n.subtree === !0) (r === void 0 || n.shift === void 0 || n.data !== void 0 || n.children !== void 0) &&
|
|
619
|
+
if (n.subtree === !0) (r === void 0 || n.shift === void 0 || n.data !== void 0 || n.children !== void 0) && N(), i = ct(r, n.shift);
|
|
617
620
|
else {
|
|
618
621
|
let t;
|
|
619
|
-
n.data === void 0 ? (r === void 0 &&
|
|
622
|
+
n.data === void 0 ? (r === void 0 && N(), t = R(r), n.shift !== void 0 && (M(t.range) || N(), t.range = {
|
|
620
623
|
start: t.range.start + n.shift,
|
|
621
624
|
end: t.range.end + n.shift
|
|
622
|
-
})) : (
|
|
625
|
+
})) : (j(n.data) || N(), t = F(n.data), delete t.children, t.id !== e && N());
|
|
623
626
|
let a;
|
|
624
627
|
if (n.children !== void 0) a = n.children === null ? null : [...n.children];
|
|
625
628
|
else {
|
|
@@ -631,27 +634,30 @@ function nt(e, t) {
|
|
|
631
634
|
return d.delete(e), u.set(e, i), i;
|
|
632
635
|
}, p = l.map(f);
|
|
633
636
|
i.nodes = n.roots === void 0 && n.nodes === void 0 ? r.nodes : p;
|
|
634
|
-
let m = t.diagnostics === void 0 ? e.diagnostics : Array.isArray(t.diagnostics) ?
|
|
637
|
+
let m = t.diagnostics === void 0 ? e.diagnostics : Array.isArray(t.diagnostics) ? F(t.diagnostics) : N();
|
|
635
638
|
if (t.recoveries !== void 0 && t.recoveries !== null && !Array.isArray(t.recoveries)) return null;
|
|
639
|
+
let h = e.status === void 0 ? {} : { status: e.status };
|
|
636
640
|
if (t.recoveries === null) return {
|
|
637
641
|
ok: !0,
|
|
638
642
|
document: i,
|
|
639
|
-
diagnostics: m
|
|
643
|
+
diagnostics: m,
|
|
644
|
+
...h
|
|
640
645
|
};
|
|
641
|
-
let
|
|
646
|
+
let g = t.recoveries === void 0 ? e.recoveries : F([...t.recoveries]);
|
|
642
647
|
return {
|
|
643
648
|
ok: !0,
|
|
644
649
|
document: i,
|
|
645
650
|
diagnostics: m,
|
|
646
|
-
...h
|
|
651
|
+
...h,
|
|
652
|
+
...g === void 0 ? {} : { recoveries: g }
|
|
647
653
|
};
|
|
648
654
|
} catch {
|
|
649
655
|
return null;
|
|
650
656
|
}
|
|
651
657
|
}
|
|
652
658
|
// src/local/transport/flat-compiled-data.ts
|
|
653
|
-
var
|
|
654
|
-
function
|
|
659
|
+
var H = "flat-v1";
|
|
660
|
+
function ft(e) {
|
|
655
661
|
if (!e.ok) return !1;
|
|
656
662
|
let t = e.document.nodes.map((e) => ({
|
|
657
663
|
node: e,
|
|
@@ -667,7 +673,7 @@ function rt(e) {
|
|
|
667
673
|
}
|
|
668
674
|
return !1;
|
|
669
675
|
}
|
|
670
|
-
function
|
|
676
|
+
function pt(e) {
|
|
671
677
|
let t = [], n = /* @__PURE__ */ new Map(), r = [], i = (e) => {
|
|
672
678
|
if (typeof e == "object" && e) {
|
|
673
679
|
let i = n.get(e);
|
|
@@ -696,11 +702,11 @@ function it(e) {
|
|
|
696
702
|
for (let t of Object.keys(e)) n.push([t, i(e[t])]);
|
|
697
703
|
}
|
|
698
704
|
return {
|
|
699
|
-
version:
|
|
705
|
+
version: H,
|
|
700
706
|
records: t
|
|
701
707
|
};
|
|
702
708
|
}
|
|
703
|
-
function
|
|
709
|
+
function mt(e) {
|
|
704
710
|
if (!e || typeof e != "object") return null;
|
|
705
711
|
let t = e;
|
|
706
712
|
if (t.version !== "flat-v1" || !Array.isArray(t.records) || t.records.length === 0 || t.records.length > 2e6) return null;
|
|
@@ -760,21 +766,21 @@ function at(e) {
|
|
|
760
766
|
return r[0];
|
|
761
767
|
}
|
|
762
768
|
// src/local/transport/worker-job.ts
|
|
763
|
-
var
|
|
769
|
+
var ht = 150, gt = 200, _t = [
|
|
764
770
|
"maxSyntaxNodes",
|
|
765
771
|
"maxParseWork",
|
|
766
772
|
"maxMarkdownDepth"
|
|
767
773
|
];
|
|
768
|
-
function
|
|
774
|
+
function U(e) {
|
|
769
775
|
return e instanceof Error ? e.message : String(e);
|
|
770
776
|
}
|
|
771
|
-
function
|
|
777
|
+
function W() {
|
|
772
778
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
773
779
|
}
|
|
774
|
-
function
|
|
780
|
+
function G(e) {
|
|
775
781
|
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
776
782
|
}
|
|
777
|
-
function
|
|
783
|
+
function K(e, t, n) {
|
|
778
784
|
let r = {
|
|
779
785
|
tokens: [],
|
|
780
786
|
bindings: [],
|
|
@@ -782,7 +788,7 @@ function q(e, t, n) {
|
|
|
782
788
|
};
|
|
783
789
|
if (n.ok && n.document.source !== e || !n.ok && n.diagnostics.some((e) => e.code.startsWith("local.budget") || e.code.startsWith("local.options."))) return r;
|
|
784
790
|
try {
|
|
785
|
-
return
|
|
791
|
+
return se(e, t, {
|
|
786
792
|
...n.ok ? { document: n.document } : {},
|
|
787
793
|
diagnostics: !1
|
|
788
794
|
});
|
|
@@ -794,7 +800,7 @@ function q(e, t, n) {
|
|
|
794
800
|
};
|
|
795
801
|
}
|
|
796
802
|
}
|
|
797
|
-
function
|
|
803
|
+
function vt(e) {
|
|
798
804
|
return Array.isArray(e) ? e.length > 32 ? Array(33) : e.map((e) => {
|
|
799
805
|
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
800
806
|
let t = e, n = { ...t }, r = t.props;
|
|
@@ -811,25 +817,25 @@ function lt(e) {
|
|
|
811
817
|
return n.props = i, n;
|
|
812
818
|
}) : e;
|
|
813
819
|
}
|
|
814
|
-
function
|
|
820
|
+
function yt(e) {
|
|
815
821
|
if (e !== void 0) try {
|
|
816
822
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
817
823
|
let t = e, n = {};
|
|
818
|
-
for (let e of
|
|
819
|
-
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "strict") && (n.strict = t.strict), Object.hasOwn(t, "limits")) {
|
|
824
|
+
for (let e of S) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
825
|
+
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "sourcePhase") && (n.sourcePhase = t.sourcePhase), Object.hasOwn(t, "strict") && (n.strict = t.strict), Object.hasOwn(t, "limits")) {
|
|
820
826
|
let e = t.limits;
|
|
821
827
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
822
828
|
let t = {};
|
|
823
|
-
for (let n of
|
|
829
|
+
for (let n of _t) Object.hasOwn(e, n) && (t[n] = e[n]);
|
|
824
830
|
n.limits = t;
|
|
825
831
|
} else n.limits = e;
|
|
826
832
|
}
|
|
827
|
-
return Object.hasOwn(t, "hostComponents") && (n.hostComponents =
|
|
833
|
+
return Object.hasOwn(t, "hostComponents") && (n.hostComponents = vt(t.hostComponents)), Object.hasOwn(t, "config") && (n.config = ee(t.config)), n;
|
|
828
834
|
} catch {
|
|
829
835
|
return e;
|
|
830
836
|
}
|
|
831
837
|
}
|
|
832
|
-
function
|
|
838
|
+
function bt(e) {
|
|
833
839
|
try {
|
|
834
840
|
if (!e || typeof e != "object" || Array.isArray(e)) return "";
|
|
835
841
|
let t = e.limits;
|
|
@@ -845,8 +851,8 @@ function dt(e) {
|
|
|
845
851
|
return ":unreadable";
|
|
846
852
|
}
|
|
847
853
|
}
|
|
848
|
-
function
|
|
849
|
-
let t =
|
|
854
|
+
function xt(e) {
|
|
855
|
+
let t = te(e);
|
|
850
856
|
if (t !== "invalid") return t;
|
|
851
857
|
try {
|
|
852
858
|
return `invalid:${JSON.stringify(e)}`;
|
|
@@ -854,30 +860,43 @@ function ft(e) {
|
|
|
854
860
|
return "invalid";
|
|
855
861
|
}
|
|
856
862
|
}
|
|
857
|
-
function
|
|
858
|
-
return `${
|
|
863
|
+
function q(e) {
|
|
864
|
+
return `${xt(e)}${bt(e)}`;
|
|
859
865
|
}
|
|
860
866
|
// src/local/transport/worker-handler.ts
|
|
861
|
-
function
|
|
862
|
-
let
|
|
863
|
-
return typeof
|
|
867
|
+
function St(e, t, n, r) {
|
|
868
|
+
let i = e;
|
|
869
|
+
return typeof i.compileShared == "function" ? i.compileShared(t, n, r) : e.compile(t, n, r);
|
|
870
|
+
}
|
|
871
|
+
function Ct(e) {
|
|
872
|
+
return e === "streaming" || e === "final";
|
|
864
873
|
}
|
|
865
|
-
function
|
|
874
|
+
function J(e) {
|
|
866
875
|
return e.stats;
|
|
867
876
|
}
|
|
868
|
-
function
|
|
877
|
+
function Y(e, t, n, r) {
|
|
869
878
|
try {
|
|
870
879
|
e.postMessage({
|
|
871
880
|
id: t,
|
|
881
|
+
...r?.traceId === void 0 ? {} : {
|
|
882
|
+
traceId: r.traceId,
|
|
883
|
+
requestId: r.requestId,
|
|
884
|
+
sourceRevision: r.sourceRevision
|
|
885
|
+
},
|
|
872
886
|
ok: !1,
|
|
873
887
|
message: n
|
|
874
888
|
});
|
|
875
889
|
} catch {}
|
|
876
890
|
}
|
|
877
|
-
function
|
|
891
|
+
function wt(e, t, n, r, i) {
|
|
878
892
|
try {
|
|
879
893
|
e.postMessage({
|
|
880
|
-
id: t,
|
|
894
|
+
id: t.id,
|
|
895
|
+
...t.traceId === void 0 ? {} : {
|
|
896
|
+
traceId: t.traceId,
|
|
897
|
+
requestId: t.requestId,
|
|
898
|
+
sourceRevision: t.sourceRevision
|
|
899
|
+
},
|
|
881
900
|
ok: !1,
|
|
882
901
|
message: n,
|
|
883
902
|
retryFull: !0,
|
|
@@ -886,18 +905,18 @@ function mt(e, t, n, r, i) {
|
|
|
886
905
|
});
|
|
887
906
|
} catch {}
|
|
888
907
|
}
|
|
889
|
-
function
|
|
908
|
+
function Tt(e) {
|
|
890
909
|
return !!e && typeof e == "object" && (e.control === "dispose" || e.control === "cancel-preparation");
|
|
891
910
|
}
|
|
892
|
-
function
|
|
911
|
+
function Et(e) {
|
|
893
912
|
if (!e || typeof e != "object") return !1;
|
|
894
913
|
let t = e;
|
|
895
914
|
return typeof t.from == "number" && Number.isSafeInteger(t.from) && typeof t.to == "number" && Number.isSafeInteger(t.to) && t.from >= 0 && t.to >= t.from && typeof t.insert == "string";
|
|
896
915
|
}
|
|
897
|
-
function
|
|
916
|
+
function Dt(e, t = {}) {
|
|
898
917
|
let n = e === void 0 ? globalThis : e;
|
|
899
918
|
if (!n || typeof n.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
900
|
-
let r = t.createSession ? t.createSession() :
|
|
919
|
+
let r = t.createSession ? t.createSession() : D(), i = r, a = t.preparationDelay, o = typeof a == "number" && Number.isFinite(a) ? Math.max(0, a) : 200, s = typeof i.prepareAsync == "function", c = null, l = 0, u = !1, d = null, f = null, p = 0, m, h = () => {
|
|
901
920
|
p += 1, f !== null && (f.aborted = !0, f = null), d !== null && (clearTimeout(d), d = null);
|
|
902
921
|
}, g = () => new Promise((e) => {
|
|
903
922
|
typeof setTimeout == "function" ? setTimeout(e, 0) : e();
|
|
@@ -907,11 +926,11 @@ function _t(e, t = {}) {
|
|
|
907
926
|
if (typeof t != "function") return;
|
|
908
927
|
let n = { aborted: !1 };
|
|
909
928
|
f = n;
|
|
910
|
-
let r =
|
|
929
|
+
let r = W(), a = !1;
|
|
911
930
|
try {
|
|
912
931
|
a = await t.call(i, n, g);
|
|
913
932
|
} catch {} finally {
|
|
914
|
-
f === n && (f = null), a && !n.aborted && !u && e === p && (m =
|
|
933
|
+
f === n && (f = null), a && !n.aborted && !u && e === p && (m = G(W() - r));
|
|
915
934
|
}
|
|
916
935
|
}, v = () => {
|
|
917
936
|
if (u || !s) return;
|
|
@@ -935,86 +954,113 @@ function _t(e, t = {}) {
|
|
|
935
954
|
let t = typeof e == "number" && Number.isSafeInteger(e) && e > 0 ? e : null;
|
|
936
955
|
return t === null ? l + 1 : t > l ? t : l + 1;
|
|
937
956
|
}, S = (e, t, i, a, o = !1, s) => {
|
|
938
|
-
let l = c;
|
|
939
|
-
if (
|
|
940
|
-
let
|
|
941
|
-
...b(
|
|
957
|
+
let { id: l, traceId: u, requestId: d, sourceRevision: f } = e, p = c;
|
|
958
|
+
if (p === null) return !1;
|
|
959
|
+
let m = G(i), h = s === void 0 ? b(m) : {
|
|
960
|
+
...b(m),
|
|
942
961
|
...s
|
|
943
962
|
};
|
|
944
963
|
try {
|
|
945
|
-
let
|
|
946
|
-
id:
|
|
964
|
+
let e = a ? {
|
|
965
|
+
id: l,
|
|
966
|
+
...u === void 0 ? {} : {
|
|
967
|
+
traceId: u,
|
|
968
|
+
requestId: d,
|
|
969
|
+
sourceRevision: f
|
|
970
|
+
},
|
|
947
971
|
ok: !0,
|
|
948
|
-
result:
|
|
949
|
-
duration:
|
|
950
|
-
incremental:
|
|
951
|
-
|
|
972
|
+
result: p.result,
|
|
973
|
+
duration: m,
|
|
974
|
+
incremental: J(r),
|
|
975
|
+
...p.sourcePhase === void 0 ? {} : { sourcePhase: p.sourcePhase },
|
|
976
|
+
protocol: k,
|
|
952
977
|
revision: t,
|
|
953
|
-
metrics:
|
|
978
|
+
metrics: h
|
|
954
979
|
} : {
|
|
955
|
-
id:
|
|
980
|
+
id: l,
|
|
981
|
+
...u === void 0 ? {} : {
|
|
982
|
+
traceId: u,
|
|
983
|
+
requestId: d,
|
|
984
|
+
sourceRevision: f
|
|
985
|
+
},
|
|
956
986
|
ok: !0,
|
|
957
|
-
result:
|
|
958
|
-
duration:
|
|
959
|
-
incremental:
|
|
987
|
+
result: p.result,
|
|
988
|
+
duration: m,
|
|
989
|
+
incremental: J(r),
|
|
990
|
+
...p.sourcePhase === void 0 ? {} : { sourcePhase: p.sourcePhase }
|
|
960
991
|
};
|
|
961
|
-
if (o &&
|
|
962
|
-
let
|
|
963
|
-
|
|
964
|
-
...
|
|
965
|
-
analysisMs:
|
|
992
|
+
if (o && e.ok) {
|
|
993
|
+
let t = W();
|
|
994
|
+
e.analysis = K(p.source, p.options, p.result), e.metrics = {
|
|
995
|
+
...e.metrics,
|
|
996
|
+
analysisMs: G(W() - t)
|
|
966
997
|
};
|
|
967
998
|
}
|
|
968
|
-
if (
|
|
969
|
-
let { result:
|
|
970
|
-
...
|
|
971
|
-
flatResult:
|
|
999
|
+
if (p.deep && p.flatResults && e.ok) {
|
|
1000
|
+
let { result: t, ...r } = e, i = {
|
|
1001
|
+
...r,
|
|
1002
|
+
flatResult: pt(t)
|
|
972
1003
|
};
|
|
973
|
-
n.postMessage(
|
|
974
|
-
} else n.postMessage(
|
|
1004
|
+
n.postMessage(i);
|
|
1005
|
+
} else n.postMessage(e);
|
|
975
1006
|
return !0;
|
|
976
|
-
} catch (
|
|
977
|
-
return
|
|
1007
|
+
} catch (e) {
|
|
1008
|
+
return Y(n, l, `Could not return the compile result: ${U(e)}`, {
|
|
1009
|
+
traceId: u,
|
|
1010
|
+
requestId: d,
|
|
1011
|
+
sourceRevision: f
|
|
1012
|
+
}), !1;
|
|
978
1013
|
}
|
|
979
1014
|
};
|
|
980
1015
|
return n.onmessage = (e) => {
|
|
981
1016
|
let t = e?.data;
|
|
982
|
-
if (
|
|
1017
|
+
if (Tt(t)) {
|
|
983
1018
|
t.control === "dispose" ? y() : h();
|
|
984
1019
|
return;
|
|
985
1020
|
}
|
|
986
1021
|
if (!t || typeof t.id != "number") return;
|
|
987
1022
|
if (typeof t.source == "string") {
|
|
1023
|
+
let e = t, i = yt(e.options), a = e.sourcePhase === void 0 ? i?.sourcePhase : e.sourcePhase;
|
|
1024
|
+
if (a !== void 0 && !Ct(a)) {
|
|
1025
|
+
Y(n, e.id, "The requested source phase is not supported: expected \"streaming\" or \"final\"", e);
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
let o = a;
|
|
988
1029
|
h();
|
|
989
|
-
let
|
|
1030
|
+
let s = q(i), u = e.protocol === k, d = x(e.revision), f = W();
|
|
990
1031
|
try {
|
|
991
|
-
if (c !== null && c.optionsKey !==
|
|
1032
|
+
if (c !== null && c.optionsKey !== s) try {
|
|
992
1033
|
r.clear();
|
|
993
1034
|
} catch {}
|
|
994
|
-
let t =
|
|
995
|
-
l =
|
|
1035
|
+
let t = St(r, e.source, i, o), n = G(W() - f);
|
|
1036
|
+
l = d, c = {
|
|
996
1037
|
source: e.source,
|
|
997
|
-
revision:
|
|
1038
|
+
revision: d,
|
|
998
1039
|
options: i,
|
|
999
|
-
optionsKey:
|
|
1040
|
+
optionsKey: s,
|
|
1000
1041
|
result: t,
|
|
1001
|
-
deep:
|
|
1002
|
-
flatResults: e.flatResults ===
|
|
1003
|
-
|
|
1042
|
+
deep: ft(t),
|
|
1043
|
+
flatResults: e.flatResults === H,
|
|
1044
|
+
...o === void 0 ? {} : { sourcePhase: o }
|
|
1045
|
+
}, S(e, d, n, u, e.includeAuthorAnalysis === !0) && v();
|
|
1004
1046
|
} catch (t) {
|
|
1005
|
-
|
|
1047
|
+
Y(n, e.id, U(t), e);
|
|
1006
1048
|
}
|
|
1007
1049
|
return;
|
|
1008
1050
|
}
|
|
1009
1051
|
if (t.protocol !== "patch-v1") return;
|
|
1010
1052
|
h();
|
|
1011
1053
|
let i = t, a = c, o = (e, t) => {
|
|
1012
|
-
|
|
1054
|
+
wt(n, i, e, t, a?.revision);
|
|
1013
1055
|
};
|
|
1014
1056
|
if (a === null) {
|
|
1015
1057
|
o("No complete compile is available to patch", "stale-base");
|
|
1016
1058
|
return;
|
|
1017
1059
|
}
|
|
1060
|
+
if ((a.sourcePhase ?? "final") !== "final") {
|
|
1061
|
+
o("The baseline was compiled from a streaming snapshot", "phase-mismatch");
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1018
1064
|
if (typeof i.baseRevision != "number" || i.baseRevision !== a.revision) {
|
|
1019
1065
|
o("The requested base revision is not current", "stale-base");
|
|
1020
1066
|
return;
|
|
@@ -1023,7 +1069,7 @@ function _t(e, t = {}) {
|
|
|
1023
1069
|
o("The options signature changed since the baseline", "options-mismatch");
|
|
1024
1070
|
return;
|
|
1025
1071
|
}
|
|
1026
|
-
if (!
|
|
1072
|
+
if (!Et(i.edit)) {
|
|
1027
1073
|
o("The source edit is invalid", "invalid-edit");
|
|
1028
1074
|
return;
|
|
1029
1075
|
}
|
|
@@ -1037,26 +1083,27 @@ function _t(e, t = {}) {
|
|
|
1037
1083
|
o("The source edit produced an unexpected length", "invalid-edit");
|
|
1038
1084
|
return;
|
|
1039
1085
|
}
|
|
1040
|
-
let d = x(i.revision), f =
|
|
1086
|
+
let d = x(i.revision), f = W();
|
|
1041
1087
|
try {
|
|
1042
|
-
let e =
|
|
1088
|
+
let e = St(r, u, a.options, a.sourcePhase), t = G(W() - f), o = a.revision, s = a.result;
|
|
1043
1089
|
l = d, c = {
|
|
1044
1090
|
source: u,
|
|
1045
1091
|
revision: d,
|
|
1046
1092
|
options: a.options,
|
|
1047
1093
|
optionsKey: a.optionsKey,
|
|
1048
1094
|
result: e,
|
|
1049
|
-
deep:
|
|
1050
|
-
flatResults: a.flatResults
|
|
1095
|
+
deep: ft(e),
|
|
1096
|
+
flatResults: a.flatResults,
|
|
1097
|
+
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase }
|
|
1051
1098
|
};
|
|
1052
1099
|
let p = null, h = 0;
|
|
1053
1100
|
if (e.ok && s.ok && !c.deep && !a.deep) {
|
|
1054
|
-
let t =
|
|
1055
|
-
p =
|
|
1101
|
+
let t = W();
|
|
1102
|
+
p = at(s, e), h = G(W() - t);
|
|
1056
1103
|
}
|
|
1057
1104
|
let g = p?.patch ?? null;
|
|
1058
1105
|
if (g === null) {
|
|
1059
|
-
S(i
|
|
1106
|
+
S(i, d, t, !0, i.includeAuthorAnalysis === !0) && v();
|
|
1060
1107
|
return;
|
|
1061
1108
|
}
|
|
1062
1109
|
if (p !== null && p.cost.preferFull) {
|
|
@@ -1066,7 +1113,7 @@ function _t(e, t = {}) {
|
|
|
1066
1113
|
patchBytes: e.patchBytes,
|
|
1067
1114
|
...e.fullBytes === void 0 ? {} : { fullBytes: e.fullBytes }
|
|
1068
1115
|
};
|
|
1069
|
-
S(i
|
|
1116
|
+
S(i, d, t, !0, i.includeAuthorAnalysis === !0, n) && v();
|
|
1070
1117
|
return;
|
|
1071
1118
|
}
|
|
1072
1119
|
let _ = {
|
|
@@ -1078,25 +1125,31 @@ function _t(e, t = {}) {
|
|
|
1078
1125
|
try {
|
|
1079
1126
|
let s = {
|
|
1080
1127
|
id: i.id,
|
|
1128
|
+
...i.traceId === void 0 ? {} : {
|
|
1129
|
+
traceId: i.traceId,
|
|
1130
|
+
requestId: i.requestId,
|
|
1131
|
+
sourceRevision: i.sourceRevision
|
|
1132
|
+
},
|
|
1081
1133
|
ok: !0,
|
|
1082
|
-
protocol:
|
|
1134
|
+
protocol: k,
|
|
1083
1135
|
baseRevision: o,
|
|
1084
1136
|
revision: d,
|
|
1085
1137
|
patch: g,
|
|
1086
1138
|
duration: t,
|
|
1087
|
-
incremental:
|
|
1139
|
+
incremental: J(r),
|
|
1140
|
+
...a.sourcePhase === void 0 ? {} : { sourcePhase: a.sourcePhase },
|
|
1088
1141
|
metrics: _
|
|
1089
1142
|
};
|
|
1090
1143
|
if (i.includeAuthorAnalysis === !0) {
|
|
1091
|
-
let t =
|
|
1092
|
-
s.analysis =
|
|
1144
|
+
let t = W();
|
|
1145
|
+
s.analysis = K(u, a.options, e), _.analysisMs = G(W() - t);
|
|
1093
1146
|
}
|
|
1094
1147
|
n.postMessage(s), v();
|
|
1095
1148
|
} catch (e) {
|
|
1096
|
-
|
|
1149
|
+
Y(n, i.id, `Could not return the compile result: ${U(e)}`, i);
|
|
1097
1150
|
}
|
|
1098
1151
|
} catch (e) {
|
|
1099
|
-
|
|
1152
|
+
Y(n, i.id, U(e), i);
|
|
1100
1153
|
}
|
|
1101
1154
|
}, {
|
|
1102
1155
|
dispose: y,
|
|
@@ -1107,7 +1160,7 @@ function _t(e, t = {}) {
|
|
|
1107
1160
|
};
|
|
1108
1161
|
}
|
|
1109
1162
|
// src/local/transport/worker.ts
|
|
1110
|
-
function
|
|
1163
|
+
function Ot(e, t) {
|
|
1111
1164
|
if (!e || typeof e != "object") return !1;
|
|
1112
1165
|
let n = e, r = (e) => e && Number.isSafeInteger(e.start) && Number.isSafeInteger(e.end) && e.start >= 0 && e.end >= e.start && e.end <= t;
|
|
1113
1166
|
if (!Array.isArray(n.tokens) || n.tokens.length > t + 1 || !Array.isArray(n.bindings) || n.bindings.length > t + 1 || !Array.isArray(n.diagnostics)) return !1;
|
|
@@ -1119,30 +1172,83 @@ function vt(e, t) {
|
|
|
1119
1172
|
for (let e of n.bindings) if (!e || typeof e.name != "string" || !Array.isArray(e.declarations) || !Array.isArray(e.references) || (a += e.declarations.length + e.references.length, a > t + 1 || !e.declarations.every(r) || !e.references.every(r))) return !1;
|
|
1120
1173
|
return !0;
|
|
1121
1174
|
}
|
|
1122
|
-
function
|
|
1123
|
-
let
|
|
1175
|
+
function kt(e, t, n) {
|
|
1176
|
+
let r = yt(t), i = n === void 0 ? At(t) : n, a = i === "streaming" || i === "final" ? i : void 0, o = i !== void 0 && a === void 0 ? i : void 0;
|
|
1124
1177
|
return {
|
|
1125
1178
|
source: e,
|
|
1126
|
-
options:
|
|
1127
|
-
optionsKey:
|
|
1128
|
-
scheduledAt:
|
|
1179
|
+
options: r,
|
|
1180
|
+
optionsKey: q(r),
|
|
1181
|
+
scheduledAt: W(),
|
|
1182
|
+
sourcePhase: a === "streaming" ? "streaming" : "final",
|
|
1183
|
+
explicitPhase: i !== void 0,
|
|
1184
|
+
...o === void 0 ? {} : { invalidPhase: o }
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
function At(e) {
|
|
1188
|
+
try {
|
|
1189
|
+
return !e || typeof e != "object" || Array.isArray(e) ? void 0 : e.sourcePhase;
|
|
1190
|
+
} catch {
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
function X(e, t) {
|
|
1195
|
+
return e.source === t.source && e.optionsKey === t.optionsKey && e.sourcePhase === t.sourcePhase && e.explicitPhase === t.explicitPhase && e.invalidPhase === t.invalidPhase;
|
|
1196
|
+
}
|
|
1197
|
+
function Z(e) {
|
|
1198
|
+
return e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {};
|
|
1199
|
+
}
|
|
1200
|
+
function Q(e, t) {
|
|
1201
|
+
return e.explicitPhase ? {
|
|
1202
|
+
ok: !1,
|
|
1203
|
+
diagnostics: [t],
|
|
1204
|
+
status: "failed"
|
|
1205
|
+
} : {
|
|
1206
|
+
ok: !1,
|
|
1207
|
+
diagnostics: [t]
|
|
1129
1208
|
};
|
|
1130
1209
|
}
|
|
1131
|
-
function
|
|
1132
|
-
return
|
|
1210
|
+
function jt() {
|
|
1211
|
+
return {
|
|
1212
|
+
ok: !1,
|
|
1213
|
+
status: "failed",
|
|
1214
|
+
diagnostics: [{
|
|
1215
|
+
code: "local.options.invalid",
|
|
1216
|
+
message: "Compile option sourcePhase must be \"streaming\" or \"final\".",
|
|
1217
|
+
severity: "error",
|
|
1218
|
+
range: {
|
|
1219
|
+
start: 0,
|
|
1220
|
+
end: 0
|
|
1221
|
+
},
|
|
1222
|
+
line: 1,
|
|
1223
|
+
column: 1,
|
|
1224
|
+
messageKey: "local.options.invalid.source-phase",
|
|
1225
|
+
phase: "host",
|
|
1226
|
+
recoverable: !1
|
|
1227
|
+
}]
|
|
1228
|
+
};
|
|
1133
1229
|
}
|
|
1134
|
-
function
|
|
1230
|
+
function Mt(e) {
|
|
1135
1231
|
if (!e || typeof e != "object") return !1;
|
|
1136
1232
|
let t = e;
|
|
1137
1233
|
return !(typeof t.ok != "boolean" || !Array.isArray(t.diagnostics) || t.ok && (!t.document || typeof t.document != "object"));
|
|
1138
1234
|
}
|
|
1139
|
-
function
|
|
1235
|
+
function Nt(e) {
|
|
1140
1236
|
return e.ok && "patch" in e && e.patch !== void 0;
|
|
1141
1237
|
}
|
|
1238
|
+
var Pt = 160;
|
|
1239
|
+
function Ft(e) {
|
|
1240
|
+
let t = U(e).trim();
|
|
1241
|
+
return t.length === 0 ? "" : t.length > Pt ? `${v(t, 159)}…` : t;
|
|
1242
|
+
}
|
|
1142
1243
|
function $(e) {
|
|
1244
|
+
let t = Ft(e);
|
|
1143
1245
|
return {
|
|
1144
1246
|
code: "local.worker.compile",
|
|
1145
|
-
|
|
1247
|
+
messageKey: t ? "local.worker.compile.detail" : "local.worker.compile",
|
|
1248
|
+
...t ? { params: { detail: t } } : {},
|
|
1249
|
+
phase: "worker",
|
|
1250
|
+
recoverable: !1,
|
|
1251
|
+
message: t ? `Compilation failed: ${t}` : "Compilation failed",
|
|
1146
1252
|
severity: "error",
|
|
1147
1253
|
range: {
|
|
1148
1254
|
start: 0,
|
|
@@ -1152,7 +1258,7 @@ function $(e) {
|
|
|
1152
1258
|
column: 1
|
|
1153
1259
|
};
|
|
1154
1260
|
}
|
|
1155
|
-
var
|
|
1261
|
+
var It = class {
|
|
1156
1262
|
options;
|
|
1157
1263
|
delay;
|
|
1158
1264
|
worker = null;
|
|
@@ -1161,11 +1267,18 @@ var xt = class {
|
|
|
1161
1267
|
inFlight = null;
|
|
1162
1268
|
nextId = 1;
|
|
1163
1269
|
nextRevision = 1;
|
|
1270
|
+
nextSourceRevision = 1;
|
|
1271
|
+
currentSourceRevision = 0;
|
|
1164
1272
|
pending = !1;
|
|
1165
1273
|
fallbackSession = null;
|
|
1166
1274
|
disposed = !1;
|
|
1275
|
+
timeout = null;
|
|
1276
|
+
requestContexts = /* @__PURE__ */ new Map();
|
|
1277
|
+
obsoleteRequestIds = /* @__PURE__ */ new Set();
|
|
1278
|
+
reportedStaleRequestIds = /* @__PURE__ */ new Set();
|
|
1167
1279
|
baseline = null;
|
|
1168
1280
|
patchState = "unknown";
|
|
1281
|
+
startupFailure = null;
|
|
1169
1282
|
constructor(e) {
|
|
1170
1283
|
this.options = e;
|
|
1171
1284
|
let t = e.delay;
|
|
@@ -1177,20 +1290,26 @@ var xt = class {
|
|
|
1177
1290
|
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1178
1291
|
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1179
1292
|
} catch (t) {
|
|
1180
|
-
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${
|
|
1293
|
+
this.worker = null, this.startupFailure = Ft(t), e.onModeChange?.("fallback", `Could not start the compile worker: ${U(t)}`);
|
|
1181
1294
|
}
|
|
1182
1295
|
}
|
|
1183
|
-
schedule(e, t, n) {
|
|
1184
|
-
|
|
1296
|
+
schedule(e, t, n, r) {
|
|
1297
|
+
if (this.disposed) return;
|
|
1298
|
+
let i = {
|
|
1299
|
+
...kt(e, t, r),
|
|
1300
|
+
sourceRevision: this.nextSourceRevision++,
|
|
1301
|
+
traceId: ne()
|
|
1302
|
+
};
|
|
1303
|
+
this.currentSourceRevision = i.sourceRevision, this.inFlight && !X(this.inFlight.job, i) && this.obsoleteRequestIds.add(this.inFlight.id), this.queued = i, n && typeof n.baseSource == "string" && Et(n.edit) && n.edit.to <= n.baseSource.length && n.baseSource.slice(0, n.edit.from) + n.edit.insert + n.baseSource.slice(n.edit.to) === e && (this.queued.editHint = {
|
|
1185
1304
|
baseSource: n.baseSource,
|
|
1186
1305
|
edit: { ...n.edit }
|
|
1187
|
-
}), this.clearTimer(), this.timer = setTimeout(() => {
|
|
1306
|
+
}), this.clearTimer(), i.sourcePhase === "streaming" && (this.baseline = null), this.setPending(!0), i.sourcePhase === "streaming" || !i.explicitPhase ? this.timer = setTimeout(() => {
|
|
1188
1307
|
this.timer = null, this.drain();
|
|
1189
|
-
}, this.delay)
|
|
1308
|
+
}, this.delay) : this.drain();
|
|
1190
1309
|
}
|
|
1191
1310
|
dispose() {
|
|
1192
1311
|
if (this.disposed) return;
|
|
1193
|
-
this.disposed = !0, this.clearTimer(), this.queued = null, this.inFlight = null, this.resetProtocol();
|
|
1312
|
+
this.disposed = !0, this.inFlight && (this.traceWorker(this.inFlight, "worker-cancel", { status: "disposed" }), this.obsoleteRequestIds.add(this.inFlight.id)), this.timeout !== null && clearTimeout(this.timeout), this.timeout = null, this.clearTimer(), this.queued = null, this.inFlight = null, this.resetProtocol();
|
|
1194
1313
|
let e = this.worker;
|
|
1195
1314
|
if (this.worker = null, e) {
|
|
1196
1315
|
e.onmessage = null, e.onerror = null, e.onmessageerror = null;
|
|
@@ -1206,17 +1325,32 @@ var xt = class {
|
|
|
1206
1325
|
e === null ? this.setPending(!1) : (this.queued = null, this.compile(e));
|
|
1207
1326
|
}
|
|
1208
1327
|
compile(e) {
|
|
1328
|
+
if (e.invalidPhase !== void 0) {
|
|
1329
|
+
this.deliver(e, {
|
|
1330
|
+
source: e.source,
|
|
1331
|
+
result: jt(),
|
|
1332
|
+
duration: 0,
|
|
1333
|
+
mode: this.worker === null ? "fallback" : "worker",
|
|
1334
|
+
...e.options === void 0 ? {} : { options: e.options },
|
|
1335
|
+
metrics: { queueMs: G(W() - e.scheduledAt) }
|
|
1336
|
+
}), this.finishRun();
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1209
1339
|
let t = this.worker;
|
|
1210
1340
|
if (!t) {
|
|
1211
1341
|
this.compileFallback(e);
|
|
1212
1342
|
return;
|
|
1213
1343
|
}
|
|
1214
|
-
|
|
1344
|
+
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1345
|
+
let n = this.nextId++, r = this.nextRevision++, { traceId: i, sourceRevision: a } = e, o = W(), s = this.baseline, c = e.sourcePhase === "final" && this.patchState === "enabled" && s !== null && s.optionsKey === e.optionsKey ? {
|
|
1346
|
+
traceId: i,
|
|
1347
|
+
requestId: n,
|
|
1348
|
+
sourceRevision: a,
|
|
1215
1349
|
id: n,
|
|
1216
|
-
protocol:
|
|
1217
|
-
baseRevision:
|
|
1350
|
+
protocol: k,
|
|
1351
|
+
baseRevision: s.revision,
|
|
1218
1352
|
revision: r,
|
|
1219
|
-
edit: e.editHint?.baseSource ===
|
|
1353
|
+
edit: e.editHint?.baseSource === s.source ? e.editHint.edit : I(s.source, e.source) ?? {
|
|
1220
1354
|
from: 0,
|
|
1221
1355
|
to: 0,
|
|
1222
1356
|
insert: ""
|
|
@@ -1224,61 +1358,135 @@ var xt = class {
|
|
|
1224
1358
|
targetLength: e.source.length,
|
|
1225
1359
|
optionsKey: e.optionsKey
|
|
1226
1360
|
} : {
|
|
1361
|
+
traceId: i,
|
|
1362
|
+
requestId: n,
|
|
1363
|
+
sourceRevision: a,
|
|
1227
1364
|
id: n,
|
|
1228
1365
|
source: e.source,
|
|
1229
1366
|
...e.options === void 0 ? {} : { options: e.options },
|
|
1230
|
-
protocol:
|
|
1367
|
+
protocol: k,
|
|
1231
1368
|
revision: r,
|
|
1232
|
-
flatResults:
|
|
1233
|
-
|
|
1234
|
-
|
|
1369
|
+
flatResults: H,
|
|
1370
|
+
...e.sourcePhase === "streaming" || e.explicitPhase ? { sourcePhase: e.sourcePhase } : {}
|
|
1371
|
+
}, l = {
|
|
1235
1372
|
id: n,
|
|
1236
1373
|
job: e,
|
|
1237
|
-
startedAt:
|
|
1238
|
-
revision: r
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1374
|
+
startedAt: o,
|
|
1375
|
+
revision: r,
|
|
1376
|
+
traceId: i,
|
|
1377
|
+
sourceRevision: a
|
|
1378
|
+
};
|
|
1379
|
+
this.inFlight = l;
|
|
1380
|
+
let u = this.options.timeoutMs, d = typeof u == "number" && Number.isFinite(u) && u > 0 ? Math.min(2147483647, Math.ceil(u)) : 3e4;
|
|
1381
|
+
for (this.requestContexts.set(n, {
|
|
1382
|
+
traceId: i,
|
|
1383
|
+
sourceRevision: a
|
|
1384
|
+
}); this.requestContexts.size > 128;) {
|
|
1385
|
+
let e = this.requestContexts.keys().next().value;
|
|
1386
|
+
if (e === void 0) break;
|
|
1387
|
+
this.requestContexts.delete(e), this.obsoleteRequestIds.delete(e), this.reportedStaleRequestIds.delete(e);
|
|
1388
|
+
}
|
|
1389
|
+
if (this.timeout = setTimeout(() => {
|
|
1390
|
+
if (this.inFlight?.id !== n) return;
|
|
1391
|
+
let e = {
|
|
1392
|
+
...O("local.worker.timeout", {
|
|
1393
|
+
timeoutMs: d,
|
|
1394
|
+
requestId: n,
|
|
1395
|
+
sourceRevision: a
|
|
1396
|
+
}),
|
|
1397
|
+
phase: "worker"
|
|
1398
|
+
};
|
|
1399
|
+
this.obsoleteRequestIds.add(n), this.handleWorkerFailure(e.message, e);
|
|
1400
|
+
}, d), this.traceWorker(l, "worker-request"), !(this.disposed || this.inFlight !== l)) {
|
|
1401
|
+
this.options.includeAuthorAnalysis && (c.includeAuthorAnalysis = !0);
|
|
1402
|
+
try {
|
|
1403
|
+
t.postMessage(c);
|
|
1404
|
+
} catch (e) {
|
|
1405
|
+
this.obsoleteRequestIds.add(n), this.handleWorkerFailure(`Could not send the source to the compile worker: ${U(e)}`);
|
|
1248
1406
|
}
|
|
1249
|
-
r !== null && (this.queued = null, this.clearTimer()), this.resetProtocol(), this.degrade(n), this.compileFallback(e);
|
|
1250
1407
|
}
|
|
1251
1408
|
}
|
|
1252
1409
|
compileFallback(e) {
|
|
1253
1410
|
if (this.disposed) return;
|
|
1254
|
-
|
|
1411
|
+
e.sourcePhase === "streaming" && (this.baseline = null);
|
|
1412
|
+
let t = W(), { traceId: n, sourceRevision: r } = e;
|
|
1413
|
+
if (!this.isCurrentJob(e) || (T(this.options.observer, {
|
|
1414
|
+
type: "compile-start",
|
|
1415
|
+
traceId: n,
|
|
1416
|
+
sourceRevision: r,
|
|
1417
|
+
timestamp: Date.now(),
|
|
1418
|
+
status: "fallback"
|
|
1419
|
+
}), !this.isCurrentJob(e))) {
|
|
1420
|
+
this.finishRun();
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
let i;
|
|
1255
1424
|
try {
|
|
1256
|
-
let t = this.options.fallbackCompile ?? ((e, t) => (this.fallbackSession ??=
|
|
1257
|
-
|
|
1258
|
-
} catch (
|
|
1259
|
-
|
|
1260
|
-
ok: !1,
|
|
1261
|
-
diagnostics: [$(e)]
|
|
1262
|
-
};
|
|
1425
|
+
let t = this.options.fallbackCompile ?? ((e, t, n) => (this.fallbackSession ??= D(), this.fallbackSession.compile(e, t, n)));
|
|
1426
|
+
i = e.explicitPhase ? t(e.source, e.options, e.sourcePhase) : e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1427
|
+
} catch (t) {
|
|
1428
|
+
i = Q(e, $(t));
|
|
1263
1429
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1430
|
+
let a = G(W() - t);
|
|
1431
|
+
if (!this.isCurrentJob(e)) this.finishRun();
|
|
1432
|
+
else {
|
|
1433
|
+
if (this.startupFailure !== null) {
|
|
1434
|
+
let t = this.startupFailure;
|
|
1435
|
+
if (this.startupFailure = null, T(this.options.observer, {
|
|
1436
|
+
type: "worker-error",
|
|
1437
|
+
traceId: n,
|
|
1438
|
+
sourceRevision: r,
|
|
1439
|
+
timestamp: Date.now(),
|
|
1440
|
+
status: "failed",
|
|
1441
|
+
code: "local.worker.startup",
|
|
1442
|
+
...t ? { detail: t } : {}
|
|
1443
|
+
}), !this.isCurrentJob(e)) {
|
|
1444
|
+
this.finishRun();
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
T(this.options.observer, {
|
|
1449
|
+
type: "compile-end",
|
|
1450
|
+
traceId: n,
|
|
1451
|
+
sourceRevision: r,
|
|
1452
|
+
timestamp: Date.now(),
|
|
1453
|
+
durationMs: a,
|
|
1454
|
+
status: i.ok ? "ok" : "failed"
|
|
1455
|
+
}), this.isCurrentJob(e) && this.deliver(e, {
|
|
1456
|
+
source: e.source,
|
|
1457
|
+
result: i,
|
|
1458
|
+
duration: a,
|
|
1459
|
+
mode: "fallback",
|
|
1460
|
+
...this.options.includeAuthorAnalysis ? { analysis: K(e.source, e.options, i) } : {},
|
|
1461
|
+
...e.options === void 0 ? {} : { options: e.options },
|
|
1462
|
+
...Z(e),
|
|
1463
|
+
metrics: { queueMs: G(t - e.scheduledAt) }
|
|
1464
|
+
}), this.finishRun();
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
isCurrentJob(e) {
|
|
1468
|
+
return !this.disposed && e.sourceRevision === this.currentSourceRevision;
|
|
1273
1469
|
}
|
|
1274
1470
|
receive(e) {
|
|
1275
1471
|
if (this.disposed) return;
|
|
1276
1472
|
let t = this.inFlight;
|
|
1277
|
-
if (!
|
|
1473
|
+
if (!e) return;
|
|
1474
|
+
if (t && e.id === t.id && (e.requestId !== void 0 && e.requestId !== t.id || e.traceId !== void 0 && e.traceId !== t.traceId || e.sourceRevision !== void 0 && e.sourceRevision !== t.sourceRevision)) {
|
|
1475
|
+
this.reportStale(t.id, t.traceId, t.sourceRevision, this.queued?.sourceRevision), this.handleWorkerFailure("The compile worker returned a response with a mismatched request context.");
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
if (!t || e.id !== t.id) {
|
|
1479
|
+
if (Number.isSafeInteger(e.id) && e.id > 0 && this.obsoleteRequestIds.has(e.id)) {
|
|
1480
|
+
let t = this.requestContexts.get(e.id);
|
|
1481
|
+
t && this.reportStale(e.id, t.traceId, t.sourceRevision, this.queued?.sourceRevision);
|
|
1482
|
+
}
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
this.timeout !== null && clearTimeout(this.timeout), this.timeout = null;
|
|
1278
1486
|
let n, r = 0;
|
|
1279
1487
|
if (e.ok && "flatResult" in e) {
|
|
1280
|
-
let t =
|
|
1281
|
-
r =
|
|
1488
|
+
let t = W(), i = mt(e.flatResult);
|
|
1489
|
+
r = G(W() - t), n = Mt(i) ? {
|
|
1282
1490
|
...e,
|
|
1283
1491
|
result: i
|
|
1284
1492
|
} : {
|
|
@@ -1289,14 +1497,14 @@ var xt = class {
|
|
|
1289
1497
|
};
|
|
1290
1498
|
} else n = e;
|
|
1291
1499
|
this.inFlight = null;
|
|
1292
|
-
let i = t.job, a =
|
|
1500
|
+
let i = t.job, a = G(W() - t.startedAt), o = G(t.startedAt - i.scheduledAt), s = null, c = r, l = null, u = "worker", d;
|
|
1293
1501
|
if (n.ok) {
|
|
1294
|
-
if (
|
|
1295
|
-
let e =
|
|
1296
|
-
c =
|
|
1502
|
+
if (Nt(n)) {
|
|
1503
|
+
let e = W(), t = this.applyResponsePatch(i, n);
|
|
1504
|
+
c = G(W() - e), t !== null && (s = t, d = n.revision);
|
|
1297
1505
|
} else {
|
|
1298
1506
|
let e = n;
|
|
1299
|
-
|
|
1507
|
+
Mt(e.result) ? (s = e.result, d = typeof e.revision == "number" ? e.revision : void 0, i.sourcePhase === "streaming" || e.sourcePhase === "streaming" ? this.baseline = null : e.protocol === "patch-v1" && typeof e.revision == "number" && Number.isSafeInteger(e.revision) ? (this.patchState = "enabled", this.baseline = e.result.ok ? {
|
|
1300
1508
|
source: i.source,
|
|
1301
1509
|
optionsKey: i.optionsKey,
|
|
1302
1510
|
revision: e.revision,
|
|
@@ -1304,74 +1512,108 @@ var xt = class {
|
|
|
1304
1512
|
} : null) : (this.patchState = "legacy", this.baseline = null)) : l = "The compile worker returned an invalid result";
|
|
1305
1513
|
}
|
|
1306
1514
|
} else n.retryFull !== !0 && (l = n.message);
|
|
1307
|
-
let f = this.queued, p = f !== null && !
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1515
|
+
let f = this.queued, p = f !== null && !X(f, i);
|
|
1516
|
+
if (l === null ? this.traceWorker(t, "worker-response", {
|
|
1517
|
+
durationMs: a,
|
|
1518
|
+
status: s ? s.ok ? "ok" : "failed" : l ? "failed" : "retry"
|
|
1519
|
+
}) : this.traceWorker(t, "worker-error", {
|
|
1520
|
+
durationMs: a,
|
|
1521
|
+
status: "failed",
|
|
1522
|
+
code: "local.worker.compile"
|
|
1523
|
+
}), !this.disposed) {
|
|
1524
|
+
if (p && (this.obsoleteRequestIds.add(t.id), this.reportStale(t.id, t.traceId, t.sourceRevision, f.sourceRevision)), f !== null && !p && this.queued === f && (this.queued = null, this.clearTimer(), this.currentSourceRevision = i.sourceRevision), s !== null) p || this.deliver(i, {
|
|
1525
|
+
source: i.source,
|
|
1526
|
+
result: s,
|
|
1527
|
+
duration: G(n.ok ? n.duration : 0),
|
|
1528
|
+
mode: u,
|
|
1529
|
+
...n.ok && this.options.includeAuthorAnalysis && Ot(n.analysis, i.source.length) ? { analysis: n.analysis } : {},
|
|
1530
|
+
...i.options === void 0 ? {} : { options: i.options },
|
|
1531
|
+
...Z(i),
|
|
1532
|
+
metrics: {
|
|
1533
|
+
queueMs: o,
|
|
1534
|
+
roundTripMs: a,
|
|
1535
|
+
...c > 0 ? { applyMs: c } : {},
|
|
1536
|
+
...n.ok && n.metrics ? { worker: n.metrics } : {}
|
|
1537
|
+
},
|
|
1538
|
+
...d === void 0 ? {} : { revision: d }
|
|
1539
|
+
}), this.finishRun();
|
|
1540
|
+
else if (l !== null) p || this.deliver(i, {
|
|
1541
|
+
source: i.source,
|
|
1542
|
+
result: Q(i, $(l)),
|
|
1543
|
+
duration: 0,
|
|
1544
|
+
mode: u,
|
|
1545
|
+
...i.options === void 0 ? {} : { options: i.options },
|
|
1546
|
+
...Z(i),
|
|
1547
|
+
metrics: {
|
|
1548
|
+
queueMs: o,
|
|
1549
|
+
roundTripMs: a
|
|
1550
|
+
}
|
|
1551
|
+
}), this.finishRun();
|
|
1552
|
+
else {
|
|
1553
|
+
if (p) this.inFlight === null && this.resetProtocol();
|
|
1554
|
+
else {
|
|
1555
|
+
let e = this.recoverWithFullResult(i);
|
|
1556
|
+
if (e === "dispatched") return;
|
|
1557
|
+
e !== "abandoned" && (this.patchState = "disabled", this.baseline = null, this.deliver(i, {
|
|
1558
|
+
source: i.source,
|
|
1559
|
+
result: Q(i, $("The compile worker could not apply an incremental result patch")),
|
|
1560
|
+
duration: 0,
|
|
1561
|
+
mode: u,
|
|
1562
|
+
...i.options === void 0 ? {} : { options: i.options },
|
|
1563
|
+
...Z(i),
|
|
1564
|
+
metrics: {
|
|
1565
|
+
queueMs: o,
|
|
1566
|
+
roundTripMs: a,
|
|
1567
|
+
...c > 0 ? { applyMs: c } : {}
|
|
1568
|
+
}
|
|
1569
|
+
}));
|
|
1570
|
+
}
|
|
1571
|
+
this.finishRun();
|
|
1334
1572
|
}
|
|
1335
|
-
}
|
|
1336
|
-
source: i.source,
|
|
1337
|
-
result: s,
|
|
1338
|
-
duration: K(n.ok ? n.duration : 0),
|
|
1339
|
-
mode: u,
|
|
1340
|
-
...n.ok && this.options.includeAuthorAnalysis && vt(n.analysis, i.source.length) ? { analysis: n.analysis } : {},
|
|
1341
|
-
...i.options === void 0 ? {} : { options: i.options },
|
|
1342
|
-
metrics: {
|
|
1343
|
-
queueMs: o,
|
|
1344
|
-
roundTripMs: a,
|
|
1345
|
-
...c > 0 ? { applyMs: c } : {},
|
|
1346
|
-
...n.ok && n.metrics ? { worker: n.metrics } : {}
|
|
1347
|
-
},
|
|
1348
|
-
...d === void 0 ? {} : { revision: d }
|
|
1349
|
-
}), this.finishRun());
|
|
1573
|
+
}
|
|
1350
1574
|
}
|
|
1351
1575
|
applyResponsePatch(e, t) {
|
|
1576
|
+
if (e.sourcePhase !== "final") return null;
|
|
1352
1577
|
let n = this.baseline;
|
|
1353
1578
|
if (n === null || n.optionsKey !== e.optionsKey || !Number.isSafeInteger(t.revision) || t.revision <= n.revision || t.baseRevision !== n.revision || t.protocol !== "patch-v1") return null;
|
|
1354
|
-
let r =
|
|
1355
|
-
|
|
1579
|
+
let r = dt(n.result, t.patch);
|
|
1580
|
+
if (r === null || !r.ok || r.document.source !== e.source) return null;
|
|
1581
|
+
let i;
|
|
1582
|
+
if (e.sourcePhase === "final" && e.explicitPhase) i = r.recoveries === void 0 ? {
|
|
1583
|
+
...r,
|
|
1584
|
+
status: "valid"
|
|
1585
|
+
} : {
|
|
1586
|
+
...r,
|
|
1587
|
+
status: "recovered"
|
|
1588
|
+
};
|
|
1589
|
+
else if (r.ok && r.status !== void 0) {
|
|
1590
|
+
let e = { ...r };
|
|
1591
|
+
delete e.status, i = e;
|
|
1592
|
+
} else i = r;
|
|
1593
|
+
return this.baseline = {
|
|
1356
1594
|
source: e.source,
|
|
1357
1595
|
optionsKey: e.optionsKey,
|
|
1358
1596
|
revision: t.revision,
|
|
1359
|
-
result:
|
|
1360
|
-
},
|
|
1597
|
+
result: i
|
|
1598
|
+
}, i;
|
|
1361
1599
|
}
|
|
1362
1600
|
recoverWithFullResult(e) {
|
|
1363
|
-
|
|
1364
|
-
let t = this.queued;
|
|
1365
|
-
return t !== null && !Z(t, e) ? !1 : (t !== null && (this.queued = null, this.clearTimer()), this.resetProtocol(), this.compile({
|
|
1601
|
+
return this.worker === null || (e.recovery ?? 0) >= 1 ? "spent" : this.disposed || this.inFlight !== null || !this.isCurrentJob(e) ? "abandoned" : (this.resetProtocol(), this.compile({
|
|
1366
1602
|
...e,
|
|
1367
1603
|
recovery: (e.recovery ?? 0) + 1
|
|
1368
|
-
}),
|
|
1604
|
+
}), "dispatched");
|
|
1369
1605
|
}
|
|
1370
|
-
handleWorkerFailure(e
|
|
1606
|
+
handleWorkerFailure(e, t = {
|
|
1607
|
+
...O("local.worker.error"),
|
|
1608
|
+
recoverable: !0
|
|
1609
|
+
}) {
|
|
1371
1610
|
if (this.disposed) return;
|
|
1372
|
-
this.
|
|
1373
|
-
let
|
|
1374
|
-
this.inFlight = null,
|
|
1611
|
+
this.timeout !== null && clearTimeout(this.timeout), this.timeout = null, this.resetProtocol();
|
|
1612
|
+
let n = this.inFlight;
|
|
1613
|
+
this.inFlight = null, n && this.obsoleteRequestIds.add(n.id), this.degrade(e), !this.disposed && (n && this.traceWorker(n, t.code === "local.worker.timeout" ? "worker-timeout" : "worker-error", {
|
|
1614
|
+
code: t.code,
|
|
1615
|
+
durationMs: G(W() - n.startedAt)
|
|
1616
|
+
}), !this.disposed && (w(this.options.observer, t), !this.disposed && (n && (this.queued === null || X(this.queued, n.job)) && (this.queued !== null && (this.queued = null, this.clearTimer(), this.currentSourceRevision = n.job.sourceRevision), this.compileFallback(n.job)), this.finishRun())));
|
|
1375
1617
|
}
|
|
1376
1618
|
degrade(e) {
|
|
1377
1619
|
let t = this.worker;
|
|
@@ -1389,14 +1631,48 @@ var xt = class {
|
|
|
1389
1631
|
finishRun() {
|
|
1390
1632
|
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.queued !== null));
|
|
1391
1633
|
}
|
|
1392
|
-
deliver(e) {
|
|
1393
|
-
if (this.
|
|
1394
|
-
let
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1634
|
+
deliver(e, t) {
|
|
1635
|
+
if (!this.isCurrentJob(e)) return;
|
|
1636
|
+
let n = this.baseline !== null && this.baseline.result === t.result, r = this.options.shareResults === !0 || !n ? t.result : F(t.result);
|
|
1637
|
+
for (let t of [...r.diagnostics, ...r.transientDiagnostics ?? []]) {
|
|
1638
|
+
if (!this.isCurrentJob(e)) return;
|
|
1639
|
+
w(this.options.observer, t);
|
|
1640
|
+
}
|
|
1641
|
+
this.isCurrentJob(e) && this.options.onResult({
|
|
1642
|
+
...t,
|
|
1643
|
+
result: r
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
traceWorker(e, t, n = {}) {
|
|
1647
|
+
T(this.options.observer, {
|
|
1648
|
+
type: t,
|
|
1649
|
+
traceId: e.traceId,
|
|
1650
|
+
requestId: e.id,
|
|
1651
|
+
sourceRevision: e.sourceRevision,
|
|
1652
|
+
timestamp: Date.now(),
|
|
1653
|
+
...n
|
|
1398
1654
|
});
|
|
1399
1655
|
}
|
|
1656
|
+
reportStale(e, t, n, r) {
|
|
1657
|
+
if (this.disposed || this.reportedStaleRequestIds.has(e)) return;
|
|
1658
|
+
this.reportedStaleRequestIds.add(e);
|
|
1659
|
+
let i = "local.worker.stale-response", a = {
|
|
1660
|
+
...O(i, {
|
|
1661
|
+
requestId: e,
|
|
1662
|
+
sourceRevision: n,
|
|
1663
|
+
...r === void 0 ? {} : { currentRevision: r }
|
|
1664
|
+
}),
|
|
1665
|
+
phase: "worker"
|
|
1666
|
+
};
|
|
1667
|
+
T(this.options.observer, {
|
|
1668
|
+
type: "worker-stale-response",
|
|
1669
|
+
traceId: t,
|
|
1670
|
+
requestId: e,
|
|
1671
|
+
sourceRevision: n,
|
|
1672
|
+
timestamp: Date.now(),
|
|
1673
|
+
code: i
|
|
1674
|
+
}), !this.disposed && w(this.options.observer, a);
|
|
1675
|
+
}
|
|
1400
1676
|
setPending(e) {
|
|
1401
1677
|
this.pending !== e && (this.pending = e, this.options.onPendingChange?.(e));
|
|
1402
1678
|
}
|
|
@@ -1404,4 +1680,4 @@ var xt = class {
|
|
|
1404
1680
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1405
1681
|
}
|
|
1406
1682
|
};
|
|
1407
|
-
export {
|
|
1683
|
+
export { g as DEFAULT_LOCAL_THEME, ht as LOCAL_COMPILE_DELAY_MS, gt as LOCAL_COMPILE_PREPARATION_DELAY_MS, a as LOCAL_DIAGNOSTIC_CODES, p as LOCAL_OBSERVABILITY_MESSAGES, k as LOCAL_RESULT_PATCH_PROTOCOL, xe as LOCAL_STATE_FORMAT, C as LOCAL_SYNTAX_VERSION, d as LOCAL_THEME_PROTOCOL, It as LocalCompileScheduler, ce as LocalCompileSession, y as LocalExpressionError, ke as SHAREABLE_HTML_FORMAT, Ee as SHAREABLE_HTML_FORMAT_V2, se as analyzeLocalSource, dt as applyLocalResultPatch, De as applyLocalState, le as applyLocalStateRetention, qe as applySourceEdit, Ue as checkLocalUpgrade, b as compileExpression, $ as compileFailureDiagnostic, n as compileLatex, re as compileLocal, t as compilePlotFormula, ae as completeLocalSource, i as countLocalCodePoints, Me as createDiagnosticReport, D as createLocalCompileSession, O as createLocalObservabilityDiagnostic, de as createLocalRuntime, Te as createLocalStateFile, ne as createLocalTraceId, Oe as createShareableHtml, I as diffSourceEdit, w as emitLocalDiagnostic, T as emitLocalTrace, it as encodeLocalResultPatch, Ce as exportLocalState, h as formatLocalDiagnostic, oe as formatLocalSource, u as formatObservabilityMessage, e as implicitGridSize, Se as importLocalState, Be as inspectLocalSourceVersion, o as isLocalDiagnosticCode, m as isLocalThemeName, te as localCompileOptionsKey, _ as localDiagnosticTemplate, s as localDiagnosticTemplateKeys, me as localSourceDigest, q as localWorkerOptionsKey, We as migrateLocalSource, pe as notifyLocalRuntime, ye as parseLocalState, fe as planLocalStateRetention, r as plotFormulaKind, ie as renameLocalBinding, Ne as resolveLocalComponentStateExport, Ae as resolveLocalState, we as resolveLocalStateBaseline, c as resolveLocalTheme, ve as sampleImplicit, ge as sampleParametric, _e as samplePlot, he as samplePolar, be as serializeForScript, je as serializeLocalState, Dt as startLocalCompileWorker, ue as updateLocalRuntime };
|