peachsim 0.1.2935 → 0.1.2937
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/LICENSE +6 -8
- package/cli/account-gate.ts +20 -3
- package/cli/app-bundle-resources.ts +66 -19
- package/cli/catalog/meta.ts +2 -106
- package/cli/command-agent.ts +7 -0
- package/cli/command-registry.ts +0 -1
- package/cli/commands/control.ts +13 -5
- package/cli/commands/daemon.ts +4 -2
- package/cli/commands/device.ts +78 -8
- package/cli/commands/do-chain.ts +11 -8
- package/cli/commands/inspect/core.ts +4 -9
- package/cli/commands/inspect/settling.ts +1 -0
- package/cli/commands/logout.ts +6 -1
- package/cli/commands/map.ts +2 -6
- package/cli/commands/package.ts +112 -57
- package/cli/commands/shell-url.ts +0 -1
- package/cli/download-auth.ts +2 -0
- package/cli/drivers/playwright-provisioning.ts +10 -38
- package/cli/github-workflow-identity.ts +8 -0
- package/cli/internal-child-contract.ts +1 -0
- package/cli/internal-child.ts +5 -0
- package/cli/main.ts +2 -10
- package/cli/outbound-endpoints.ts +26 -0
- package/detox/index.ts +227 -131
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +47 -3
- package/dist-lib/bridge-contract-input.mjs +6 -6
- package/dist-lib/bridge-contract.cjs +10 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +12779 -9515
- package/dist-lib/capture-contract.cjs +39 -17
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +8 -8
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +6 -6
- package/dist-lib/detox/index.cjs +200 -132
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-Q5TRRYSO.mjs → acorn-IIBLEO25.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-UDWBTBVG.mjs → chunk-4FTPQKPT.mjs} +10 -1
- package/dist-lib/esm-chunks/chunk-4WIDTRBB.mjs +10232 -0
- package/dist-lib/esm-chunks/{chunk-LCMFYMT7.mjs → chunk-5QZOQ3NZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BJ2OGUX7.mjs → chunk-CIY67HNL.mjs} +39 -17
- package/dist-lib/esm-chunks/{chunk-SKQTNQYE.mjs → chunk-CQFEMJ64.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AXWVXRHX.mjs → chunk-CWVMCW23.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MTALOHQR.mjs → chunk-F6DZ4DS2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-I4R7IZRD.mjs → chunk-HJMF6O7L.mjs} +74 -46
- package/dist-lib/esm-chunks/chunk-I6T4PXJF.mjs +154 -0
- package/dist-lib/esm-chunks/{chunk-XWAUZKIA.mjs → chunk-IJU3JMWM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CXWUIOCH.mjs → chunk-KODEPXQC.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-WJE5QHSD.mjs → chunk-LD4K2VBL.mjs} +155 -36
- package/dist-lib/esm-chunks/{chunk-2TSM64HI.mjs → chunk-LTE7YMEG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3GGOXUJA.mjs → chunk-M3CSKAJE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7G5UETIG.mjs → chunk-NA6DJPB6.mjs} +43 -1
- package/dist-lib/esm-chunks/{chunk-MSUHMNAI.mjs → chunk-NNAX24FS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VDJA4LP4.mjs → chunk-PZPJJBAS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UEEEJVQA.mjs → chunk-QXSTHMWN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-S2RJB5I7.mjs → chunk-RBPVK5YI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VRAXNGYT.mjs → chunk-SCT5OFDV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-T3M73LGP.mjs → chunk-U3CJGYSP.mjs} +50 -6
- package/dist-lib/esm-chunks/{chunk-SLUGTGQQ.mjs → chunk-VXTOQ522.mjs} +12 -6
- package/dist-lib/esm-chunks/{chunk-EL44SZMV.mjs → chunk-WMSVGYTH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FEDEPSEV.mjs → chunk-WRWINRWK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BNO52N2S.mjs → chunk-YZF2USRD.mjs} +1905 -8760
- package/dist-lib/esm-chunks/{chunk-TQLKYMVP.mjs → chunk-ZNHR6C3L.mjs} +1 -1
- package/dist-lib/esm-chunks/{download-auth-registry-G75MIT55.mjs → download-auth-registry-AHS5MSIB.mjs} +4 -4
- package/dist-lib/esm-chunks/{metro-layout-parser-FXLUDTYT.mjs → metro-layout-parser-24ZYK5UP.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-524D4MA2.mjs → swift-package-prebuilt-L4YNXQRD.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-app-module-EX544YJY.mjs → swift-sdk-app-module-RM652JSW.mjs} +87 -71
- package/dist-lib/esm-chunks/{swift-sdk-image-LOTMWVM7.mjs → swift-sdk-image-5PQ44UJT.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-UO6B3M4U.mjs → swift-sdk-image-producer-GD3SM6YI.mjs} +5 -5
- package/dist-lib/esm-chunks/swift-sdk-later-data-62QYJ2KH.mjs +590 -0
- package/dist-lib/expo-swift-bundle.cjs +21037 -17896
- package/dist-lib/expo-swift-metadata.cjs +8 -2
- package/dist-lib/expo-swift-metadata.mjs +9 -8
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +22481 -18741
- package/dist-lib/host/fetch-proxy-handler.cjs +21079 -17980
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +68 -38
- package/dist-lib/kotlin-host.cjs +97 -21
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +23 -1
- package/dist-lib/metro-production-bundle.mjs +24 -4
- package/dist-lib/native-app-identity-project.cjs +3582 -571
- package/dist-lib/native-app-identity-project.mjs +1024 -398
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +132 -116
- package/dist-lib/public-origins-lib.json +215 -173
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +17 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +6 -7
- package/dist-lib/sdk.mjs +13 -14
- package/dist-lib/skills.cjs +23216 -19650
- package/dist-lib/swift-compile.cjs +4337 -2905
- package/dist-lib/swift-compile.mjs +15 -13
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +19 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +94 -32
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +9 -6
- package/dist-types/packages/peach-engine/src/canvaskit-artifact-urls.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/capture/compositor-presentation-recording.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/generated/canvaskit-artifact-hashes.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/engine/guest-scene-inspect.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/metalTypes.d.ts +32 -2
- package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +12 -2
- package/dist-types/packages/peach-engine/src/guest/http-cookie-storage.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/guest/native-evaluation-lease.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/guest/nitro-jsi-host.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +225 -9
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-compositor.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-contract.d.ts +44 -10
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +4 -3
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -4
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -27
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +2 -6
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/app-bundle-resources.d.ts +10 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +9 -6
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/oneWidgetContract.d.ts +28 -0
- package/package.json +2 -2
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreHaptics.framework/Headers/CoreHaptics.h +251 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INImage.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntent.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentIdentifiers.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentResponse.h +12 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INInteraction.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectCollection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectSection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INOutgoingMessageType.h +7 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPerson.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPersonHandle.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent+UserNotifications.h +6 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent.h +33 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSpeakableString.h +24 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/Intents.h +11 -7
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +0 -8
- package/sdk/ios/System/Library/Frameworks/MetalTypes.framework/Headers/MetalTypes.h +8 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/SLServiceTypes.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/Social.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +5 -5
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/unistd.h +1 -0
- package/src/acorn-program.ts +3 -0
- package/src/audio-codec-archives.ts +141 -0
- package/src/bridge-contract-input.ts +61 -1
- package/src/bridge-contract.ts +45 -4
- package/src/bundle-channel.mjs +44 -30
- package/src/capture-contract.ts +57 -39
- package/src/conformance-comparison-contract.ts +2 -0
- package/src/expo-discovery-cache.ts +0 -2
- package/src/expo-macro-host.ts +8 -3
- package/src/expo-native-compiler-digest.ts +0 -1
- package/src/expo-native-prebuilt.ts +1 -1
- package/src/expo-native-workspace.ts +83 -45
- package/src/expo-pod-prebuilt.ts +1 -0
- package/src/expo-swift-host.ts +158 -77
- package/src/expo-swift-legacy-runtime-source.ts +12 -1
- package/src/expo-swift-view-source.ts +51 -20
- package/src/expo-workspace-exclusion.ts +7 -1
- package/src/expoSwiftContract.ts +10 -1
- package/src/ffmpeg-source-build.ts +123 -59
- package/src/genrule-archives.ts +7 -2
- package/src/genrule-library-builds.ts +101 -18
- package/src/host/bridge-host.ts +10 -1
- package/src/installed-native-libraries.ts +147 -23
- package/src/installed-package-versions.ts +30 -0
- package/src/ios-rn-bundle-request.ts +3 -1
- package/src/ios-rn-bundle.ts +38 -27
- package/src/ios-rn-compile.ts +23 -6
- package/src/ios-rn-startup.ts +2 -1
- package/src/java-module-abi.ts +4 -3
- package/src/kotlin-host.ts +4 -4
- package/src/kotlin-library-sources.ts +8 -5
- package/src/metro-production-bundle.ts +24 -0
- package/src/native-firebase-config.ts +2 -0
- package/src/native-framework-compiler.ts +5 -0
- package/src/native-package-slice-build.ts +3 -0
- package/src/native-package-slice.ts +15 -10
- package/src/native-preparation.ts +4 -1
- package/src/native-static-libraries.ts +107 -33
- package/src/nativeRuntimePackageIndex.ts +1 -4
- package/src/nitro-adapter.lock.json +286 -286
- package/src/nitro-app-providers.ts +20 -8
- package/src/nitro-compile.ts +131 -37
- package/src/nitro-dependencies.ts +42 -8
- package/src/nitro-source.ts +40 -36
- package/src/nitro-superset.lock.json +4 -4
- package/src/nitroAdapterContract.ts +32 -7
- package/src/nitroContract.ts +21 -37
- package/src/one-direct-host-source.ts +247 -140
- package/src/one-fabric.ts +129 -0
- package/src/one-native-controls-package.ts +95 -21
- package/src/one-native-controls-release.ts +147 -14
- package/src/one-native-source.ts +4 -1
- package/src/one-nitro-inputs.ts +1 -1
- package/src/one-nitro-source.ts +45 -1
- package/src/one-sdk/source.ts +10 -41
- package/src/one-widget-metadata.ts +2 -2
- package/src/one-widget-package.ts +1 -1
- package/src/oneSdkContract.ts +3 -0
- package/src/playwright-browser-paths.ts +30 -0
- package/src/pods-install.ts +6 -2
- package/src/pods-post-install.ts +2 -2
- package/src/pods-project.ts +10 -0
- package/src/podspec-ruby-stdlib.ts +73 -0
- package/src/podspec-ruby.ts +1 -1
- package/src/podspec-sources.ts +31 -13
- package/src/process-group.ts +135 -5
- package/src/published-swift-sdk.ts +25 -1
- package/src/react-native-bridge-modules.ts +35 -3
- package/src/react-native-core-build.ts +14 -2
- package/src/react-native-core.ts +12 -2
- package/src/rive-runtime-dependencies.ts +178 -40
- package/src/serverDiscoveryContract.ts +1 -1
- package/src/storageSnapshotContract.ts +1 -1
- package/src/swift-app-data-store.ts +35 -0
- package/src/swift-compile.ts +403 -121
- package/src/swift-compiler-digest.ts +4 -0
- package/src/swift-darwin-records.ts +6 -0
- package/src/swift-distribution-mirror.ts +10 -1
- package/src/swift-distribution.lock.json +19 -18
- package/src/swift-distribution.ts +17 -1
- package/src/swift-entry-module.ts +1 -0
- package/src/swift-guest-compile.ts +8 -1
- package/src/swift-host.ts +79 -23
- package/src/swift-installed-targets.ts +51 -20
- package/src/swift-objc-standin.ts +60 -8
- package/src/swift-packages.ts +104 -24
- package/src/swift-project-user.ts +2 -1
- package/src/swift-reproducible.ts +99 -1
- package/src/swift-root-lock.ts +52 -46
- package/src/swift-sdk-app-module.ts +65 -13
- package/src/swift-sdk-image-producer.ts +2 -1
- package/src/swift-sdk-image.ts +23 -8
- package/src/swift-sdk-later-data.ts +294 -44
- package/src/swift-sdk-surface.ts +233 -55
- package/src/swift-shared-sdk.ts +7 -0
- package/src/swift-standin-builtin-behavior.ts +18 -0
- package/src/swift-standin-emit.ts +242 -54
- package/src/swift-standins.ts +184 -38
- package/src/swift-startup-split.ts +19 -9
- package/src/swift-toolchain.ts +18 -0
- package/src/swift-wasm-prune.ts +179 -9
- package/src/swift-xcframework.ts +16 -0
- package/src/swiftContract.ts +4 -1
- package/src/swiftSdkLinkContract.ts +2 -0
- package/src/swiftTargetContract.ts +1 -0
- package/src/turbo-bundle.ts +6 -3
- package/src/turbo-codegen-intake.ts +106 -16
- package/src/turbo-compile.ts +89 -68
- package/src/turbo-fabric-app.ts +287 -23
- package/src/turbo-provider-host.ts +122 -31
- package/src/turbo-runtime.lock.json +26 -26
- package/src/turbo-source.ts +374 -157
- package/src/vite-plugin.ts +48 -112
- package/src/wasm-binary-sections.ts +40 -0
- package/src/wasm-code-immediates.ts +35 -5
- package/src/widget-extension-bundle.ts +15 -1
- package/src/worklet-executable.ts +2 -1
- package/src/worklet-kernel.ts +5 -3
- package/src/worklets-babel.ts +2 -1
- package/src/xcode-project.ts +151 -53
- package/src/xcode-scheme-actions.ts +104 -0
- package/cli/commands/canvas.ts +0 -1204
- package/dist-lib/esm-chunks/chunk-B5QD2KEV.mjs +0 -2787
- package/dist-lib/vendor/magic-string.cjs +0 -1693
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +0 -127
- package/src/appBundleResourcesContract.ts +0 -51
- package/src/canvas-groups.ts +0 -28
- package/src/canvas-map-layout.ts +0 -161
- package/src/oneWidgetContract.ts +0 -134
|
@@ -1,1693 +0,0 @@
|
|
|
1
|
-
/*! peach v0.1.2935 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
|
-
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
|
-
"use strict";
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
6
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// ../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
|
|
10
|
-
var require_sourcemap_codec_umd = __commonJS({
|
|
11
|
-
"../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"(exports2, module2) {
|
|
12
|
-
(function(global, factory) {
|
|
13
|
-
if (typeof exports2 === "object" && typeof module2 !== "undefined") {
|
|
14
|
-
factory(module2);
|
|
15
|
-
module2.exports = def(module2);
|
|
16
|
-
} else if (typeof define === "function" && define.amd) {
|
|
17
|
-
define(["module"], function(mod) {
|
|
18
|
-
factory.apply(this, arguments);
|
|
19
|
-
mod.exports = def(mod);
|
|
20
|
-
});
|
|
21
|
-
} else {
|
|
22
|
-
const mod = { exports: {} };
|
|
23
|
-
factory(mod);
|
|
24
|
-
global = typeof globalThis !== "undefined" ? globalThis : global || self;
|
|
25
|
-
global.sourcemapCodec = def(mod);
|
|
26
|
-
}
|
|
27
|
-
function def(m) {
|
|
28
|
-
return "default" in m.exports ? m.exports.default : m.exports;
|
|
29
|
-
}
|
|
30
|
-
})(exports2, (function(module3) {
|
|
31
|
-
"use strict";
|
|
32
|
-
var __defProp = Object.defineProperty;
|
|
33
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
34
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
35
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
36
|
-
var __export = (target, all) => {
|
|
37
|
-
for (var name in all)
|
|
38
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
-
};
|
|
40
|
-
var __copyProps = (to, from, except, desc) => {
|
|
41
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
-
for (let key of __getOwnPropNames2(from))
|
|
43
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
-
}
|
|
46
|
-
return to;
|
|
47
|
-
};
|
|
48
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
-
var sourcemap_codec_exports = {};
|
|
50
|
-
__export(sourcemap_codec_exports, {
|
|
51
|
-
decode: () => decode,
|
|
52
|
-
decodeGeneratedRanges: () => decodeGeneratedRanges,
|
|
53
|
-
decodeOriginalScopes: () => decodeOriginalScopes,
|
|
54
|
-
encode: () => encode,
|
|
55
|
-
encodeGeneratedRanges: () => encodeGeneratedRanges,
|
|
56
|
-
encodeOriginalScopes: () => encodeOriginalScopes
|
|
57
|
-
});
|
|
58
|
-
module3.exports = __toCommonJS(sourcemap_codec_exports);
|
|
59
|
-
var comma = ",".charCodeAt(0);
|
|
60
|
-
var semicolon = ";".charCodeAt(0);
|
|
61
|
-
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
62
|
-
var intToChar = new Uint8Array(64);
|
|
63
|
-
var charToInt = new Uint8Array(128);
|
|
64
|
-
for (let i = 0; i < chars.length; i++) {
|
|
65
|
-
const c = chars.charCodeAt(i);
|
|
66
|
-
intToChar[i] = c;
|
|
67
|
-
charToInt[c] = i;
|
|
68
|
-
}
|
|
69
|
-
function decodeInteger(reader, relative) {
|
|
70
|
-
let value = 0;
|
|
71
|
-
let shift = 0;
|
|
72
|
-
let integer = 0;
|
|
73
|
-
do {
|
|
74
|
-
const c = reader.next();
|
|
75
|
-
integer = charToInt[c];
|
|
76
|
-
value |= (integer & 31) << shift;
|
|
77
|
-
shift += 5;
|
|
78
|
-
} while (integer & 32);
|
|
79
|
-
const shouldNegate = value & 1;
|
|
80
|
-
value >>>= 1;
|
|
81
|
-
if (shouldNegate) {
|
|
82
|
-
value = -2147483648 | -value;
|
|
83
|
-
}
|
|
84
|
-
return relative + value;
|
|
85
|
-
}
|
|
86
|
-
function encodeInteger(builder, num, relative) {
|
|
87
|
-
let delta = num - relative;
|
|
88
|
-
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
89
|
-
do {
|
|
90
|
-
let clamped = delta & 31;
|
|
91
|
-
delta >>>= 5;
|
|
92
|
-
if (delta > 0) clamped |= 32;
|
|
93
|
-
builder.write(intToChar[clamped]);
|
|
94
|
-
} while (delta > 0);
|
|
95
|
-
return num;
|
|
96
|
-
}
|
|
97
|
-
function hasMoreVlq(reader, max) {
|
|
98
|
-
if (reader.pos >= max) return false;
|
|
99
|
-
return reader.peek() !== comma;
|
|
100
|
-
}
|
|
101
|
-
var bufLength = 1024 * 16;
|
|
102
|
-
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
|
|
103
|
-
decode(buf) {
|
|
104
|
-
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
105
|
-
return out.toString();
|
|
106
|
-
}
|
|
107
|
-
} : {
|
|
108
|
-
decode(buf) {
|
|
109
|
-
let out = "";
|
|
110
|
-
for (let i = 0; i < buf.length; i++) {
|
|
111
|
-
out += String.fromCharCode(buf[i]);
|
|
112
|
-
}
|
|
113
|
-
return out;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
var StringWriter = class {
|
|
117
|
-
constructor() {
|
|
118
|
-
this.pos = 0;
|
|
119
|
-
this.out = "";
|
|
120
|
-
this.buffer = new Uint8Array(bufLength);
|
|
121
|
-
}
|
|
122
|
-
write(v) {
|
|
123
|
-
const { buffer } = this;
|
|
124
|
-
buffer[this.pos++] = v;
|
|
125
|
-
if (this.pos === bufLength) {
|
|
126
|
-
this.out += td.decode(buffer);
|
|
127
|
-
this.pos = 0;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
flush() {
|
|
131
|
-
const { buffer, out, pos } = this;
|
|
132
|
-
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
var StringReader = class {
|
|
136
|
-
constructor(buffer) {
|
|
137
|
-
this.pos = 0;
|
|
138
|
-
this.buffer = buffer;
|
|
139
|
-
}
|
|
140
|
-
next() {
|
|
141
|
-
return this.buffer.charCodeAt(this.pos++);
|
|
142
|
-
}
|
|
143
|
-
peek() {
|
|
144
|
-
return this.buffer.charCodeAt(this.pos);
|
|
145
|
-
}
|
|
146
|
-
indexOf(char) {
|
|
147
|
-
const { buffer, pos } = this;
|
|
148
|
-
const idx = buffer.indexOf(char, pos);
|
|
149
|
-
return idx === -1 ? buffer.length : idx;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
var EMPTY = [];
|
|
153
|
-
function decodeOriginalScopes(input) {
|
|
154
|
-
const { length } = input;
|
|
155
|
-
const reader = new StringReader(input);
|
|
156
|
-
const scopes = [];
|
|
157
|
-
const stack = [];
|
|
158
|
-
let line = 0;
|
|
159
|
-
for (; reader.pos < length; reader.pos++) {
|
|
160
|
-
line = decodeInteger(reader, line);
|
|
161
|
-
const column = decodeInteger(reader, 0);
|
|
162
|
-
if (!hasMoreVlq(reader, length)) {
|
|
163
|
-
const last = stack.pop();
|
|
164
|
-
last[2] = line;
|
|
165
|
-
last[3] = column;
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const kind = decodeInteger(reader, 0);
|
|
169
|
-
const fields = decodeInteger(reader, 0);
|
|
170
|
-
const hasName = fields & 1;
|
|
171
|
-
const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];
|
|
172
|
-
let vars = EMPTY;
|
|
173
|
-
if (hasMoreVlq(reader, length)) {
|
|
174
|
-
vars = [];
|
|
175
|
-
do {
|
|
176
|
-
const varsIndex = decodeInteger(reader, 0);
|
|
177
|
-
vars.push(varsIndex);
|
|
178
|
-
} while (hasMoreVlq(reader, length));
|
|
179
|
-
}
|
|
180
|
-
scope.vars = vars;
|
|
181
|
-
scopes.push(scope);
|
|
182
|
-
stack.push(scope);
|
|
183
|
-
}
|
|
184
|
-
return scopes;
|
|
185
|
-
}
|
|
186
|
-
function encodeOriginalScopes(scopes) {
|
|
187
|
-
const writer = new StringWriter();
|
|
188
|
-
for (let i = 0; i < scopes.length; ) {
|
|
189
|
-
i = _encodeOriginalScopes(scopes, i, writer, [0]);
|
|
190
|
-
}
|
|
191
|
-
return writer.flush();
|
|
192
|
-
}
|
|
193
|
-
function _encodeOriginalScopes(scopes, index, writer, state) {
|
|
194
|
-
const scope = scopes[index];
|
|
195
|
-
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
|
|
196
|
-
if (index > 0) writer.write(comma);
|
|
197
|
-
state[0] = encodeInteger(writer, startLine, state[0]);
|
|
198
|
-
encodeInteger(writer, startColumn, 0);
|
|
199
|
-
encodeInteger(writer, kind, 0);
|
|
200
|
-
const fields = scope.length === 6 ? 1 : 0;
|
|
201
|
-
encodeInteger(writer, fields, 0);
|
|
202
|
-
if (scope.length === 6) encodeInteger(writer, scope[5], 0);
|
|
203
|
-
for (const v of vars) {
|
|
204
|
-
encodeInteger(writer, v, 0);
|
|
205
|
-
}
|
|
206
|
-
for (index++; index < scopes.length; ) {
|
|
207
|
-
const next = scopes[index];
|
|
208
|
-
const { 0: l, 1: c } = next;
|
|
209
|
-
if (l > endLine || l === endLine && c >= endColumn) {
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
index = _encodeOriginalScopes(scopes, index, writer, state);
|
|
213
|
-
}
|
|
214
|
-
writer.write(comma);
|
|
215
|
-
state[0] = encodeInteger(writer, endLine, state[0]);
|
|
216
|
-
encodeInteger(writer, endColumn, 0);
|
|
217
|
-
return index;
|
|
218
|
-
}
|
|
219
|
-
function decodeGeneratedRanges(input) {
|
|
220
|
-
const { length } = input;
|
|
221
|
-
const reader = new StringReader(input);
|
|
222
|
-
const ranges = [];
|
|
223
|
-
const stack = [];
|
|
224
|
-
let genLine = 0;
|
|
225
|
-
let definitionSourcesIndex = 0;
|
|
226
|
-
let definitionScopeIndex = 0;
|
|
227
|
-
let callsiteSourcesIndex = 0;
|
|
228
|
-
let callsiteLine = 0;
|
|
229
|
-
let callsiteColumn = 0;
|
|
230
|
-
let bindingLine = 0;
|
|
231
|
-
let bindingColumn = 0;
|
|
232
|
-
do {
|
|
233
|
-
const semi = reader.indexOf(";");
|
|
234
|
-
let genColumn = 0;
|
|
235
|
-
for (; reader.pos < semi; reader.pos++) {
|
|
236
|
-
genColumn = decodeInteger(reader, genColumn);
|
|
237
|
-
if (!hasMoreVlq(reader, semi)) {
|
|
238
|
-
const last = stack.pop();
|
|
239
|
-
last[2] = genLine;
|
|
240
|
-
last[3] = genColumn;
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const fields = decodeInteger(reader, 0);
|
|
244
|
-
const hasDefinition = fields & 1;
|
|
245
|
-
const hasCallsite = fields & 2;
|
|
246
|
-
const hasScope = fields & 4;
|
|
247
|
-
let callsite = null;
|
|
248
|
-
let bindings = EMPTY;
|
|
249
|
-
let range;
|
|
250
|
-
if (hasDefinition) {
|
|
251
|
-
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
|
|
252
|
-
definitionScopeIndex = decodeInteger(
|
|
253
|
-
reader,
|
|
254
|
-
definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0
|
|
255
|
-
);
|
|
256
|
-
definitionSourcesIndex = defSourcesIndex;
|
|
257
|
-
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];
|
|
258
|
-
} else {
|
|
259
|
-
range = [genLine, genColumn, 0, 0];
|
|
260
|
-
}
|
|
261
|
-
range.isScope = !!hasScope;
|
|
262
|
-
if (hasCallsite) {
|
|
263
|
-
const prevCsi = callsiteSourcesIndex;
|
|
264
|
-
const prevLine = callsiteLine;
|
|
265
|
-
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
|
|
266
|
-
const sameSource = prevCsi === callsiteSourcesIndex;
|
|
267
|
-
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
|
|
268
|
-
callsiteColumn = decodeInteger(
|
|
269
|
-
reader,
|
|
270
|
-
sameSource && prevLine === callsiteLine ? callsiteColumn : 0
|
|
271
|
-
);
|
|
272
|
-
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
|
|
273
|
-
}
|
|
274
|
-
range.callsite = callsite;
|
|
275
|
-
if (hasMoreVlq(reader, semi)) {
|
|
276
|
-
bindings = [];
|
|
277
|
-
do {
|
|
278
|
-
bindingLine = genLine;
|
|
279
|
-
bindingColumn = genColumn;
|
|
280
|
-
const expressionsCount = decodeInteger(reader, 0);
|
|
281
|
-
let expressionRanges;
|
|
282
|
-
if (expressionsCount < -1) {
|
|
283
|
-
expressionRanges = [[decodeInteger(reader, 0)]];
|
|
284
|
-
for (let i = -1; i > expressionsCount; i--) {
|
|
285
|
-
const prevBl = bindingLine;
|
|
286
|
-
bindingLine = decodeInteger(reader, bindingLine);
|
|
287
|
-
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
|
|
288
|
-
const expression = decodeInteger(reader, 0);
|
|
289
|
-
expressionRanges.push([expression, bindingLine, bindingColumn]);
|
|
290
|
-
}
|
|
291
|
-
} else {
|
|
292
|
-
expressionRanges = [[expressionsCount]];
|
|
293
|
-
}
|
|
294
|
-
bindings.push(expressionRanges);
|
|
295
|
-
} while (hasMoreVlq(reader, semi));
|
|
296
|
-
}
|
|
297
|
-
range.bindings = bindings;
|
|
298
|
-
ranges.push(range);
|
|
299
|
-
stack.push(range);
|
|
300
|
-
}
|
|
301
|
-
genLine++;
|
|
302
|
-
reader.pos = semi + 1;
|
|
303
|
-
} while (reader.pos < length);
|
|
304
|
-
return ranges;
|
|
305
|
-
}
|
|
306
|
-
function encodeGeneratedRanges(ranges) {
|
|
307
|
-
if (ranges.length === 0) return "";
|
|
308
|
-
const writer = new StringWriter();
|
|
309
|
-
for (let i = 0; i < ranges.length; ) {
|
|
310
|
-
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
|
|
311
|
-
}
|
|
312
|
-
return writer.flush();
|
|
313
|
-
}
|
|
314
|
-
function _encodeGeneratedRanges(ranges, index, writer, state) {
|
|
315
|
-
const range = ranges[index];
|
|
316
|
-
const {
|
|
317
|
-
0: startLine,
|
|
318
|
-
1: startColumn,
|
|
319
|
-
2: endLine,
|
|
320
|
-
3: endColumn,
|
|
321
|
-
isScope,
|
|
322
|
-
callsite,
|
|
323
|
-
bindings
|
|
324
|
-
} = range;
|
|
325
|
-
if (state[0] < startLine) {
|
|
326
|
-
catchupLine(writer, state[0], startLine);
|
|
327
|
-
state[0] = startLine;
|
|
328
|
-
state[1] = 0;
|
|
329
|
-
} else if (index > 0) {
|
|
330
|
-
writer.write(comma);
|
|
331
|
-
}
|
|
332
|
-
state[1] = encodeInteger(writer, range[1], state[1]);
|
|
333
|
-
const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);
|
|
334
|
-
encodeInteger(writer, fields, 0);
|
|
335
|
-
if (range.length === 6) {
|
|
336
|
-
const { 4: sourcesIndex, 5: scopesIndex } = range;
|
|
337
|
-
if (sourcesIndex !== state[2]) {
|
|
338
|
-
state[3] = 0;
|
|
339
|
-
}
|
|
340
|
-
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
|
|
341
|
-
state[3] = encodeInteger(writer, scopesIndex, state[3]);
|
|
342
|
-
}
|
|
343
|
-
if (callsite) {
|
|
344
|
-
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;
|
|
345
|
-
if (sourcesIndex !== state[4]) {
|
|
346
|
-
state[5] = 0;
|
|
347
|
-
state[6] = 0;
|
|
348
|
-
} else if (callLine !== state[5]) {
|
|
349
|
-
state[6] = 0;
|
|
350
|
-
}
|
|
351
|
-
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
|
|
352
|
-
state[5] = encodeInteger(writer, callLine, state[5]);
|
|
353
|
-
state[6] = encodeInteger(writer, callColumn, state[6]);
|
|
354
|
-
}
|
|
355
|
-
if (bindings) {
|
|
356
|
-
for (const binding of bindings) {
|
|
357
|
-
if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
|
|
358
|
-
const expression = binding[0][0];
|
|
359
|
-
encodeInteger(writer, expression, 0);
|
|
360
|
-
let bindingStartLine = startLine;
|
|
361
|
-
let bindingStartColumn = startColumn;
|
|
362
|
-
for (let i = 1; i < binding.length; i++) {
|
|
363
|
-
const expRange = binding[i];
|
|
364
|
-
bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);
|
|
365
|
-
bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);
|
|
366
|
-
encodeInteger(writer, expRange[0], 0);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
for (index++; index < ranges.length; ) {
|
|
371
|
-
const next = ranges[index];
|
|
372
|
-
const { 0: l, 1: c } = next;
|
|
373
|
-
if (l > endLine || l === endLine && c >= endColumn) {
|
|
374
|
-
break;
|
|
375
|
-
}
|
|
376
|
-
index = _encodeGeneratedRanges(ranges, index, writer, state);
|
|
377
|
-
}
|
|
378
|
-
if (state[0] < endLine) {
|
|
379
|
-
catchupLine(writer, state[0], endLine);
|
|
380
|
-
state[0] = endLine;
|
|
381
|
-
state[1] = 0;
|
|
382
|
-
} else {
|
|
383
|
-
writer.write(comma);
|
|
384
|
-
}
|
|
385
|
-
state[1] = encodeInteger(writer, endColumn, state[1]);
|
|
386
|
-
return index;
|
|
387
|
-
}
|
|
388
|
-
function catchupLine(writer, lastLine, line) {
|
|
389
|
-
do {
|
|
390
|
-
writer.write(semicolon);
|
|
391
|
-
} while (++lastLine < line);
|
|
392
|
-
}
|
|
393
|
-
function decode(mappings) {
|
|
394
|
-
const { length } = mappings;
|
|
395
|
-
const reader = new StringReader(mappings);
|
|
396
|
-
const decoded = [];
|
|
397
|
-
let genColumn = 0;
|
|
398
|
-
let sourcesIndex = 0;
|
|
399
|
-
let sourceLine = 0;
|
|
400
|
-
let sourceColumn = 0;
|
|
401
|
-
let namesIndex = 0;
|
|
402
|
-
do {
|
|
403
|
-
const semi = reader.indexOf(";");
|
|
404
|
-
const line = [];
|
|
405
|
-
let sorted = true;
|
|
406
|
-
let lastCol = 0;
|
|
407
|
-
genColumn = 0;
|
|
408
|
-
while (reader.pos < semi) {
|
|
409
|
-
let seg;
|
|
410
|
-
genColumn = decodeInteger(reader, genColumn);
|
|
411
|
-
if (genColumn < lastCol) sorted = false;
|
|
412
|
-
lastCol = genColumn;
|
|
413
|
-
if (hasMoreVlq(reader, semi)) {
|
|
414
|
-
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
415
|
-
sourceLine = decodeInteger(reader, sourceLine);
|
|
416
|
-
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
417
|
-
if (hasMoreVlq(reader, semi)) {
|
|
418
|
-
namesIndex = decodeInteger(reader, namesIndex);
|
|
419
|
-
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
420
|
-
} else {
|
|
421
|
-
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
422
|
-
}
|
|
423
|
-
} else {
|
|
424
|
-
seg = [genColumn];
|
|
425
|
-
}
|
|
426
|
-
line.push(seg);
|
|
427
|
-
reader.pos++;
|
|
428
|
-
}
|
|
429
|
-
if (!sorted) sort(line);
|
|
430
|
-
decoded.push(line);
|
|
431
|
-
reader.pos = semi + 1;
|
|
432
|
-
} while (reader.pos <= length);
|
|
433
|
-
return decoded;
|
|
434
|
-
}
|
|
435
|
-
function sort(line) {
|
|
436
|
-
line.sort(sortComparator);
|
|
437
|
-
}
|
|
438
|
-
function sortComparator(a, b) {
|
|
439
|
-
return a[0] - b[0];
|
|
440
|
-
}
|
|
441
|
-
function encode(decoded) {
|
|
442
|
-
const writer = new StringWriter();
|
|
443
|
-
let sourcesIndex = 0;
|
|
444
|
-
let sourceLine = 0;
|
|
445
|
-
let sourceColumn = 0;
|
|
446
|
-
let namesIndex = 0;
|
|
447
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
448
|
-
const line = decoded[i];
|
|
449
|
-
if (i > 0) writer.write(semicolon);
|
|
450
|
-
if (line.length === 0) continue;
|
|
451
|
-
let genColumn = 0;
|
|
452
|
-
for (let j = 0; j < line.length; j++) {
|
|
453
|
-
const segment = line[j];
|
|
454
|
-
if (j > 0) writer.write(comma);
|
|
455
|
-
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
456
|
-
if (segment.length === 1) continue;
|
|
457
|
-
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
458
|
-
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
459
|
-
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
460
|
-
if (segment.length === 4) continue;
|
|
461
|
-
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return writer.flush();
|
|
465
|
-
}
|
|
466
|
-
}));
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
// ../../node_modules/magic-string/dist/magic-string.cjs.js
|
|
471
|
-
var sourcemapCodec = require_sourcemap_codec_umd();
|
|
472
|
-
var BitSet = class _BitSet {
|
|
473
|
-
constructor(arg) {
|
|
474
|
-
this.bits = arg instanceof _BitSet ? arg.bits.slice() : [];
|
|
475
|
-
}
|
|
476
|
-
add(n2) {
|
|
477
|
-
this.bits[n2 >> 5] |= 1 << (n2 & 31);
|
|
478
|
-
}
|
|
479
|
-
has(n2) {
|
|
480
|
-
return !!(this.bits[n2 >> 5] & 1 << (n2 & 31));
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
var Chunk = class _Chunk {
|
|
484
|
-
constructor(start, end, content) {
|
|
485
|
-
this.start = start;
|
|
486
|
-
this.end = end;
|
|
487
|
-
this.original = content;
|
|
488
|
-
this.intro = "";
|
|
489
|
-
this.outro = "";
|
|
490
|
-
this.content = content;
|
|
491
|
-
this.storeName = false;
|
|
492
|
-
this.edited = false;
|
|
493
|
-
{
|
|
494
|
-
this.previous = null;
|
|
495
|
-
this.next = null;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
appendLeft(content) {
|
|
499
|
-
this.outro += content;
|
|
500
|
-
}
|
|
501
|
-
appendRight(content) {
|
|
502
|
-
this.intro = this.intro + content;
|
|
503
|
-
}
|
|
504
|
-
clone() {
|
|
505
|
-
const chunk = new _Chunk(this.start, this.end, this.original);
|
|
506
|
-
chunk.intro = this.intro;
|
|
507
|
-
chunk.outro = this.outro;
|
|
508
|
-
chunk.content = this.content;
|
|
509
|
-
chunk.storeName = this.storeName;
|
|
510
|
-
chunk.edited = this.edited;
|
|
511
|
-
return chunk;
|
|
512
|
-
}
|
|
513
|
-
contains(index) {
|
|
514
|
-
return this.start < index && index < this.end;
|
|
515
|
-
}
|
|
516
|
-
eachNext(fn) {
|
|
517
|
-
let chunk = this;
|
|
518
|
-
while (chunk) {
|
|
519
|
-
fn(chunk);
|
|
520
|
-
chunk = chunk.next;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
eachPrevious(fn) {
|
|
524
|
-
let chunk = this;
|
|
525
|
-
while (chunk) {
|
|
526
|
-
fn(chunk);
|
|
527
|
-
chunk = chunk.previous;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
edit(content, storeName, contentOnly) {
|
|
531
|
-
this.content = content;
|
|
532
|
-
if (!contentOnly) {
|
|
533
|
-
this.intro = "";
|
|
534
|
-
this.outro = "";
|
|
535
|
-
}
|
|
536
|
-
this.storeName = storeName;
|
|
537
|
-
this.edited = true;
|
|
538
|
-
return this;
|
|
539
|
-
}
|
|
540
|
-
prependLeft(content) {
|
|
541
|
-
this.outro = content + this.outro;
|
|
542
|
-
}
|
|
543
|
-
prependRight(content) {
|
|
544
|
-
this.intro = content + this.intro;
|
|
545
|
-
}
|
|
546
|
-
reset() {
|
|
547
|
-
this.intro = "";
|
|
548
|
-
this.outro = "";
|
|
549
|
-
if (this.edited) {
|
|
550
|
-
this.content = this.original;
|
|
551
|
-
this.storeName = false;
|
|
552
|
-
this.edited = false;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
split(index) {
|
|
556
|
-
const sliceIndex = index - this.start;
|
|
557
|
-
const originalBefore = this.original.slice(0, sliceIndex);
|
|
558
|
-
const originalAfter = this.original.slice(sliceIndex);
|
|
559
|
-
this.original = originalBefore;
|
|
560
|
-
const newChunk = new _Chunk(index, this.end, originalAfter);
|
|
561
|
-
newChunk.outro = this.outro;
|
|
562
|
-
this.outro = "";
|
|
563
|
-
this.end = index;
|
|
564
|
-
if (this.edited) {
|
|
565
|
-
newChunk.edit("", false);
|
|
566
|
-
this.content = "";
|
|
567
|
-
} else {
|
|
568
|
-
this.content = originalBefore;
|
|
569
|
-
}
|
|
570
|
-
newChunk.next = this.next;
|
|
571
|
-
if (newChunk.next) newChunk.next.previous = newChunk;
|
|
572
|
-
newChunk.previous = this;
|
|
573
|
-
this.next = newChunk;
|
|
574
|
-
return newChunk;
|
|
575
|
-
}
|
|
576
|
-
toString() {
|
|
577
|
-
return this.intro + this.content + this.outro;
|
|
578
|
-
}
|
|
579
|
-
trimEnd(rx) {
|
|
580
|
-
this.outro = this.outro.replace(rx, "");
|
|
581
|
-
if (this.outro.length) return true;
|
|
582
|
-
const trimmed = this.content.replace(rx, "");
|
|
583
|
-
if (trimmed.length) {
|
|
584
|
-
if (trimmed !== this.content) {
|
|
585
|
-
this.split(this.start + trimmed.length).edit("", void 0, true);
|
|
586
|
-
if (this.edited) {
|
|
587
|
-
this.edit(trimmed, this.storeName, true);
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
return true;
|
|
591
|
-
} else {
|
|
592
|
-
this.edit("", void 0, true);
|
|
593
|
-
this.intro = this.intro.replace(rx, "");
|
|
594
|
-
if (this.intro.length) return true;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
trimStart(rx) {
|
|
598
|
-
this.intro = this.intro.replace(rx, "");
|
|
599
|
-
if (this.intro.length) return true;
|
|
600
|
-
const trimmed = this.content.replace(rx, "");
|
|
601
|
-
if (trimmed.length) {
|
|
602
|
-
if (trimmed !== this.content) {
|
|
603
|
-
const newChunk = this.split(this.end - trimmed.length);
|
|
604
|
-
if (this.edited) {
|
|
605
|
-
newChunk.edit(trimmed, this.storeName, true);
|
|
606
|
-
}
|
|
607
|
-
this.edit("", void 0, true);
|
|
608
|
-
}
|
|
609
|
-
return true;
|
|
610
|
-
} else {
|
|
611
|
-
this.edit("", void 0, true);
|
|
612
|
-
this.outro = this.outro.replace(rx, "");
|
|
613
|
-
if (this.outro.length) return true;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
function getBtoa() {
|
|
618
|
-
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
|
|
619
|
-
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
620
|
-
} else if (typeof Buffer === "function") {
|
|
621
|
-
return (str) => Buffer.from(str, "utf-8").toString("base64");
|
|
622
|
-
} else {
|
|
623
|
-
return () => {
|
|
624
|
-
throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
var btoa = /* @__PURE__ */ getBtoa();
|
|
629
|
-
var SourceMap = class {
|
|
630
|
-
constructor(properties) {
|
|
631
|
-
this.version = 3;
|
|
632
|
-
this.file = properties.file;
|
|
633
|
-
this.sources = properties.sources;
|
|
634
|
-
this.sourcesContent = properties.sourcesContent;
|
|
635
|
-
this.names = properties.names;
|
|
636
|
-
this.mappings = sourcemapCodec.encode(properties.mappings);
|
|
637
|
-
if (typeof properties.x_google_ignoreList !== "undefined") {
|
|
638
|
-
this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
639
|
-
}
|
|
640
|
-
if (typeof properties.debugId !== "undefined") {
|
|
641
|
-
this.debugId = properties.debugId;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
toString() {
|
|
645
|
-
return JSON.stringify(this);
|
|
646
|
-
}
|
|
647
|
-
toUrl() {
|
|
648
|
-
return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
function guessIndent(code) {
|
|
652
|
-
const lines = code.split("\n");
|
|
653
|
-
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
654
|
-
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
655
|
-
if (tabbed.length === 0 && spaced.length === 0) {
|
|
656
|
-
return null;
|
|
657
|
-
}
|
|
658
|
-
if (tabbed.length >= spaced.length) {
|
|
659
|
-
return " ";
|
|
660
|
-
}
|
|
661
|
-
const min = spaced.reduce((previous, current) => {
|
|
662
|
-
const numSpaces = /^ +/.exec(current)[0].length;
|
|
663
|
-
return Math.min(numSpaces, previous);
|
|
664
|
-
}, Infinity);
|
|
665
|
-
return new Array(min + 1).join(" ");
|
|
666
|
-
}
|
|
667
|
-
function getRelativePath(from, to) {
|
|
668
|
-
const fromParts = from.split(/[/\\]/);
|
|
669
|
-
const toParts = to.split(/[/\\]/);
|
|
670
|
-
fromParts.pop();
|
|
671
|
-
while (fromParts[0] === toParts[0]) {
|
|
672
|
-
fromParts.shift();
|
|
673
|
-
toParts.shift();
|
|
674
|
-
}
|
|
675
|
-
if (fromParts.length) {
|
|
676
|
-
let i = fromParts.length;
|
|
677
|
-
while (i--) fromParts[i] = "..";
|
|
678
|
-
}
|
|
679
|
-
return fromParts.concat(toParts).join("/");
|
|
680
|
-
}
|
|
681
|
-
var toString = Object.prototype.toString;
|
|
682
|
-
function isObject(thing) {
|
|
683
|
-
return toString.call(thing) === "[object Object]";
|
|
684
|
-
}
|
|
685
|
-
function getLocator(source) {
|
|
686
|
-
const originalLines = source.split("\n");
|
|
687
|
-
const lineOffsets = [];
|
|
688
|
-
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
689
|
-
lineOffsets.push(pos);
|
|
690
|
-
pos += originalLines[i].length + 1;
|
|
691
|
-
}
|
|
692
|
-
return function locate(index) {
|
|
693
|
-
let i = 0;
|
|
694
|
-
let j = lineOffsets.length;
|
|
695
|
-
while (i < j) {
|
|
696
|
-
const m = i + j >> 1;
|
|
697
|
-
if (index < lineOffsets[m]) {
|
|
698
|
-
j = m;
|
|
699
|
-
} else {
|
|
700
|
-
i = m + 1;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
const line = i - 1;
|
|
704
|
-
const column = index - lineOffsets[line];
|
|
705
|
-
return { line, column };
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
var wordRegex = /\w/;
|
|
709
|
-
var Mappings = class {
|
|
710
|
-
constructor(hires) {
|
|
711
|
-
this.hires = hires;
|
|
712
|
-
this.generatedCodeLine = 0;
|
|
713
|
-
this.generatedCodeColumn = 0;
|
|
714
|
-
this.raw = [];
|
|
715
|
-
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
716
|
-
this.pending = null;
|
|
717
|
-
}
|
|
718
|
-
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
719
|
-
if (content.length) {
|
|
720
|
-
const contentLengthMinusOne = content.length - 1;
|
|
721
|
-
let contentLineEnd = content.indexOf("\n", 0);
|
|
722
|
-
let previousContentLineEnd = -1;
|
|
723
|
-
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
|
724
|
-
const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
725
|
-
if (nameIndex >= 0) {
|
|
726
|
-
segment2.push(nameIndex);
|
|
727
|
-
}
|
|
728
|
-
this.rawSegments.push(segment2);
|
|
729
|
-
this.generatedCodeLine += 1;
|
|
730
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
731
|
-
this.generatedCodeColumn = 0;
|
|
732
|
-
previousContentLineEnd = contentLineEnd;
|
|
733
|
-
contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
|
|
734
|
-
}
|
|
735
|
-
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
736
|
-
if (nameIndex >= 0) {
|
|
737
|
-
segment.push(nameIndex);
|
|
738
|
-
}
|
|
739
|
-
this.rawSegments.push(segment);
|
|
740
|
-
this.advance(content.slice(previousContentLineEnd + 1));
|
|
741
|
-
} else if (this.pending) {
|
|
742
|
-
this.rawSegments.push(this.pending);
|
|
743
|
-
this.advance(content);
|
|
744
|
-
}
|
|
745
|
-
this.pending = null;
|
|
746
|
-
}
|
|
747
|
-
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
748
|
-
let originalCharIndex = chunk.start;
|
|
749
|
-
let first = true;
|
|
750
|
-
let charInHiresBoundary = false;
|
|
751
|
-
while (originalCharIndex < chunk.end) {
|
|
752
|
-
if (original[originalCharIndex] === "\n") {
|
|
753
|
-
loc.line += 1;
|
|
754
|
-
loc.column = 0;
|
|
755
|
-
this.generatedCodeLine += 1;
|
|
756
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
757
|
-
this.generatedCodeColumn = 0;
|
|
758
|
-
first = true;
|
|
759
|
-
charInHiresBoundary = false;
|
|
760
|
-
} else {
|
|
761
|
-
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
762
|
-
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
763
|
-
if (this.hires === "boundary") {
|
|
764
|
-
if (wordRegex.test(original[originalCharIndex])) {
|
|
765
|
-
if (!charInHiresBoundary) {
|
|
766
|
-
this.rawSegments.push(segment);
|
|
767
|
-
charInHiresBoundary = true;
|
|
768
|
-
}
|
|
769
|
-
} else {
|
|
770
|
-
this.rawSegments.push(segment);
|
|
771
|
-
charInHiresBoundary = false;
|
|
772
|
-
}
|
|
773
|
-
} else {
|
|
774
|
-
this.rawSegments.push(segment);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
loc.column += 1;
|
|
778
|
-
this.generatedCodeColumn += 1;
|
|
779
|
-
first = false;
|
|
780
|
-
}
|
|
781
|
-
originalCharIndex += 1;
|
|
782
|
-
}
|
|
783
|
-
this.pending = null;
|
|
784
|
-
}
|
|
785
|
-
advance(str) {
|
|
786
|
-
if (!str) return;
|
|
787
|
-
const lines = str.split("\n");
|
|
788
|
-
if (lines.length > 1) {
|
|
789
|
-
for (let i = 0; i < lines.length - 1; i++) {
|
|
790
|
-
this.generatedCodeLine++;
|
|
791
|
-
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
792
|
-
}
|
|
793
|
-
this.generatedCodeColumn = 0;
|
|
794
|
-
}
|
|
795
|
-
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
var n = "\n";
|
|
799
|
-
var warned = {
|
|
800
|
-
insertLeft: false,
|
|
801
|
-
insertRight: false,
|
|
802
|
-
storeName: false
|
|
803
|
-
};
|
|
804
|
-
var MagicString = class _MagicString {
|
|
805
|
-
constructor(string, options = {}) {
|
|
806
|
-
const chunk = new Chunk(0, string.length, string);
|
|
807
|
-
Object.defineProperties(this, {
|
|
808
|
-
original: { writable: true, value: string },
|
|
809
|
-
outro: { writable: true, value: "" },
|
|
810
|
-
intro: { writable: true, value: "" },
|
|
811
|
-
firstChunk: { writable: true, value: chunk },
|
|
812
|
-
lastChunk: { writable: true, value: chunk },
|
|
813
|
-
lastSearchedChunk: { writable: true, value: chunk },
|
|
814
|
-
byStart: { writable: true, value: {} },
|
|
815
|
-
byEnd: { writable: true, value: {} },
|
|
816
|
-
filename: { writable: true, value: options.filename },
|
|
817
|
-
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
818
|
-
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
819
|
-
storedNames: { writable: true, value: {} },
|
|
820
|
-
indentStr: { writable: true, value: void 0 },
|
|
821
|
-
ignoreList: { writable: true, value: options.ignoreList },
|
|
822
|
-
offset: { writable: true, value: options.offset || 0 }
|
|
823
|
-
});
|
|
824
|
-
this.byStart[0] = chunk;
|
|
825
|
-
this.byEnd[string.length] = chunk;
|
|
826
|
-
}
|
|
827
|
-
addSourcemapLocation(char) {
|
|
828
|
-
this.sourcemapLocations.add(char);
|
|
829
|
-
}
|
|
830
|
-
append(content) {
|
|
831
|
-
if (typeof content !== "string") throw new TypeError("outro content must be a string");
|
|
832
|
-
this.outro += content;
|
|
833
|
-
return this;
|
|
834
|
-
}
|
|
835
|
-
appendLeft(index, content) {
|
|
836
|
-
index = index + this.offset;
|
|
837
|
-
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
838
|
-
this._split(index);
|
|
839
|
-
const chunk = this.byEnd[index];
|
|
840
|
-
if (chunk) {
|
|
841
|
-
chunk.appendLeft(content);
|
|
842
|
-
} else {
|
|
843
|
-
this.intro += content;
|
|
844
|
-
}
|
|
845
|
-
return this;
|
|
846
|
-
}
|
|
847
|
-
appendRight(index, content) {
|
|
848
|
-
index = index + this.offset;
|
|
849
|
-
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
850
|
-
this._split(index);
|
|
851
|
-
const chunk = this.byStart[index];
|
|
852
|
-
if (chunk) {
|
|
853
|
-
chunk.appendRight(content);
|
|
854
|
-
} else {
|
|
855
|
-
this.outro += content;
|
|
856
|
-
}
|
|
857
|
-
return this;
|
|
858
|
-
}
|
|
859
|
-
clone() {
|
|
860
|
-
const cloned = new _MagicString(this.original, { filename: this.filename, offset: this.offset });
|
|
861
|
-
let originalChunk = this.firstChunk;
|
|
862
|
-
let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
|
|
863
|
-
while (originalChunk) {
|
|
864
|
-
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
865
|
-
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
866
|
-
const nextOriginalChunk = originalChunk.next;
|
|
867
|
-
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
868
|
-
if (nextClonedChunk) {
|
|
869
|
-
clonedChunk.next = nextClonedChunk;
|
|
870
|
-
nextClonedChunk.previous = clonedChunk;
|
|
871
|
-
clonedChunk = nextClonedChunk;
|
|
872
|
-
}
|
|
873
|
-
originalChunk = nextOriginalChunk;
|
|
874
|
-
}
|
|
875
|
-
cloned.lastChunk = clonedChunk;
|
|
876
|
-
if (this.indentExclusionRanges) {
|
|
877
|
-
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
878
|
-
}
|
|
879
|
-
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
880
|
-
cloned.intro = this.intro;
|
|
881
|
-
cloned.outro = this.outro;
|
|
882
|
-
return cloned;
|
|
883
|
-
}
|
|
884
|
-
generateDecodedMap(options) {
|
|
885
|
-
options = options || {};
|
|
886
|
-
const sourceIndex = 0;
|
|
887
|
-
const names = Object.keys(this.storedNames);
|
|
888
|
-
const mappings = new Mappings(options.hires);
|
|
889
|
-
const locate = getLocator(this.original);
|
|
890
|
-
if (this.intro) {
|
|
891
|
-
mappings.advance(this.intro);
|
|
892
|
-
}
|
|
893
|
-
this.firstChunk.eachNext((chunk) => {
|
|
894
|
-
const loc = locate(chunk.start);
|
|
895
|
-
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
896
|
-
if (chunk.edited) {
|
|
897
|
-
mappings.addEdit(
|
|
898
|
-
sourceIndex,
|
|
899
|
-
chunk.content,
|
|
900
|
-
loc,
|
|
901
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
902
|
-
);
|
|
903
|
-
} else {
|
|
904
|
-
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
905
|
-
}
|
|
906
|
-
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
907
|
-
});
|
|
908
|
-
if (this.outro) {
|
|
909
|
-
mappings.advance(this.outro);
|
|
910
|
-
}
|
|
911
|
-
return {
|
|
912
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
|
|
913
|
-
sources: [
|
|
914
|
-
options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
|
|
915
|
-
],
|
|
916
|
-
sourcesContent: options.includeContent ? [this.original] : void 0,
|
|
917
|
-
names,
|
|
918
|
-
mappings: mappings.raw,
|
|
919
|
-
x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
generateMap(options) {
|
|
923
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
924
|
-
}
|
|
925
|
-
_ensureindentStr() {
|
|
926
|
-
if (this.indentStr === void 0) {
|
|
927
|
-
this.indentStr = guessIndent(this.original);
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
_getRawIndentString() {
|
|
931
|
-
this._ensureindentStr();
|
|
932
|
-
return this.indentStr;
|
|
933
|
-
}
|
|
934
|
-
getIndentString() {
|
|
935
|
-
this._ensureindentStr();
|
|
936
|
-
return this.indentStr === null ? " " : this.indentStr;
|
|
937
|
-
}
|
|
938
|
-
indent(indentStr, options) {
|
|
939
|
-
const pattern = /^[^\r\n]/gm;
|
|
940
|
-
if (isObject(indentStr)) {
|
|
941
|
-
options = indentStr;
|
|
942
|
-
indentStr = void 0;
|
|
943
|
-
}
|
|
944
|
-
if (indentStr === void 0) {
|
|
945
|
-
this._ensureindentStr();
|
|
946
|
-
indentStr = this.indentStr || " ";
|
|
947
|
-
}
|
|
948
|
-
if (indentStr === "") return this;
|
|
949
|
-
options = options || {};
|
|
950
|
-
const isExcluded = {};
|
|
951
|
-
if (options.exclude) {
|
|
952
|
-
const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
|
|
953
|
-
exclusions.forEach((exclusion) => {
|
|
954
|
-
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
955
|
-
isExcluded[i] = true;
|
|
956
|
-
}
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
|
-
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
960
|
-
const replacer = (match) => {
|
|
961
|
-
if (shouldIndentNextCharacter) return `${indentStr}${match}`;
|
|
962
|
-
shouldIndentNextCharacter = true;
|
|
963
|
-
return match;
|
|
964
|
-
};
|
|
965
|
-
this.intro = this.intro.replace(pattern, replacer);
|
|
966
|
-
let charIndex = 0;
|
|
967
|
-
let chunk = this.firstChunk;
|
|
968
|
-
while (chunk) {
|
|
969
|
-
const end = chunk.end;
|
|
970
|
-
if (chunk.edited) {
|
|
971
|
-
if (!isExcluded[charIndex]) {
|
|
972
|
-
chunk.content = chunk.content.replace(pattern, replacer);
|
|
973
|
-
if (chunk.content.length) {
|
|
974
|
-
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
} else {
|
|
978
|
-
charIndex = chunk.start;
|
|
979
|
-
while (charIndex < end) {
|
|
980
|
-
if (!isExcluded[charIndex]) {
|
|
981
|
-
const char = this.original[charIndex];
|
|
982
|
-
if (char === "\n") {
|
|
983
|
-
shouldIndentNextCharacter = true;
|
|
984
|
-
} else if (char !== "\r" && shouldIndentNextCharacter) {
|
|
985
|
-
shouldIndentNextCharacter = false;
|
|
986
|
-
if (charIndex === chunk.start) {
|
|
987
|
-
chunk.prependRight(indentStr);
|
|
988
|
-
} else {
|
|
989
|
-
this._splitChunk(chunk, charIndex);
|
|
990
|
-
chunk = chunk.next;
|
|
991
|
-
chunk.prependRight(indentStr);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
charIndex += 1;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
charIndex = chunk.end;
|
|
999
|
-
chunk = chunk.next;
|
|
1000
|
-
}
|
|
1001
|
-
this.outro = this.outro.replace(pattern, replacer);
|
|
1002
|
-
return this;
|
|
1003
|
-
}
|
|
1004
|
-
insert() {
|
|
1005
|
-
throw new Error(
|
|
1006
|
-
"magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
insertLeft(index, content) {
|
|
1010
|
-
if (!warned.insertLeft) {
|
|
1011
|
-
console.warn(
|
|
1012
|
-
"magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
|
|
1013
|
-
);
|
|
1014
|
-
warned.insertLeft = true;
|
|
1015
|
-
}
|
|
1016
|
-
return this.appendLeft(index, content);
|
|
1017
|
-
}
|
|
1018
|
-
insertRight(index, content) {
|
|
1019
|
-
if (!warned.insertRight) {
|
|
1020
|
-
console.warn(
|
|
1021
|
-
"magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
|
|
1022
|
-
);
|
|
1023
|
-
warned.insertRight = true;
|
|
1024
|
-
}
|
|
1025
|
-
return this.prependRight(index, content);
|
|
1026
|
-
}
|
|
1027
|
-
move(start, end, index) {
|
|
1028
|
-
start = start + this.offset;
|
|
1029
|
-
end = end + this.offset;
|
|
1030
|
-
index = index + this.offset;
|
|
1031
|
-
if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
|
|
1032
|
-
this._split(start);
|
|
1033
|
-
this._split(end);
|
|
1034
|
-
this._split(index);
|
|
1035
|
-
const first = this.byStart[start];
|
|
1036
|
-
const last = this.byEnd[end];
|
|
1037
|
-
const oldLeft = first.previous;
|
|
1038
|
-
const oldRight = last.next;
|
|
1039
|
-
const newRight = this.byStart[index];
|
|
1040
|
-
if (!newRight && last === this.lastChunk) return this;
|
|
1041
|
-
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
1042
|
-
if (oldLeft) oldLeft.next = oldRight;
|
|
1043
|
-
if (oldRight) oldRight.previous = oldLeft;
|
|
1044
|
-
if (newLeft) newLeft.next = first;
|
|
1045
|
-
if (newRight) newRight.previous = last;
|
|
1046
|
-
if (!first.previous) this.firstChunk = last.next;
|
|
1047
|
-
if (!last.next) {
|
|
1048
|
-
this.lastChunk = first.previous;
|
|
1049
|
-
this.lastChunk.next = null;
|
|
1050
|
-
}
|
|
1051
|
-
first.previous = newLeft;
|
|
1052
|
-
last.next = newRight || null;
|
|
1053
|
-
if (!newLeft) this.firstChunk = first;
|
|
1054
|
-
if (!newRight) this.lastChunk = last;
|
|
1055
|
-
return this;
|
|
1056
|
-
}
|
|
1057
|
-
overwrite(start, end, content, options) {
|
|
1058
|
-
options = options || {};
|
|
1059
|
-
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
1060
|
-
}
|
|
1061
|
-
update(start, end, content, options) {
|
|
1062
|
-
start = start + this.offset;
|
|
1063
|
-
end = end + this.offset;
|
|
1064
|
-
if (typeof content !== "string") throw new TypeError("replacement content must be a string");
|
|
1065
|
-
if (this.original.length !== 0) {
|
|
1066
|
-
while (start < 0) start += this.original.length;
|
|
1067
|
-
while (end < 0) end += this.original.length;
|
|
1068
|
-
}
|
|
1069
|
-
if (end > this.original.length) throw new Error("end is out of bounds");
|
|
1070
|
-
if (start === end)
|
|
1071
|
-
throw new Error(
|
|
1072
|
-
"Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
|
|
1073
|
-
);
|
|
1074
|
-
this._split(start);
|
|
1075
|
-
this._split(end);
|
|
1076
|
-
if (options === true) {
|
|
1077
|
-
if (!warned.storeName) {
|
|
1078
|
-
console.warn(
|
|
1079
|
-
"The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
|
|
1080
|
-
);
|
|
1081
|
-
warned.storeName = true;
|
|
1082
|
-
}
|
|
1083
|
-
options = { storeName: true };
|
|
1084
|
-
}
|
|
1085
|
-
const storeName = options !== void 0 ? options.storeName : false;
|
|
1086
|
-
const overwrite = options !== void 0 ? options.overwrite : false;
|
|
1087
|
-
if (storeName) {
|
|
1088
|
-
const original = this.original.slice(start, end);
|
|
1089
|
-
Object.defineProperty(this.storedNames, original, {
|
|
1090
|
-
writable: true,
|
|
1091
|
-
value: true,
|
|
1092
|
-
enumerable: true
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
const first = this.byStart[start];
|
|
1096
|
-
const last = this.byEnd[end];
|
|
1097
|
-
if (first) {
|
|
1098
|
-
let chunk = first;
|
|
1099
|
-
while (chunk !== last) {
|
|
1100
|
-
if (chunk.next !== this.byStart[chunk.end]) {
|
|
1101
|
-
throw new Error("Cannot overwrite across a split point");
|
|
1102
|
-
}
|
|
1103
|
-
chunk = chunk.next;
|
|
1104
|
-
chunk.edit("", false);
|
|
1105
|
-
}
|
|
1106
|
-
first.edit(content, storeName, !overwrite);
|
|
1107
|
-
} else {
|
|
1108
|
-
const newChunk = new Chunk(start, end, "").edit(content, storeName);
|
|
1109
|
-
last.next = newChunk;
|
|
1110
|
-
newChunk.previous = last;
|
|
1111
|
-
}
|
|
1112
|
-
return this;
|
|
1113
|
-
}
|
|
1114
|
-
prepend(content) {
|
|
1115
|
-
if (typeof content !== "string") throw new TypeError("outro content must be a string");
|
|
1116
|
-
this.intro = content + this.intro;
|
|
1117
|
-
return this;
|
|
1118
|
-
}
|
|
1119
|
-
prependLeft(index, content) {
|
|
1120
|
-
index = index + this.offset;
|
|
1121
|
-
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
1122
|
-
this._split(index);
|
|
1123
|
-
const chunk = this.byEnd[index];
|
|
1124
|
-
if (chunk) {
|
|
1125
|
-
chunk.prependLeft(content);
|
|
1126
|
-
} else {
|
|
1127
|
-
this.intro = content + this.intro;
|
|
1128
|
-
}
|
|
1129
|
-
return this;
|
|
1130
|
-
}
|
|
1131
|
-
prependRight(index, content) {
|
|
1132
|
-
index = index + this.offset;
|
|
1133
|
-
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
1134
|
-
this._split(index);
|
|
1135
|
-
const chunk = this.byStart[index];
|
|
1136
|
-
if (chunk) {
|
|
1137
|
-
chunk.prependRight(content);
|
|
1138
|
-
} else {
|
|
1139
|
-
this.outro = content + this.outro;
|
|
1140
|
-
}
|
|
1141
|
-
return this;
|
|
1142
|
-
}
|
|
1143
|
-
remove(start, end) {
|
|
1144
|
-
start = start + this.offset;
|
|
1145
|
-
end = end + this.offset;
|
|
1146
|
-
if (this.original.length !== 0) {
|
|
1147
|
-
while (start < 0) start += this.original.length;
|
|
1148
|
-
while (end < 0) end += this.original.length;
|
|
1149
|
-
}
|
|
1150
|
-
if (start === end) return this;
|
|
1151
|
-
if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
|
|
1152
|
-
if (start > end) throw new Error("end must be greater than start");
|
|
1153
|
-
this._split(start);
|
|
1154
|
-
this._split(end);
|
|
1155
|
-
let chunk = this.byStart[start];
|
|
1156
|
-
while (chunk) {
|
|
1157
|
-
chunk.intro = "";
|
|
1158
|
-
chunk.outro = "";
|
|
1159
|
-
chunk.edit("");
|
|
1160
|
-
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
1161
|
-
}
|
|
1162
|
-
return this;
|
|
1163
|
-
}
|
|
1164
|
-
reset(start, end) {
|
|
1165
|
-
start = start + this.offset;
|
|
1166
|
-
end = end + this.offset;
|
|
1167
|
-
if (this.original.length !== 0) {
|
|
1168
|
-
while (start < 0) start += this.original.length;
|
|
1169
|
-
while (end < 0) end += this.original.length;
|
|
1170
|
-
}
|
|
1171
|
-
if (start === end) return this;
|
|
1172
|
-
if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
|
|
1173
|
-
if (start > end) throw new Error("end must be greater than start");
|
|
1174
|
-
this._split(start);
|
|
1175
|
-
this._split(end);
|
|
1176
|
-
let chunk = this.byStart[start];
|
|
1177
|
-
while (chunk) {
|
|
1178
|
-
chunk.reset();
|
|
1179
|
-
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
1180
|
-
}
|
|
1181
|
-
return this;
|
|
1182
|
-
}
|
|
1183
|
-
lastChar() {
|
|
1184
|
-
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
1185
|
-
let chunk = this.lastChunk;
|
|
1186
|
-
do {
|
|
1187
|
-
if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
|
|
1188
|
-
if (chunk.content.length) return chunk.content[chunk.content.length - 1];
|
|
1189
|
-
if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
|
|
1190
|
-
} while (chunk = chunk.previous);
|
|
1191
|
-
if (this.intro.length) return this.intro[this.intro.length - 1];
|
|
1192
|
-
return "";
|
|
1193
|
-
}
|
|
1194
|
-
lastLine() {
|
|
1195
|
-
let lineIndex = this.outro.lastIndexOf(n);
|
|
1196
|
-
if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
|
|
1197
|
-
let lineStr = this.outro;
|
|
1198
|
-
let chunk = this.lastChunk;
|
|
1199
|
-
do {
|
|
1200
|
-
if (chunk.outro.length > 0) {
|
|
1201
|
-
lineIndex = chunk.outro.lastIndexOf(n);
|
|
1202
|
-
if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
1203
|
-
lineStr = chunk.outro + lineStr;
|
|
1204
|
-
}
|
|
1205
|
-
if (chunk.content.length > 0) {
|
|
1206
|
-
lineIndex = chunk.content.lastIndexOf(n);
|
|
1207
|
-
if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
1208
|
-
lineStr = chunk.content + lineStr;
|
|
1209
|
-
}
|
|
1210
|
-
if (chunk.intro.length > 0) {
|
|
1211
|
-
lineIndex = chunk.intro.lastIndexOf(n);
|
|
1212
|
-
if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
1213
|
-
lineStr = chunk.intro + lineStr;
|
|
1214
|
-
}
|
|
1215
|
-
} while (chunk = chunk.previous);
|
|
1216
|
-
lineIndex = this.intro.lastIndexOf(n);
|
|
1217
|
-
if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
|
|
1218
|
-
return this.intro + lineStr;
|
|
1219
|
-
}
|
|
1220
|
-
slice(start = 0, end = this.original.length - this.offset) {
|
|
1221
|
-
start = start + this.offset;
|
|
1222
|
-
end = end + this.offset;
|
|
1223
|
-
if (this.original.length !== 0) {
|
|
1224
|
-
while (start < 0) start += this.original.length;
|
|
1225
|
-
while (end < 0) end += this.original.length;
|
|
1226
|
-
}
|
|
1227
|
-
let result = "";
|
|
1228
|
-
let chunk = this.firstChunk;
|
|
1229
|
-
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
1230
|
-
if (chunk.start < end && chunk.end >= end) {
|
|
1231
|
-
return result;
|
|
1232
|
-
}
|
|
1233
|
-
chunk = chunk.next;
|
|
1234
|
-
}
|
|
1235
|
-
if (chunk && chunk.edited && chunk.start !== start)
|
|
1236
|
-
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
1237
|
-
const startChunk = chunk;
|
|
1238
|
-
while (chunk) {
|
|
1239
|
-
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
1240
|
-
result += chunk.intro;
|
|
1241
|
-
}
|
|
1242
|
-
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
1243
|
-
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
1244
|
-
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
1245
|
-
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
1246
|
-
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
1247
|
-
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
1248
|
-
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
1249
|
-
result += chunk.outro;
|
|
1250
|
-
}
|
|
1251
|
-
if (containsEnd) {
|
|
1252
|
-
break;
|
|
1253
|
-
}
|
|
1254
|
-
chunk = chunk.next;
|
|
1255
|
-
}
|
|
1256
|
-
return result;
|
|
1257
|
-
}
|
|
1258
|
-
// TODO deprecate this? not really very useful
|
|
1259
|
-
snip(start, end) {
|
|
1260
|
-
const clone = this.clone();
|
|
1261
|
-
clone.remove(0, start);
|
|
1262
|
-
clone.remove(end, clone.original.length);
|
|
1263
|
-
return clone;
|
|
1264
|
-
}
|
|
1265
|
-
_split(index) {
|
|
1266
|
-
if (this.byStart[index] || this.byEnd[index]) return;
|
|
1267
|
-
let chunk = this.lastSearchedChunk;
|
|
1268
|
-
let previousChunk = chunk;
|
|
1269
|
-
const searchForward = index > chunk.end;
|
|
1270
|
-
while (chunk) {
|
|
1271
|
-
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
1272
|
-
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
1273
|
-
if (chunk === previousChunk) return;
|
|
1274
|
-
previousChunk = chunk;
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
_splitChunk(chunk, index) {
|
|
1278
|
-
if (chunk.edited && chunk.content.length) {
|
|
1279
|
-
const loc = getLocator(this.original)(index);
|
|
1280
|
-
throw new Error(
|
|
1281
|
-
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
|
-
const newChunk = chunk.split(index);
|
|
1285
|
-
this.byEnd[index] = chunk;
|
|
1286
|
-
this.byStart[index] = newChunk;
|
|
1287
|
-
this.byEnd[newChunk.end] = newChunk;
|
|
1288
|
-
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
1289
|
-
this.lastSearchedChunk = chunk;
|
|
1290
|
-
return true;
|
|
1291
|
-
}
|
|
1292
|
-
toString() {
|
|
1293
|
-
let str = this.intro;
|
|
1294
|
-
let chunk = this.firstChunk;
|
|
1295
|
-
while (chunk) {
|
|
1296
|
-
str += chunk.toString();
|
|
1297
|
-
chunk = chunk.next;
|
|
1298
|
-
}
|
|
1299
|
-
return str + this.outro;
|
|
1300
|
-
}
|
|
1301
|
-
isEmpty() {
|
|
1302
|
-
let chunk = this.firstChunk;
|
|
1303
|
-
do {
|
|
1304
|
-
if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
|
|
1305
|
-
return false;
|
|
1306
|
-
} while (chunk = chunk.next);
|
|
1307
|
-
return true;
|
|
1308
|
-
}
|
|
1309
|
-
length() {
|
|
1310
|
-
let chunk = this.firstChunk;
|
|
1311
|
-
let length = 0;
|
|
1312
|
-
do {
|
|
1313
|
-
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
1314
|
-
} while (chunk = chunk.next);
|
|
1315
|
-
return length;
|
|
1316
|
-
}
|
|
1317
|
-
trimLines() {
|
|
1318
|
-
return this.trim("[\\r\\n]");
|
|
1319
|
-
}
|
|
1320
|
-
trim(charType) {
|
|
1321
|
-
return this.trimStart(charType).trimEnd(charType);
|
|
1322
|
-
}
|
|
1323
|
-
trimEndAborted(charType) {
|
|
1324
|
-
const rx = new RegExp((charType || "\\s") + "+$");
|
|
1325
|
-
this.outro = this.outro.replace(rx, "");
|
|
1326
|
-
if (this.outro.length) return true;
|
|
1327
|
-
let chunk = this.lastChunk;
|
|
1328
|
-
do {
|
|
1329
|
-
const end = chunk.end;
|
|
1330
|
-
const aborted = chunk.trimEnd(rx);
|
|
1331
|
-
if (chunk.end !== end) {
|
|
1332
|
-
if (this.lastChunk === chunk) {
|
|
1333
|
-
this.lastChunk = chunk.next;
|
|
1334
|
-
}
|
|
1335
|
-
this.byEnd[chunk.end] = chunk;
|
|
1336
|
-
this.byStart[chunk.next.start] = chunk.next;
|
|
1337
|
-
this.byEnd[chunk.next.end] = chunk.next;
|
|
1338
|
-
}
|
|
1339
|
-
if (aborted) return true;
|
|
1340
|
-
chunk = chunk.previous;
|
|
1341
|
-
} while (chunk);
|
|
1342
|
-
return false;
|
|
1343
|
-
}
|
|
1344
|
-
trimEnd(charType) {
|
|
1345
|
-
this.trimEndAborted(charType);
|
|
1346
|
-
return this;
|
|
1347
|
-
}
|
|
1348
|
-
trimStartAborted(charType) {
|
|
1349
|
-
const rx = new RegExp("^" + (charType || "\\s") + "+");
|
|
1350
|
-
this.intro = this.intro.replace(rx, "");
|
|
1351
|
-
if (this.intro.length) return true;
|
|
1352
|
-
let chunk = this.firstChunk;
|
|
1353
|
-
do {
|
|
1354
|
-
const end = chunk.end;
|
|
1355
|
-
const aborted = chunk.trimStart(rx);
|
|
1356
|
-
if (chunk.end !== end) {
|
|
1357
|
-
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
1358
|
-
this.byEnd[chunk.end] = chunk;
|
|
1359
|
-
this.byStart[chunk.next.start] = chunk.next;
|
|
1360
|
-
this.byEnd[chunk.next.end] = chunk.next;
|
|
1361
|
-
}
|
|
1362
|
-
if (aborted) return true;
|
|
1363
|
-
chunk = chunk.next;
|
|
1364
|
-
} while (chunk);
|
|
1365
|
-
return false;
|
|
1366
|
-
}
|
|
1367
|
-
trimStart(charType) {
|
|
1368
|
-
this.trimStartAborted(charType);
|
|
1369
|
-
return this;
|
|
1370
|
-
}
|
|
1371
|
-
hasChanged() {
|
|
1372
|
-
return this.original !== this.toString();
|
|
1373
|
-
}
|
|
1374
|
-
_replaceRegexp(searchValue, replacement) {
|
|
1375
|
-
function getReplacement(match, str) {
|
|
1376
|
-
if (typeof replacement === "string") {
|
|
1377
|
-
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
1378
|
-
if (i === "$") return "$";
|
|
1379
|
-
if (i === "&") return match[0];
|
|
1380
|
-
const num = +i;
|
|
1381
|
-
if (num < match.length) return match[+i];
|
|
1382
|
-
return `$${i}`;
|
|
1383
|
-
});
|
|
1384
|
-
} else {
|
|
1385
|
-
return replacement(...match, match.index, str, match.groups);
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
function matchAll(re, str) {
|
|
1389
|
-
let match;
|
|
1390
|
-
const matches = [];
|
|
1391
|
-
while (match = re.exec(str)) {
|
|
1392
|
-
matches.push(match);
|
|
1393
|
-
}
|
|
1394
|
-
return matches;
|
|
1395
|
-
}
|
|
1396
|
-
if (searchValue.global) {
|
|
1397
|
-
const matches = matchAll(searchValue, this.original);
|
|
1398
|
-
matches.forEach((match) => {
|
|
1399
|
-
if (match.index != null) {
|
|
1400
|
-
const replacement2 = getReplacement(match, this.original);
|
|
1401
|
-
if (replacement2 !== match[0]) {
|
|
1402
|
-
this.overwrite(match.index, match.index + match[0].length, replacement2);
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
} else {
|
|
1407
|
-
const match = this.original.match(searchValue);
|
|
1408
|
-
if (match && match.index != null) {
|
|
1409
|
-
const replacement2 = getReplacement(match, this.original);
|
|
1410
|
-
if (replacement2 !== match[0]) {
|
|
1411
|
-
this.overwrite(match.index, match.index + match[0].length, replacement2);
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
return this;
|
|
1416
|
-
}
|
|
1417
|
-
_replaceString(string, replacement) {
|
|
1418
|
-
const { original } = this;
|
|
1419
|
-
const index = original.indexOf(string);
|
|
1420
|
-
if (index !== -1) {
|
|
1421
|
-
if (typeof replacement === "function") {
|
|
1422
|
-
replacement = replacement(string, index, original);
|
|
1423
|
-
}
|
|
1424
|
-
if (string !== replacement) {
|
|
1425
|
-
this.overwrite(index, index + string.length, replacement);
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
return this;
|
|
1429
|
-
}
|
|
1430
|
-
replace(searchValue, replacement) {
|
|
1431
|
-
if (typeof searchValue === "string") {
|
|
1432
|
-
return this._replaceString(searchValue, replacement);
|
|
1433
|
-
}
|
|
1434
|
-
return this._replaceRegexp(searchValue, replacement);
|
|
1435
|
-
}
|
|
1436
|
-
_replaceAllString(string, replacement) {
|
|
1437
|
-
const { original } = this;
|
|
1438
|
-
const stringLength = string.length;
|
|
1439
|
-
for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
1440
|
-
const previous = original.slice(index, index + stringLength);
|
|
1441
|
-
let _replacement = replacement;
|
|
1442
|
-
if (typeof replacement === "function") {
|
|
1443
|
-
_replacement = replacement(previous, index, original);
|
|
1444
|
-
}
|
|
1445
|
-
if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
|
|
1446
|
-
}
|
|
1447
|
-
return this;
|
|
1448
|
-
}
|
|
1449
|
-
replaceAll(searchValue, replacement) {
|
|
1450
|
-
if (typeof searchValue === "string") {
|
|
1451
|
-
return this._replaceAllString(searchValue, replacement);
|
|
1452
|
-
}
|
|
1453
|
-
if (!searchValue.global) {
|
|
1454
|
-
throw new TypeError(
|
|
1455
|
-
"MagicString.prototype.replaceAll called with a non-global RegExp argument"
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
return this._replaceRegexp(searchValue, replacement);
|
|
1459
|
-
}
|
|
1460
|
-
};
|
|
1461
|
-
var hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1462
|
-
var Bundle = class _Bundle {
|
|
1463
|
-
constructor(options = {}) {
|
|
1464
|
-
this.intro = options.intro || "";
|
|
1465
|
-
this.separator = options.separator !== void 0 ? options.separator : "\n";
|
|
1466
|
-
this.sources = [];
|
|
1467
|
-
this.uniqueSources = [];
|
|
1468
|
-
this.uniqueSourceIndexByFilename = {};
|
|
1469
|
-
}
|
|
1470
|
-
addSource(source) {
|
|
1471
|
-
if (source instanceof MagicString) {
|
|
1472
|
-
return this.addSource({
|
|
1473
|
-
content: source,
|
|
1474
|
-
filename: source.filename,
|
|
1475
|
-
separator: this.separator
|
|
1476
|
-
});
|
|
1477
|
-
}
|
|
1478
|
-
if (!isObject(source) || !source.content) {
|
|
1479
|
-
throw new Error(
|
|
1480
|
-
"bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`"
|
|
1481
|
-
);
|
|
1482
|
-
}
|
|
1483
|
-
["filename", "ignoreList", "indentExclusionRanges", "separator"].forEach((option) => {
|
|
1484
|
-
if (!hasOwnProp.call(source, option)) source[option] = source.content[option];
|
|
1485
|
-
});
|
|
1486
|
-
if (source.separator === void 0) {
|
|
1487
|
-
source.separator = this.separator;
|
|
1488
|
-
}
|
|
1489
|
-
if (source.filename) {
|
|
1490
|
-
if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {
|
|
1491
|
-
this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;
|
|
1492
|
-
this.uniqueSources.push({ filename: source.filename, content: source.content.original });
|
|
1493
|
-
} else {
|
|
1494
|
-
const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];
|
|
1495
|
-
if (source.content.original !== uniqueSource.content) {
|
|
1496
|
-
throw new Error(`Illegal source: same filename (${source.filename}), different contents`);
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
this.sources.push(source);
|
|
1501
|
-
return this;
|
|
1502
|
-
}
|
|
1503
|
-
append(str, options) {
|
|
1504
|
-
this.addSource({
|
|
1505
|
-
content: new MagicString(str),
|
|
1506
|
-
separator: options && options.separator || ""
|
|
1507
|
-
});
|
|
1508
|
-
return this;
|
|
1509
|
-
}
|
|
1510
|
-
clone() {
|
|
1511
|
-
const bundle = new _Bundle({
|
|
1512
|
-
intro: this.intro,
|
|
1513
|
-
separator: this.separator
|
|
1514
|
-
});
|
|
1515
|
-
this.sources.forEach((source) => {
|
|
1516
|
-
bundle.addSource({
|
|
1517
|
-
filename: source.filename,
|
|
1518
|
-
content: source.content.clone(),
|
|
1519
|
-
separator: source.separator
|
|
1520
|
-
});
|
|
1521
|
-
});
|
|
1522
|
-
return bundle;
|
|
1523
|
-
}
|
|
1524
|
-
generateDecodedMap(options = {}) {
|
|
1525
|
-
const names = [];
|
|
1526
|
-
let x_google_ignoreList = void 0;
|
|
1527
|
-
this.sources.forEach((source) => {
|
|
1528
|
-
Object.keys(source.content.storedNames).forEach((name) => {
|
|
1529
|
-
if (!~names.indexOf(name)) names.push(name);
|
|
1530
|
-
});
|
|
1531
|
-
});
|
|
1532
|
-
const mappings = new Mappings(options.hires);
|
|
1533
|
-
if (this.intro) {
|
|
1534
|
-
mappings.advance(this.intro);
|
|
1535
|
-
}
|
|
1536
|
-
this.sources.forEach((source, i) => {
|
|
1537
|
-
if (i > 0) {
|
|
1538
|
-
mappings.advance(this.separator);
|
|
1539
|
-
}
|
|
1540
|
-
const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1541
|
-
const magicString = source.content;
|
|
1542
|
-
const locate = getLocator(magicString.original);
|
|
1543
|
-
if (magicString.intro) {
|
|
1544
|
-
mappings.advance(magicString.intro);
|
|
1545
|
-
}
|
|
1546
|
-
magicString.firstChunk.eachNext((chunk) => {
|
|
1547
|
-
const loc = locate(chunk.start);
|
|
1548
|
-
if (chunk.intro.length) mappings.advance(chunk.intro);
|
|
1549
|
-
if (source.filename) {
|
|
1550
|
-
if (chunk.edited) {
|
|
1551
|
-
mappings.addEdit(
|
|
1552
|
-
sourceIndex,
|
|
1553
|
-
chunk.content,
|
|
1554
|
-
loc,
|
|
1555
|
-
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
1556
|
-
);
|
|
1557
|
-
} else {
|
|
1558
|
-
mappings.addUneditedChunk(
|
|
1559
|
-
sourceIndex,
|
|
1560
|
-
chunk,
|
|
1561
|
-
magicString.original,
|
|
1562
|
-
loc,
|
|
1563
|
-
magicString.sourcemapLocations
|
|
1564
|
-
);
|
|
1565
|
-
}
|
|
1566
|
-
} else {
|
|
1567
|
-
mappings.advance(chunk.content);
|
|
1568
|
-
}
|
|
1569
|
-
if (chunk.outro.length) mappings.advance(chunk.outro);
|
|
1570
|
-
});
|
|
1571
|
-
if (magicString.outro) {
|
|
1572
|
-
mappings.advance(magicString.outro);
|
|
1573
|
-
}
|
|
1574
|
-
if (source.ignoreList && sourceIndex !== -1) {
|
|
1575
|
-
if (x_google_ignoreList === void 0) {
|
|
1576
|
-
x_google_ignoreList = [];
|
|
1577
|
-
}
|
|
1578
|
-
x_google_ignoreList.push(sourceIndex);
|
|
1579
|
-
}
|
|
1580
|
-
});
|
|
1581
|
-
return {
|
|
1582
|
-
file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
|
|
1583
|
-
sources: this.uniqueSources.map((source) => {
|
|
1584
|
-
return options.file ? getRelativePath(options.file, source.filename) : source.filename;
|
|
1585
|
-
}),
|
|
1586
|
-
sourcesContent: this.uniqueSources.map((source) => {
|
|
1587
|
-
return options.includeContent ? source.content : null;
|
|
1588
|
-
}),
|
|
1589
|
-
names,
|
|
1590
|
-
mappings: mappings.raw,
|
|
1591
|
-
x_google_ignoreList
|
|
1592
|
-
};
|
|
1593
|
-
}
|
|
1594
|
-
generateMap(options) {
|
|
1595
|
-
return new SourceMap(this.generateDecodedMap(options));
|
|
1596
|
-
}
|
|
1597
|
-
getIndentString() {
|
|
1598
|
-
const indentStringCounts = {};
|
|
1599
|
-
this.sources.forEach((source) => {
|
|
1600
|
-
const indentStr = source.content._getRawIndentString();
|
|
1601
|
-
if (indentStr === null) return;
|
|
1602
|
-
if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;
|
|
1603
|
-
indentStringCounts[indentStr] += 1;
|
|
1604
|
-
});
|
|
1605
|
-
return Object.keys(indentStringCounts).sort((a, b) => {
|
|
1606
|
-
return indentStringCounts[a] - indentStringCounts[b];
|
|
1607
|
-
})[0] || " ";
|
|
1608
|
-
}
|
|
1609
|
-
indent(indentStr) {
|
|
1610
|
-
if (!arguments.length) {
|
|
1611
|
-
indentStr = this.getIndentString();
|
|
1612
|
-
}
|
|
1613
|
-
if (indentStr === "") return this;
|
|
1614
|
-
let trailingNewline = !this.intro || this.intro.slice(-1) === "\n";
|
|
1615
|
-
this.sources.forEach((source, i) => {
|
|
1616
|
-
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1617
|
-
const indentStart = trailingNewline || i > 0 && /\r?\n$/.test(separator);
|
|
1618
|
-
source.content.indent(indentStr, {
|
|
1619
|
-
exclude: source.indentExclusionRanges,
|
|
1620
|
-
indentStart
|
|
1621
|
-
//: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
|
|
1622
|
-
});
|
|
1623
|
-
trailingNewline = source.content.lastChar() === "\n";
|
|
1624
|
-
});
|
|
1625
|
-
if (this.intro) {
|
|
1626
|
-
this.intro = indentStr + this.intro.replace(/^[^\n]/gm, (match, index) => {
|
|
1627
|
-
return index > 0 ? indentStr + match : match;
|
|
1628
|
-
});
|
|
1629
|
-
}
|
|
1630
|
-
return this;
|
|
1631
|
-
}
|
|
1632
|
-
prepend(str) {
|
|
1633
|
-
this.intro = str + this.intro;
|
|
1634
|
-
return this;
|
|
1635
|
-
}
|
|
1636
|
-
toString() {
|
|
1637
|
-
const body = this.sources.map((source, i) => {
|
|
1638
|
-
const separator = source.separator !== void 0 ? source.separator : this.separator;
|
|
1639
|
-
const str = (i > 0 ? separator : "") + source.content.toString();
|
|
1640
|
-
return str;
|
|
1641
|
-
}).join("");
|
|
1642
|
-
return this.intro + body;
|
|
1643
|
-
}
|
|
1644
|
-
isEmpty() {
|
|
1645
|
-
if (this.intro.length && this.intro.trim()) return false;
|
|
1646
|
-
if (this.sources.some((source) => !source.content.isEmpty())) return false;
|
|
1647
|
-
return true;
|
|
1648
|
-
}
|
|
1649
|
-
length() {
|
|
1650
|
-
return this.sources.reduce(
|
|
1651
|
-
(length, source) => length + source.content.length(),
|
|
1652
|
-
this.intro.length
|
|
1653
|
-
);
|
|
1654
|
-
}
|
|
1655
|
-
trimLines() {
|
|
1656
|
-
return this.trim("[\\r\\n]");
|
|
1657
|
-
}
|
|
1658
|
-
trim(charType) {
|
|
1659
|
-
return this.trimStart(charType).trimEnd(charType);
|
|
1660
|
-
}
|
|
1661
|
-
trimStart(charType) {
|
|
1662
|
-
const rx = new RegExp("^" + (charType || "\\s") + "+");
|
|
1663
|
-
this.intro = this.intro.replace(rx, "");
|
|
1664
|
-
if (!this.intro) {
|
|
1665
|
-
let source;
|
|
1666
|
-
let i = 0;
|
|
1667
|
-
do {
|
|
1668
|
-
source = this.sources[i++];
|
|
1669
|
-
if (!source) {
|
|
1670
|
-
break;
|
|
1671
|
-
}
|
|
1672
|
-
} while (!source.content.trimStartAborted(charType));
|
|
1673
|
-
}
|
|
1674
|
-
return this;
|
|
1675
|
-
}
|
|
1676
|
-
trimEnd(charType) {
|
|
1677
|
-
const rx = new RegExp((charType || "\\s") + "+$");
|
|
1678
|
-
let source;
|
|
1679
|
-
let i = this.sources.length - 1;
|
|
1680
|
-
do {
|
|
1681
|
-
source = this.sources[i--];
|
|
1682
|
-
if (!source) {
|
|
1683
|
-
this.intro = this.intro.replace(rx, "");
|
|
1684
|
-
break;
|
|
1685
|
-
}
|
|
1686
|
-
} while (!source.content.trimEndAborted(charType));
|
|
1687
|
-
return this;
|
|
1688
|
-
}
|
|
1689
|
-
};
|
|
1690
|
-
MagicString.Bundle = Bundle;
|
|
1691
|
-
MagicString.SourceMap = SourceMap;
|
|
1692
|
-
MagicString.default = MagicString;
|
|
1693
|
-
module.exports = MagicString;
|