@absolutejs/absolute 0.19.0-beta.999 → 0.20.0-beta.1
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 +21 -13
- package/README.md +48 -2
- package/dist/angular/browser.js +82 -77
- package/dist/angular/browser.js.map +11 -11
- package/dist/angular/components/constants.js +43 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +132 -134
- package/dist/angular/index.js +1719 -844
- package/dist/angular/index.js.map +34 -26
- package/dist/angular/server.js +1620 -768
- package/dist/angular/server.js.map +28 -20
- package/dist/build.js +4935 -2593
- package/dist/build.js.map +72 -57
- package/dist/cli/config/client.js +578 -0
- package/dist/cli/config/server.js +39587 -0
- package/dist/cli/htmx/htmx.min.js +1 -0
- package/dist/cli/index.js +16828 -3511
- package/dist/client/index.js +49 -46
- package/dist/client/index.js.map +12 -12
- package/dist/core/streamingSlotRegistrar.js +1 -19
- package/dist/core/streamingSlotRegistrar.js.map +2 -2
- package/dist/core/streamingSlotRegistry.js +1 -19
- package/dist/core/streamingSlotRegistry.js.map +2 -2
- package/dist/dev/client/cssUtils.ts +98 -41
- package/dist/dev/client/domState.ts +2 -0
- package/dist/dev/client/errorOverlay.ts +14 -13
- package/dist/dev/client/handlers/angularHmrShim.ts +20 -20
- package/dist/dev/client/handlers/angularRemount.ts +74 -55
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -2
- package/dist/dev/client/handlers/html.ts +144 -41
- package/dist/dev/client/handlers/htmx.ts +43 -8
- package/dist/dev/client/handlers/react.ts +114 -32
- package/dist/dev/client/handlers/rebuild.ts +28 -8
- package/dist/dev/client/handlers/svelte.ts +92 -51
- package/dist/dev/client/handlers/vue.ts +36 -45
- package/dist/dev/client/hmrClient.ts +101 -26
- package/dist/dev/client/hmrTiming.ts +141 -0
- package/dist/dev/client/hmrToast.ts +22 -24
- package/dist/dev/client/reactRefreshSetup.ts +4 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.d.ts +12 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.js +313 -0
- package/dist/dev/serverBootstrap.js +45 -0
- package/dist/index.js +7153 -3224
- package/dist/index.js.map +118 -86
- package/dist/islands/browser.js +1 -19
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +709 -120
- package/dist/islands/index.js.map +18 -13
- package/dist/mobile/browser.js +428 -0
- package/dist/mobile/browser.js.map +12 -0
- package/dist/mobile/index.js +3058 -0
- package/dist/mobile/index.js.map +35 -0
- package/dist/react/browser.js +13 -62
- package/dist/react/browser.js.map +5 -6
- package/dist/react/components/browser/index.js +23 -13
- package/dist/react/components/index.js +30 -34
- package/dist/react/components/index.js.map +8 -7
- package/dist/react/hooks/index.js +1 -19
- package/dist/react/hooks/index.js.map +3 -3
- package/dist/react/index.js +1643 -679
- package/dist/react/index.js.map +29 -20
- package/dist/react/jsxDevRuntimeCompat.js +22 -20
- package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
- package/dist/react/jsxRuntimeCompat.js +90 -0
- package/dist/react/jsxRuntimeCompat.js.map +10 -0
- package/dist/react/router/browser.js +77 -0
- package/dist/react/router/browser.js.map +10 -0
- package/dist/react/router/index.js +77 -0
- package/dist/react/router/index.js.map +10 -0
- package/dist/react/server.js +950 -565
- package/dist/react/server.js.map +16 -11
- package/dist/src/angular/components/constants.d.ts +21 -0
- package/dist/src/angular/hmrPreserveCore.d.ts +7 -20
- package/dist/src/angular/islands.d.ts +1 -1
- package/dist/src/angular/pageHandler.d.ts +2 -0
- package/dist/src/angular/ssrRender.d.ts +4 -1
- package/dist/src/build/bunStringRawUnicodePlugin.d.ts +12 -0
- package/dist/src/build/chainInlineSourcemaps.d.ts +1 -0
- package/dist/src/build/compileAngular.d.ts +5 -7
- package/dist/src/build/compileSvelte.d.ts +3 -0
- package/dist/src/build/compileVue.d.ts +3 -1
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/islandRegistryTransform.d.ts +17 -0
- package/dist/src/build/maskLiterals.d.ts +28 -0
- package/dist/src/build/parseVueSpaRoutes.d.ts +5 -0
- package/dist/src/build/resolveBuildMode.d.ts +7 -0
- package/dist/src/build/serverExternals.d.ts +14 -0
- package/dist/src/build/spaSideManifests.d.ts +16 -0
- package/dist/src/build/tailwindCompiler.d.ts +0 -1
- package/dist/src/cli/add/dependencies.d.ts +13 -0
- package/dist/src/cli/config/absolute/AbsoluteConfigPanel.d.ts +6 -0
- package/dist/src/cli/config/absolute/editAbsoluteConfig.d.ts +5 -0
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +19 -0
- package/dist/src/cli/config/auth/AuthPanel.d.ts +6 -0
- package/dist/src/cli/config/auth/authCatalog.d.ts +10 -0
- package/dist/src/cli/config/auth/authScaffolds.d.ts +16 -0
- package/dist/src/cli/config/auth/editAuthConfig.d.ts +5 -0
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +14 -0
- package/dist/src/cli/config/auth/resolveAuthState.d.ts +2 -0
- package/dist/src/cli/config/auth/scaffoldAuthFeature.d.ts +6 -0
- package/dist/src/cli/config/client.d.ts +1 -0
- package/dist/src/cli/config/configCert.d.ts +12 -0
- package/dist/src/cli/config/eslint/EslintPanel.d.ts +6 -0
- package/dist/src/cli/config/eslint/configAst.d.ts +18 -0
- package/dist/src/cli/config/eslint/editConfigRule.d.ts +6 -0
- package/dist/src/cli/config/eslint/eslintStyles.d.ts +1 -0
- package/dist/src/cli/config/eslint/resolveConfig.d.ts +3 -0
- package/dist/src/cli/config/eslint/serializeValue.d.ts +9 -0
- package/dist/src/cli/config/guards.d.ts +4 -0
- package/dist/src/cli/config/integrations/IntegrationsPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/PackageJsonPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/editPackageJson.d.ts +9 -0
- package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +8 -0
- package/dist/src/cli/config/page/ConfigShell.d.ts +6 -0
- package/dist/src/cli/config/page/FieldEditor.d.ts +9 -0
- package/dist/src/cli/config/page/PanelHost.d.ts +6 -0
- package/dist/src/cli/config/page/configStyles.d.ts +1 -0
- package/dist/src/cli/config/panels.d.ts +7 -0
- package/dist/src/cli/config/prettier/PrettierPanel.d.ts +6 -0
- package/dist/src/cli/config/prettier/editPrettier.d.ts +5 -0
- package/dist/src/cli/config/prettier/resolvePrettier.d.ts +11 -0
- package/dist/src/cli/config/schema/fromJsonSchema.d.ts +3 -0
- package/dist/src/cli/config/schema/fromType.d.ts +1 -0
- package/dist/src/cli/config/schema/serialize.d.ts +1 -0
- package/dist/src/cli/config/server.d.ts +527 -0
- package/dist/src/cli/config/tsconfig/TsconfigPanel.d.ts +6 -0
- package/dist/src/cli/config/tsconfig/editTsconfig.d.ts +5 -0
- package/dist/src/cli/config/tsconfig/resolveTsconfig.d.ts +8 -0
- package/dist/src/cli/config/tsconfig/tsconfigStyles.d.ts +1 -0
- package/dist/src/cli/discoverInstances.d.ts +5 -0
- package/dist/src/cli/elysiaOpenApiTypeboxPlugin.d.ts +8 -0
- package/dist/src/cli/generate/componentTemplates.d.ts +7 -0
- package/dist/src/cli/generate/context.d.ts +30 -0
- package/dist/src/cli/generate/cssStrategy.d.ts +20 -0
- package/dist/src/cli/generate/frameworkKey.d.ts +3 -0
- package/dist/src/cli/generate/frameworks.d.ts +40 -0
- package/dist/src/cli/generate/generateApi.d.ts +3 -0
- package/dist/src/cli/generate/generateComponent.d.ts +4 -0
- package/dist/src/cli/generate/generatePage.d.ts +4 -0
- package/dist/src/cli/generate/naming.d.ts +5 -0
- package/dist/src/cli/generate/navData.d.ts +10 -0
- package/dist/src/cli/generate/outcome.d.ts +17 -0
- package/dist/src/cli/generate/pageTemplates.d.ts +11 -0
- package/dist/src/cli/generate/routeWiring.d.ts +40 -0
- package/dist/src/cli/generate/staticNav.d.ts +5 -0
- package/dist/src/cli/heapDiff.d.ts +1 -0
- package/dist/src/cli/htmx/install.d.ts +6 -0
- package/dist/src/cli/inspectData.d.ts +12 -0
- package/dist/src/cli/inspectTui.d.ts +1 -0
- package/dist/src/cli/instanceStatus.d.ts +22 -0
- package/dist/src/cli/integrations/addPlugin.d.ts +8 -0
- package/dist/src/cli/integrations/catalog.d.ts +20 -0
- package/dist/src/cli/psTui.d.ts +1 -0
- package/dist/src/cli/scripts/add.d.ts +1 -0
- package/dist/src/cli/scripts/analyze.d.ts +1 -0
- package/dist/src/cli/scripts/api.d.ts +1 -0
- package/dist/src/cli/scripts/build.d.ts +1 -1
- package/dist/src/cli/scripts/db.d.ts +20 -0
- package/dist/src/cli/scripts/dev.d.ts +5 -1
- package/dist/src/cli/scripts/doctor.d.ts +1 -0
- package/dist/src/cli/scripts/env.d.ts +7 -0
- package/dist/src/cli/scripts/eslint.d.ts +37 -2
- package/dist/src/cli/scripts/eslintChunked.d.ts +37 -0
- package/dist/src/cli/scripts/generate.d.ts +1 -0
- package/dist/src/cli/scripts/htmx.d.ts +1 -0
- package/dist/src/cli/scripts/inspect.d.ts +1 -0
- package/dist/src/cli/scripts/islands.d.ts +1 -0
- package/dist/src/cli/scripts/lintProof.d.ts +42 -0
- package/dist/src/cli/scripts/logs.d.ts +1 -0
- package/dist/src/cli/scripts/ls.d.ts +1 -0
- package/dist/src/cli/scripts/mem.d.ts +1 -0
- package/dist/src/cli/scripts/mobile.d.ts +1 -0
- package/dist/src/cli/scripts/prettier.d.ts +2 -0
- package/dist/src/cli/scripts/ps.d.ts +1 -0
- package/dist/src/cli/scripts/remove.d.ts +1 -0
- package/dist/src/cli/scripts/routes.d.ts +1 -0
- package/dist/src/cli/scripts/start.d.ts +6 -1
- package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
- package/dist/src/cli/scripts/workspace.d.ts +3 -1
- package/dist/src/cli/serverBundleExternals.d.ts +2 -0
- package/dist/src/cli/tuiPrimitives.d.ts +14 -0
- package/dist/src/cli/typeGraphCoherence.d.ts +32 -0
- package/dist/src/cli/utils.d.ts +3 -1
- package/dist/src/cli/workspaceTui.d.ts +2 -1
- package/dist/src/client/hydrators/react.d.ts +1 -1
- package/dist/src/client/hydrators/svelte.d.ts +1 -1
- package/dist/src/client/hydrators/vue.d.ts +1 -1
- package/dist/src/client/islandStore.d.ts +3 -3
- package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
- package/dist/src/constants.d.ts +21 -0
- package/dist/src/core/angularServerModule.d.ts +1 -0
- package/dist/src/core/build.d.ts +11 -3
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/pageResponseCache.d.ts +23 -0
- package/dist/src/core/prepare.d.ts +192 -154
- package/dist/src/core/requestContext.d.ts +18 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +5 -3
- package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
- package/dist/src/dev/clientManager.d.ts +10 -1
- package/dist/src/dev/configResolver.d.ts +2 -0
- package/dist/src/dev/moduleMapper.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -1
- package/dist/src/dev/pathUtils.d.ts +1 -1
- package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
- package/dist/src/dev/rebuildTrigger.d.ts +4 -0
- package/dist/src/dev/requestInspector.d.ts +31 -0
- package/dist/src/dev/serverBootstrap.d.ts +1 -0
- package/dist/src/dev/serverEntryWatcher.d.ts +3 -3
- package/dist/src/dev/tunnel/client.d.ts +20 -0
- package/dist/src/dev/tunnel/protocol.d.ts +85 -0
- package/dist/src/dev/tunnel/relay.d.ts +28 -0
- package/dist/src/dev/webSocket.d.ts +1 -1
- package/dist/src/mobile/androidConformance.d.ts +42 -0
- package/dist/src/mobile/androidEmulatorController.d.ts +99 -0
- package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
- package/dist/src/mobile/androidRelease.d.ts +47 -0
- package/dist/src/mobile/androidWebView.d.ts +46 -0
- package/dist/src/mobile/artifactStore.d.ts +47 -0
- package/dist/src/mobile/associationFiles.d.ts +49 -0
- package/dist/src/mobile/browser.d.ts +2 -0
- package/dist/src/mobile/buildMetadata.d.ts +10 -0
- package/dist/src/mobile/buildPipeline.d.ts +8 -0
- package/dist/src/mobile/buildRelease.d.ts +24 -0
- package/dist/src/mobile/capacitorBundle.d.ts +28 -0
- package/dist/src/mobile/capacitorProject.d.ts +9 -0
- package/dist/src/mobile/client.d.ts +35 -0
- package/dist/src/mobile/compatibilityDispatcher.d.ts +26 -0
- package/dist/src/mobile/config.d.ts +16 -0
- package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
- package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
- package/dist/src/mobile/index.d.ts +19 -0
- package/dist/src/mobile/materializedBundle.d.ts +36 -0
- package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
- package/dist/src/mobile/pageProtocol.d.ts +89 -0
- package/dist/src/mobile/producerContext.d.ts +4 -0
- package/dist/src/mobile/producerContextState.d.ts +10 -0
- package/dist/src/mobile/releaseArtifact.d.ts +75 -0
- package/dist/src/mobile/releaseDoctor.d.ts +13 -0
- package/dist/src/mobile/routeMatcher.d.ts +3 -0
- package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
- package/dist/src/mobile/shellBootstrap.d.ts +1 -0
- package/dist/src/mobile/transport.d.ts +31 -0
- package/dist/src/plugins/devtoolsJson.d.ts +6 -47
- package/dist/src/plugins/hmr.d.ts +22 -96
- package/dist/src/plugins/imageOptimizer.d.ts +150 -62
- package/dist/src/plugins/networking.d.ts +2 -2
- package/dist/src/plugins/openApiPlugin.d.ts +4 -0
- package/dist/src/plugins/telemetryPlugin.d.ts +36 -0
- package/dist/src/react/browser.d.ts +0 -2
- package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
- package/dist/src/react/index.d.ts +0 -2
- package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
- package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
- package/dist/src/react/pageHandler.d.ts +8 -0
- package/dist/src/react/router/UniversalRouter.d.ts +43 -0
- package/dist/src/react/router/browser.d.ts +2 -0
- package/dist/src/react/router/index.d.ts +2 -0
- package/dist/src/svelte/pageHandler.d.ts +5 -0
- package/dist/src/svelte/router/hashMode.d.ts +1 -6
- package/dist/src/svelte/router/matchPath.d.ts +4 -24
- package/dist/src/svelte/router/page.svelte.d.ts +1 -10
- package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
- package/dist/src/utils/cleanup.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +2 -2
- package/dist/src/utils/defineEnv.d.ts +4 -4
- package/dist/src/utils/formatBytes.d.ts +2 -0
- package/dist/src/utils/generatedDir.d.ts +1 -1
- package/dist/src/utils/iconVersion.d.ts +5 -0
- package/dist/src/utils/imageProcessing.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/inlinePageCss.d.ts +9 -0
- package/dist/src/utils/instanceRegistry.d.ts +13 -0
- package/dist/src/utils/isTestSourcePath.d.ts +1 -0
- package/dist/src/utils/jsonLd.d.ts +1 -1
- package/dist/src/utils/loadConfig.d.ts +11 -3
- package/dist/src/utils/logger.d.ts +2 -0
- package/dist/src/utils/portScan.d.ts +22 -0
- package/dist/src/utils/projectRoot.d.ts +17 -0
- package/dist/src/utils/resolveConvention.d.ts +1 -1
- package/dist/src/utils/resolveDevPort.d.ts +4 -1
- package/dist/src/utils/runtimeMode.d.ts +1 -1
- package/dist/src/utils/spaRouteCss.d.ts +10 -0
- package/dist/src/utils/spaRouteManifest.d.ts +8 -0
- package/dist/src/utils/stripStringsAndComments.d.ts +18 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/src/utils/vueCompiler.d.ts +1 -0
- package/dist/src/vue/components/Image.d.ts +2 -2
- package/dist/src/vue/defineVuePage.d.ts +1 -11
- package/dist/src/vue/index.d.ts +3 -0
- package/dist/src/vue/pageHandler.d.ts +5 -0
- package/dist/src/vue/resolveGeneratedVueModulePath.d.ts +1 -0
- package/dist/src/vue/teleports.d.ts +2 -0
- package/dist/src/vue/useResource.d.ts +65 -0
- package/dist/svelte/browser.js +1 -19
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/components/Head.svelte +7 -1
- package/dist/svelte/index.js +1281 -543
- package/dist/svelte/index.js.map +27 -19
- package/dist/svelte/router/Link.svelte.d.ts +3 -3
- package/dist/svelte/router/Route.svelte.d.ts +5 -5
- package/dist/svelte/router/Router.svelte.d.ts +3 -3
- package/dist/svelte/router/hashMode.ts +6 -12
- package/dist/svelte/router/matchPath.ts +44 -61
- package/dist/svelte/router/page.d.ts +1 -10
- package/dist/svelte/router/page.js +6 -6
- package/dist/svelte/router/prefetchCache.ts +21 -23
- package/dist/svelte/router/viewTransitions.ts +22 -12
- package/dist/svelte/server.js +697 -565
- package/dist/svelte/server.js.map +14 -11
- package/dist/types/absoluteConfig.d.ts +22 -0
- package/dist/types/angular.d.ts +4 -1
- package/dist/types/authPanel.d.ts +62 -0
- package/dist/types/build.d.ts +116 -0
- package/dist/types/cli.d.ts +57 -0
- package/dist/types/config.d.ts +52 -0
- package/dist/types/eslintConfig.d.ts +68 -0
- package/dist/types/globals.d.ts +31 -10
- package/dist/types/image.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/integrationsPanel.d.ts +29 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/types/packageJson.d.ts +74 -0
- package/dist/types/packageJsonPanel.d.ts +29 -0
- package/dist/types/prettier.d.ts +26 -0
- package/dist/types/tsconfig.d.ts +31 -0
- package/dist/types/vue.d.ts +13 -15
- package/dist/vue/browser.js +14 -36
- package/dist/vue/browser.js.map +5 -5
- package/dist/vue/components/Image.js +3 -20
- package/dist/vue/components/Image.js.map +3 -3
- package/dist/vue/components/index.js +3 -20
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +1573 -620
- package/dist/vue/index.js.map +34 -22
- package/dist/vue/server.js +800 -520
- package/dist/vue/server.js.map +17 -11
- package/package.json +145 -68
- package/dist/src/react/UniversalRouter.d.ts +0 -12
package/dist/islands/index.js
CHANGED
|
@@ -3,7 +3,6 @@ var __create = Object.create;
|
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
7
|
function __accessProp(key) {
|
|
9
8
|
return this[key];
|
|
@@ -30,23 +29,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
30
29
|
cache.set(mod, to);
|
|
31
30
|
return to;
|
|
32
31
|
};
|
|
33
|
-
var __toCommonJS = (from) => {
|
|
34
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
35
|
-
if (entry)
|
|
36
|
-
return entry;
|
|
37
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
-
for (var key of __getOwnPropNames(from))
|
|
40
|
-
if (!__hasOwnProp.call(entry, key))
|
|
41
|
-
__defProp(entry, key, {
|
|
42
|
-
get: __accessProp.bind(from, key),
|
|
43
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
__moduleCache.set(from, entry);
|
|
47
|
-
return entry;
|
|
48
|
-
};
|
|
49
|
-
var __moduleCache;
|
|
50
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
51
33
|
var __returnValue = (v) => v;
|
|
52
34
|
function __exportSetter(name, newValue) {
|
|
@@ -171,7 +153,7 @@ var resolveAngularPackageDir = (specifier) => {
|
|
|
171
153
|
var init_resolveAngularPackage = () => {};
|
|
172
154
|
|
|
173
155
|
// src/utils/runtimeMode.ts
|
|
174
|
-
var ENV_VAR = "NODE_ENV",
|
|
156
|
+
var ENV_VAR = "NODE_ENV", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
|
|
175
157
|
|
|
176
158
|
// src/angular/angularPatch.ts
|
|
177
159
|
var exports_angularPatch = {};
|
|
@@ -263,7 +245,14 @@ var ensureHead = (doc) => {
|
|
|
263
245
|
}
|
|
264
246
|
try {
|
|
265
247
|
const adapter = new \u{275}DominoAdapter;
|
|
266
|
-
const
|
|
248
|
+
const resolveSeedDoc = () => {
|
|
249
|
+
if (typeof adapter.createHtmlDocument === "function")
|
|
250
|
+
return adapter.createHtmlDocument();
|
|
251
|
+
if (typeof adapter.getDefaultDocument === "function")
|
|
252
|
+
return adapter.getDefaultDocument();
|
|
253
|
+
return null;
|
|
254
|
+
};
|
|
255
|
+
const seedDoc = resolveSeedDoc();
|
|
267
256
|
if (seedDoc) {
|
|
268
257
|
patchElementLayout(seedDoc);
|
|
269
258
|
const probe = seedDoc.createElement("div");
|
|
@@ -342,9 +331,12 @@ var initDominoAdapter = (platformServer) => {
|
|
|
342
331
|
return {
|
|
343
332
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
344
333
|
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
334
|
+
Component: core.Component,
|
|
345
335
|
DomSanitizer: platformBrowser.DomSanitizer,
|
|
346
336
|
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
347
337
|
inject: core.inject,
|
|
338
|
+
InjectionToken: core.InjectionToken,
|
|
339
|
+
NgComponentOutlet: common.NgComponentOutlet,
|
|
348
340
|
provideClientHydration: platformBrowser.provideClientHydration,
|
|
349
341
|
provideServerRendering: platformServer.provideServerRendering,
|
|
350
342
|
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
@@ -546,7 +538,7 @@ __export(exports_islands, {
|
|
|
546
538
|
isAngularComponent: () => isAngularComponent,
|
|
547
539
|
getAngularIslandSelector: () => getAngularIslandSelector
|
|
548
540
|
});
|
|
549
|
-
var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) => typeof value === "function",
|
|
541
|
+
var angularIslandSelector = "abs-angular-island", getAngularIslandSelector = (_islandId) => angularIslandSelector, isAngularComponent = (value) => typeof value === "function", getSelectorFromRenderedIsland = (rootElement) => {
|
|
550
542
|
const firstChild = rootElement.firstElementChild;
|
|
551
543
|
if (!(firstChild instanceof HTMLElement)) {
|
|
552
544
|
return null;
|
|
@@ -600,9 +592,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
|
|
|
600
592
|
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
601
593
|
return `${componentName}:${JSON.stringify(props)}`;
|
|
602
594
|
}, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
603
|
-
const { Component, InjectionToken, inject } = await import("@angular/core");
|
|
604
|
-
const { NgComponentOutlet } = await import("@angular/common");
|
|
605
595
|
const deps = await getAngularDeps();
|
|
596
|
+
const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
|
|
606
597
|
const selector = getAngularIslandSelector(islandId);
|
|
607
598
|
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
608
599
|
|
|
@@ -708,7 +699,15 @@ var init_islands2 = __esm(() => {
|
|
|
708
699
|
var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
709
700
|
const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
|
|
710
701
|
return renderAngularIslandToHtml2(component, props, islandId);
|
|
711
|
-
}, renderAngularIslandToHtml2,
|
|
702
|
+
}, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
|
|
703
|
+
let result = html;
|
|
704
|
+
let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
705
|
+
while (match) {
|
|
706
|
+
result = result.slice(match[0].length);
|
|
707
|
+
match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
708
|
+
}
|
|
709
|
+
return result.trimStart();
|
|
710
|
+
}, renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToString }) => stripLeadingHoistedResources(renderToString(createElement(component, props))))), renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
|
|
712
711
|
const { body } = render(component, { props });
|
|
713
712
|
return body;
|
|
714
713
|
}), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
|
|
@@ -719,10 +718,576 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
|
719
718
|
});
|
|
720
719
|
var init_islandSsr = __esm(() => {
|
|
721
720
|
renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
|
|
721
|
+
LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// src/build/maskLiterals.ts
|
|
725
|
+
var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
|
|
726
|
+
const n = src.length;
|
|
727
|
+
const pieces = [];
|
|
728
|
+
let out = "";
|
|
729
|
+
let i = 0;
|
|
730
|
+
let prevChar = "";
|
|
731
|
+
let prevWord = "";
|
|
732
|
+
let prevWasSpace = false;
|
|
733
|
+
const mask = (text) => {
|
|
734
|
+
out += SENTINEL + pieces.length + SENTINEL;
|
|
735
|
+
pieces.push(text);
|
|
736
|
+
prevChar = ")";
|
|
737
|
+
prevWord = "";
|
|
738
|
+
prevWasSpace = false;
|
|
739
|
+
};
|
|
740
|
+
const endOfString = (start) => {
|
|
741
|
+
const q = src[start];
|
|
742
|
+
let j = start + 1;
|
|
743
|
+
while (j < n) {
|
|
744
|
+
const c = src[j];
|
|
745
|
+
if (c === "\\") {
|
|
746
|
+
j += 2;
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
if (c === q)
|
|
750
|
+
return j + 1;
|
|
751
|
+
if (c === `
|
|
752
|
+
`)
|
|
753
|
+
return j;
|
|
754
|
+
j++;
|
|
755
|
+
}
|
|
756
|
+
return j;
|
|
757
|
+
};
|
|
758
|
+
const endOfInterp = (start) => {
|
|
759
|
+
let j = start;
|
|
760
|
+
let depth = 1;
|
|
761
|
+
let ipChar = "";
|
|
762
|
+
let ipWord = "";
|
|
763
|
+
let ipSpace = false;
|
|
764
|
+
while (j < n && depth > 0) {
|
|
765
|
+
const c = src[j];
|
|
766
|
+
if (c === "\\") {
|
|
767
|
+
j += 2;
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
if (c === "`") {
|
|
771
|
+
j = endOfTemplate(j);
|
|
772
|
+
ipChar = ")";
|
|
773
|
+
ipWord = "";
|
|
774
|
+
ipSpace = false;
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
if (c === '"' || c === "'") {
|
|
778
|
+
j = endOfString(j);
|
|
779
|
+
ipChar = '"';
|
|
780
|
+
ipWord = "";
|
|
781
|
+
ipSpace = false;
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (c === "/" && src[j + 1] === "/") {
|
|
785
|
+
const nl = src.indexOf(`
|
|
786
|
+
`, j);
|
|
787
|
+
j = nl < 0 ? n : nl;
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
if (c === "/" && src[j + 1] === "*") {
|
|
791
|
+
const e = src.indexOf("*/", j + 2);
|
|
792
|
+
j = e < 0 ? n : e + 2;
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
if (c === "/" && (ipChar === "" || REGEX_OK_AFTER_CHAR.has(ipChar) || REGEX_OK_AFTER_WORD.has(ipWord))) {
|
|
796
|
+
const e = endOfRegex(j);
|
|
797
|
+
if (e > 0) {
|
|
798
|
+
j = e;
|
|
799
|
+
ipChar = ")";
|
|
800
|
+
ipWord = "";
|
|
801
|
+
ipSpace = false;
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (c === "{")
|
|
806
|
+
depth++;
|
|
807
|
+
else if (c === "}")
|
|
808
|
+
depth--;
|
|
809
|
+
j++;
|
|
810
|
+
if (c === " " || c === "\t" || c === "\r" || c === `
|
|
811
|
+
`) {
|
|
812
|
+
ipSpace = true;
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
if (isIdentChar(c)) {
|
|
816
|
+
ipWord = isIdentChar(ipChar) && !ipSpace ? ipWord + c : c;
|
|
817
|
+
} else {
|
|
818
|
+
ipWord = "";
|
|
819
|
+
}
|
|
820
|
+
ipChar = c;
|
|
821
|
+
ipSpace = false;
|
|
822
|
+
}
|
|
823
|
+
return j;
|
|
824
|
+
};
|
|
825
|
+
function endOfTemplate(start) {
|
|
826
|
+
let j = start + 1;
|
|
827
|
+
while (j < n) {
|
|
828
|
+
const c = src[j];
|
|
829
|
+
if (c === "\\") {
|
|
830
|
+
j += 2;
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (c === "`")
|
|
834
|
+
return j + 1;
|
|
835
|
+
if (c === "$" && src[j + 1] === "{") {
|
|
836
|
+
j = endOfInterp(j + 2);
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
j++;
|
|
840
|
+
}
|
|
841
|
+
return j;
|
|
842
|
+
}
|
|
843
|
+
const endOfRegex = (start) => {
|
|
844
|
+
let j = start + 1;
|
|
845
|
+
let inClass = false;
|
|
846
|
+
while (j < n) {
|
|
847
|
+
const c = src[j];
|
|
848
|
+
if (c === "\\") {
|
|
849
|
+
j += 2;
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
if (c === `
|
|
853
|
+
`)
|
|
854
|
+
return -1;
|
|
855
|
+
if (c === "[")
|
|
856
|
+
inClass = true;
|
|
857
|
+
else if (c === "]")
|
|
858
|
+
inClass = false;
|
|
859
|
+
else if (c === "/" && !inClass) {
|
|
860
|
+
j++;
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
j++;
|
|
864
|
+
}
|
|
865
|
+
while (j < n && /[a-z]/i.test(src[j] ?? ""))
|
|
866
|
+
j++;
|
|
867
|
+
return j;
|
|
868
|
+
};
|
|
869
|
+
while (i < n) {
|
|
870
|
+
const c = src[i];
|
|
871
|
+
const c2 = src[i + 1];
|
|
872
|
+
if (c === "/" && c2 === "/") {
|
|
873
|
+
out += "//";
|
|
874
|
+
i += 2;
|
|
875
|
+
const s = i;
|
|
876
|
+
while (i < n && src[i] !== `
|
|
877
|
+
`)
|
|
878
|
+
i++;
|
|
879
|
+
mask(src.slice(s, i));
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
if (c === "/" && c2 === "*") {
|
|
883
|
+
out += "/*";
|
|
884
|
+
i += 2;
|
|
885
|
+
const e = src.indexOf("*/", i);
|
|
886
|
+
const end = e < 0 ? n : e;
|
|
887
|
+
mask(src.slice(i, end));
|
|
888
|
+
i = end < n ? end + 2 : n;
|
|
889
|
+
if (end < n)
|
|
890
|
+
out += "*/";
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
if (c === "`") {
|
|
894
|
+
const end = endOfTemplate(i);
|
|
895
|
+
mask(src.slice(i, end));
|
|
896
|
+
i = end;
|
|
897
|
+
continue;
|
|
898
|
+
}
|
|
899
|
+
if (c === '"' || c === "'") {
|
|
900
|
+
const end = endOfString(i);
|
|
901
|
+
const text = src.slice(i, end);
|
|
902
|
+
if (RISKY_STRING_CONTENT.test(text)) {
|
|
903
|
+
mask(text);
|
|
904
|
+
} else {
|
|
905
|
+
out += text;
|
|
906
|
+
prevChar = '"';
|
|
907
|
+
prevWord = "";
|
|
908
|
+
prevWasSpace = false;
|
|
909
|
+
}
|
|
910
|
+
i = end;
|
|
911
|
+
continue;
|
|
912
|
+
}
|
|
913
|
+
if (c === "/" && (prevChar === "" || REGEX_OK_AFTER_CHAR.has(prevChar) || REGEX_OK_AFTER_WORD.has(prevWord))) {
|
|
914
|
+
const end = endOfRegex(i);
|
|
915
|
+
if (end > 0) {
|
|
916
|
+
out += src.slice(i, end);
|
|
917
|
+
i = end;
|
|
918
|
+
prevChar = ")";
|
|
919
|
+
prevWord = "";
|
|
920
|
+
prevWasSpace = false;
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
out += c;
|
|
925
|
+
i++;
|
|
926
|
+
if (c === " " || c === "\t" || c === "\r" || c === `
|
|
927
|
+
`) {
|
|
928
|
+
prevWasSpace = true;
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
if (isIdentChar(c)) {
|
|
932
|
+
const contiguous = isIdentChar(prevChar) && !prevWasSpace;
|
|
933
|
+
prevWord = contiguous ? prevWord + c : c;
|
|
934
|
+
} else {
|
|
935
|
+
prevWord = "";
|
|
936
|
+
}
|
|
937
|
+
prevChar = c;
|
|
938
|
+
prevWasSpace = false;
|
|
939
|
+
}
|
|
940
|
+
const restoreRegex = new RegExp(`${SENTINEL}(\\d+)${SENTINEL}`, "g");
|
|
941
|
+
const restore = (rewritten) => rewritten.replace(restoreRegex, (_m, d) => pieces[Number(d)] ?? "");
|
|
942
|
+
return { masked: out, restore };
|
|
943
|
+
};
|
|
944
|
+
var init_maskLiterals = __esm(() => {
|
|
945
|
+
SENTINEL = String.fromCharCode(57344);
|
|
946
|
+
RISKY_STRING_CONTENT = /\b(?:from|import|require)\s*\(?\s*["'`]/;
|
|
947
|
+
REGEX_OK_AFTER_CHAR = new Set([
|
|
948
|
+
"(",
|
|
949
|
+
",",
|
|
950
|
+
"=",
|
|
951
|
+
":",
|
|
952
|
+
"[",
|
|
953
|
+
"!",
|
|
954
|
+
"&",
|
|
955
|
+
"|",
|
|
956
|
+
"?",
|
|
957
|
+
"{",
|
|
958
|
+
"}",
|
|
959
|
+
";",
|
|
960
|
+
"+",
|
|
961
|
+
"-",
|
|
962
|
+
"*",
|
|
963
|
+
"/",
|
|
964
|
+
"%",
|
|
965
|
+
"^",
|
|
966
|
+
"~",
|
|
967
|
+
"<",
|
|
968
|
+
">"
|
|
969
|
+
]);
|
|
970
|
+
REGEX_OK_AFTER_WORD = new Set([
|
|
971
|
+
"return",
|
|
972
|
+
"typeof",
|
|
973
|
+
"instanceof",
|
|
974
|
+
"in",
|
|
975
|
+
"of",
|
|
976
|
+
"new",
|
|
977
|
+
"delete",
|
|
978
|
+
"void",
|
|
979
|
+
"do",
|
|
980
|
+
"else",
|
|
981
|
+
"yield",
|
|
982
|
+
"await",
|
|
983
|
+
"case"
|
|
984
|
+
]);
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
// src/build/nativeRewrite.ts
|
|
988
|
+
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
989
|
+
import { platform, arch } from "os";
|
|
990
|
+
import { resolve as resolve2 } from "path";
|
|
991
|
+
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
992
|
+
if (nativeLib !== null)
|
|
993
|
+
return nativeLib;
|
|
994
|
+
const osPlatform = platform();
|
|
995
|
+
const cpu = arch();
|
|
996
|
+
const platformMap = {
|
|
997
|
+
"darwin-arm64": "darwin-arm64/fast_ops.dylib",
|
|
998
|
+
"darwin-x64": "darwin-x64/fast_ops.dylib",
|
|
999
|
+
"linux-arm64": "linux-arm64/fast_ops.so",
|
|
1000
|
+
"linux-x64": "linux-x64/fast_ops.so",
|
|
1001
|
+
"win32-arm64": "windows-arm64/fast_ops.dll",
|
|
1002
|
+
"win32-x64": "windows-x64/fast_ops.dll"
|
|
1003
|
+
};
|
|
1004
|
+
const libPath = platformMap[`${osPlatform}-${cpu}`];
|
|
1005
|
+
if (!libPath)
|
|
1006
|
+
return null;
|
|
1007
|
+
try {
|
|
1008
|
+
const fullPath = resolve2(import.meta.dir, "../../native/packages", libPath);
|
|
1009
|
+
const lib = dlopen(fullPath, ffiDefinition);
|
|
1010
|
+
nativeLib = lib.symbols;
|
|
1011
|
+
return nativeLib;
|
|
1012
|
+
} catch {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
}, nativeRewriteImports = (content, replacements) => {
|
|
1016
|
+
const lib = loadNative();
|
|
1017
|
+
if (!lib)
|
|
1018
|
+
return null;
|
|
1019
|
+
const jsonStr = JSON.stringify(replacements);
|
|
1020
|
+
const contentBuf = Buffer.from(content);
|
|
1021
|
+
const jsonBuf = Buffer.from(jsonStr);
|
|
1022
|
+
const outBuf = Buffer.alloc(content.length * 2);
|
|
1023
|
+
const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
|
|
1024
|
+
const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
|
|
1025
|
+
if (result < 0)
|
|
1026
|
+
return null;
|
|
1027
|
+
if (result === 0)
|
|
1028
|
+
return content;
|
|
1029
|
+
const outLen = Number(outLenBuf[0]);
|
|
1030
|
+
return outBuf.subarray(0, outLen).toString("utf-8");
|
|
1031
|
+
};
|
|
1032
|
+
var init_nativeRewrite = __esm(() => {
|
|
1033
|
+
ffiDefinition = {
|
|
1034
|
+
rewrite_imports: {
|
|
1035
|
+
args: [
|
|
1036
|
+
FFIType.ptr,
|
|
1037
|
+
FFIType.u64,
|
|
1038
|
+
FFIType.ptr,
|
|
1039
|
+
FFIType.u64,
|
|
1040
|
+
FFIType.ptr,
|
|
1041
|
+
FFIType.ptr
|
|
1042
|
+
],
|
|
1043
|
+
returns: FFIType.i32
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
// src/build/rewriteImportsPlugin.ts
|
|
1049
|
+
var exports_rewriteImportsPlugin = {};
|
|
1050
|
+
__export(exports_rewriteImportsPlugin, {
|
|
1051
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
1052
|
+
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
1053
|
+
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
1054
|
+
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
1055
|
+
jsRewriteImports: () => jsRewriteImports,
|
|
1056
|
+
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
1057
|
+
buildWithImportRewrite: () => buildWithImportRewrite
|
|
1058
|
+
});
|
|
1059
|
+
import { readdir } from "fs/promises";
|
|
1060
|
+
import { join as join2 } from "path";
|
|
1061
|
+
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
1062
|
+
let result = content;
|
|
1063
|
+
for (const [specifier, webPath] of replacements) {
|
|
1064
|
+
const escaped = escapeRegex(specifier);
|
|
1065
|
+
const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
1066
|
+
const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
|
|
1067
|
+
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
|
|
1068
|
+
result = result.replace(fromRegex, `$1${webPath}$2`);
|
|
1069
|
+
result = result.replace(sideEffectRegex, `$1${webPath}$2`);
|
|
1070
|
+
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
1074
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
1075
|
+
return content;
|
|
1076
|
+
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
1077
|
+
const { masked, restore } = maskLiterals(content);
|
|
1078
|
+
const native = nativeRewriteImports(masked, replacements);
|
|
1079
|
+
return restore(native ?? jsRewriteImports(masked, replacements));
|
|
1080
|
+
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
1081
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
1082
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
1083
|
+
const missing = [];
|
|
1084
|
+
let match;
|
|
1085
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
1086
|
+
const ident = match[1];
|
|
1087
|
+
if (!ident)
|
|
1088
|
+
continue;
|
|
1089
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
1090
|
+
if (nsImportRe.test(content))
|
|
1091
|
+
continue;
|
|
1092
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
1093
|
+
if (declRe.test(content))
|
|
1094
|
+
continue;
|
|
1095
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
1096
|
+
if (namedImportRe.test(content))
|
|
1097
|
+
continue;
|
|
1098
|
+
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
1099
|
+
let pathMatch;
|
|
1100
|
+
let sourcePath;
|
|
1101
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
1102
|
+
const p = pathMatch[1];
|
|
1103
|
+
if (!p)
|
|
1104
|
+
continue;
|
|
1105
|
+
const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
1106
|
+
if (!base)
|
|
1107
|
+
continue;
|
|
1108
|
+
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
1109
|
+
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
1110
|
+
sourcePath = p;
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
if (sourcePath)
|
|
1115
|
+
missing.push({ ident, path: sourcePath });
|
|
1116
|
+
}
|
|
1117
|
+
if (missing.length === 0)
|
|
1118
|
+
return content;
|
|
1119
|
+
const seen = new Set;
|
|
1120
|
+
const unique = missing.filter((entry) => {
|
|
1121
|
+
if (seen.has(entry.ident))
|
|
1122
|
+
return false;
|
|
1123
|
+
seen.add(entry.ident);
|
|
1124
|
+
return true;
|
|
1125
|
+
});
|
|
1126
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
1127
|
+
`);
|
|
1128
|
+
return `${inserts}
|
|
1129
|
+
${content}`;
|
|
1130
|
+
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
1131
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
1132
|
+
return;
|
|
1133
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
1134
|
+
let original;
|
|
1135
|
+
try {
|
|
1136
|
+
original = await artifact.text();
|
|
1137
|
+
} catch (err) {
|
|
1138
|
+
const code = err.code;
|
|
1139
|
+
if (code === "ENOENT")
|
|
1140
|
+
return;
|
|
1141
|
+
throw err;
|
|
1142
|
+
}
|
|
1143
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
1144
|
+
if (rewritten === original)
|
|
1145
|
+
return;
|
|
1146
|
+
try {
|
|
1147
|
+
await Bun.write(artifact.path, rewritten);
|
|
1148
|
+
} catch (err) {
|
|
1149
|
+
const code = err.code;
|
|
1150
|
+
if (code === "ENOENT")
|
|
1151
|
+
return;
|
|
1152
|
+
throw err;
|
|
1153
|
+
}
|
|
1154
|
+
}));
|
|
1155
|
+
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
1156
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
1157
|
+
const vendorPaths = resolveVendorPaths(artifact);
|
|
1158
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
1159
|
+
return;
|
|
1160
|
+
let original;
|
|
1161
|
+
try {
|
|
1162
|
+
original = await artifact.text();
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
const code = err.code;
|
|
1165
|
+
if (code === "ENOENT")
|
|
1166
|
+
return;
|
|
1167
|
+
throw err;
|
|
1168
|
+
}
|
|
1169
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
1170
|
+
if (rewritten === original)
|
|
1171
|
+
return;
|
|
1172
|
+
try {
|
|
1173
|
+
await Bun.write(artifact.path, rewritten);
|
|
1174
|
+
} catch (err) {
|
|
1175
|
+
const code = err.code;
|
|
1176
|
+
if (code === "ENOENT")
|
|
1177
|
+
return;
|
|
1178
|
+
throw err;
|
|
1179
|
+
}
|
|
1180
|
+
}));
|
|
1181
|
+
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
1182
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
1183
|
+
return;
|
|
1184
|
+
const allFiles = [];
|
|
1185
|
+
for (const dir of vendorDirs) {
|
|
1186
|
+
try {
|
|
1187
|
+
const entries = await readdir(dir);
|
|
1188
|
+
for (const entry of entries) {
|
|
1189
|
+
if (entry.endsWith(".js"))
|
|
1190
|
+
allFiles.push(join2(dir, entry));
|
|
1191
|
+
}
|
|
1192
|
+
} catch {}
|
|
1193
|
+
}
|
|
1194
|
+
await Promise.all(allFiles.map(async (filePath) => {
|
|
1195
|
+
let original;
|
|
1196
|
+
try {
|
|
1197
|
+
original = await Bun.file(filePath).text();
|
|
1198
|
+
} catch (err) {
|
|
1199
|
+
const code = err.code;
|
|
1200
|
+
if (code === "ENOENT")
|
|
1201
|
+
return;
|
|
1202
|
+
throw err;
|
|
1203
|
+
}
|
|
1204
|
+
let next = rewriteImportsInContent(original, vendorPaths);
|
|
1205
|
+
next = fixMissingReExportNamespacesInContent(next);
|
|
1206
|
+
if (next === original)
|
|
1207
|
+
return;
|
|
1208
|
+
try {
|
|
1209
|
+
await Bun.write(filePath, next);
|
|
1210
|
+
} catch (err) {
|
|
1211
|
+
const code = err.code;
|
|
1212
|
+
if (code === "ENOENT")
|
|
1213
|
+
return;
|
|
1214
|
+
throw err;
|
|
1215
|
+
}
|
|
1216
|
+
}));
|
|
1217
|
+
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
1218
|
+
const result = await pendingBuild;
|
|
1219
|
+
if (result.outputs.length > 0) {
|
|
1220
|
+
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
1221
|
+
}
|
|
1222
|
+
return result;
|
|
1223
|
+
};
|
|
1224
|
+
var init_rewriteImportsPlugin = __esm(() => {
|
|
1225
|
+
init_maskLiterals();
|
|
1226
|
+
init_nativeRewrite();
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1229
|
+
// src/core/angularServerModule.ts
|
|
1230
|
+
import { mkdir } from "fs/promises";
|
|
1231
|
+
import { dirname, join as join3, relative } from "path";
|
|
1232
|
+
var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
|
|
1233
|
+
const relativeSourcePath = relative(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1234
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1235
|
+
return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
1236
|
+
}, collectVendorPaths = (code) => {
|
|
1237
|
+
const vendorPaths = {};
|
|
1238
|
+
if (!isProductionRuntime()) {
|
|
1239
|
+
return vendorPaths;
|
|
1240
|
+
}
|
|
1241
|
+
const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
|
|
1242
|
+
specifiers.forEach((specifier) => {
|
|
1243
|
+
if (!specifier)
|
|
1244
|
+
return;
|
|
1245
|
+
const resolved = resolveAngularRuntimePath(specifier);
|
|
1246
|
+
if (resolved === specifier)
|
|
1247
|
+
return;
|
|
1248
|
+
vendorPaths[specifier] = resolved;
|
|
1249
|
+
});
|
|
1250
|
+
return vendorPaths;
|
|
1251
|
+
}, buildAngularServerModule = async (sourcePath) => {
|
|
1252
|
+
const result = await Bun.build({
|
|
1253
|
+
entrypoints: [sourcePath],
|
|
1254
|
+
format: "esm",
|
|
1255
|
+
packages: "external",
|
|
1256
|
+
target: "bun",
|
|
1257
|
+
throw: false
|
|
1258
|
+
});
|
|
1259
|
+
const entry = result.outputs.find((output) => output.kind === "entry-point");
|
|
1260
|
+
if (!result.success || !entry) {
|
|
1261
|
+
const message = result.logs.map((log) => String(log)).join(`
|
|
1262
|
+
`);
|
|
1263
|
+
throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
|
|
1264
|
+
${message}`);
|
|
1265
|
+
}
|
|
1266
|
+
const code = await entry.text();
|
|
1267
|
+
const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
|
|
1268
|
+
const modulePath = getCachedModulePath(sourcePath);
|
|
1269
|
+
await mkdir(dirname(modulePath), { recursive: true });
|
|
1270
|
+
await Bun.write(modulePath, rewritten);
|
|
1271
|
+
return modulePath;
|
|
1272
|
+
}, compileAngularServerModule = (sourcePath) => {
|
|
1273
|
+
const cached = compiledModuleCache.get(sourcePath);
|
|
1274
|
+
if (cached) {
|
|
1275
|
+
return cached;
|
|
1276
|
+
}
|
|
1277
|
+
const compiledModulePromise = buildAngularServerModule(sourcePath);
|
|
1278
|
+
compiledModuleCache.set(sourcePath, compiledModulePromise);
|
|
1279
|
+
return compiledModulePromise;
|
|
1280
|
+
};
|
|
1281
|
+
var init_angularServerModule = __esm(() => {
|
|
1282
|
+
init_resolveAngularPackage();
|
|
1283
|
+
init_rewriteImportsPlugin();
|
|
1284
|
+
serverCacheRoot = join3(process.cwd(), ".absolutejs", "islands", "angular");
|
|
1285
|
+
compiledModuleCache = new Map;
|
|
1286
|
+
ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
|
|
722
1287
|
});
|
|
723
1288
|
|
|
724
1289
|
// src/build/resolvePackageImport.ts
|
|
725
|
-
import { resolve as
|
|
1290
|
+
import { resolve as resolve3, join as join4 } from "path";
|
|
726
1291
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
727
1292
|
var resolveExportPath = (entry, conditions) => {
|
|
728
1293
|
if (typeof entry === "string")
|
|
@@ -744,11 +1309,11 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
744
1309
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
745
1310
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
746
1311
|
const exportKey = subpath ? `./${subpath}` : ".";
|
|
747
|
-
const currentPackageJsonPath =
|
|
1312
|
+
const currentPackageJsonPath = resolve3(process.cwd(), "package.json");
|
|
748
1313
|
const currentPackageJson = existsSync2(currentPackageJsonPath) ? JSON.parse(readFileSync2(currentPackageJsonPath, "utf-8")) : null;
|
|
749
1314
|
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
750
|
-
const packageDir = currentPackageDir ??
|
|
751
|
-
const packageJsonPath =
|
|
1315
|
+
const packageDir = currentPackageDir ?? resolve3(process.cwd(), "node_modules", packageName ?? "");
|
|
1316
|
+
const packageJsonPath = join4(packageDir, "package.json");
|
|
752
1317
|
if (!existsSync2(packageJsonPath))
|
|
753
1318
|
return null;
|
|
754
1319
|
try {
|
|
@@ -763,12 +1328,12 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
763
1328
|
if (!importPath)
|
|
764
1329
|
return null;
|
|
765
1330
|
if (currentPackageDir && importPath.startsWith("./dist/")) {
|
|
766
|
-
const sourceCandidate =
|
|
1331
|
+
const sourceCandidate = resolve3(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
|
|
767
1332
|
if (existsSync2(sourceCandidate)) {
|
|
768
1333
|
return sourceCandidate;
|
|
769
1334
|
}
|
|
770
1335
|
}
|
|
771
|
-
const resolved =
|
|
1336
|
+
const resolved = resolve3(packageDir, importPath);
|
|
772
1337
|
return existsSync2(resolved) ? resolved : null;
|
|
773
1338
|
} catch {
|
|
774
1339
|
return null;
|
|
@@ -777,8 +1342,9 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
777
1342
|
var init_resolvePackageImport = () => {};
|
|
778
1343
|
|
|
779
1344
|
// src/constants.ts
|
|
780
|
-
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
1345
|
+
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", TAILWIND_BUN_CSS_WARNING_PATTERN, BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, DEFAULT_WEBSOCKET_IDLE_TIMEOUT_SECONDS = 240, DEFAULT_HTTP_IDLE_TIMEOUT_SECONDS = 240, MAX_HTTP_IDLE_TIMEOUT_SECONDS = 255, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
781
1346
|
var init_constants = __esm(() => {
|
|
1347
|
+
TAILWIND_BUN_CSS_WARNING_PATTERN = /invalid @ rule encountered: '@(theme|tailwind|source|utility|variant|custom-variant|apply|reference|plugin|config)'/;
|
|
782
1348
|
IMAGE_DEFAULT_DEVICE_SIZES = [
|
|
783
1349
|
640,
|
|
784
1350
|
750,
|
|
@@ -944,12 +1510,12 @@ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
|
944
1510
|
import { readFile } from "fs/promises";
|
|
945
1511
|
import { createRequire } from "module";
|
|
946
1512
|
import {
|
|
947
|
-
dirname,
|
|
1513
|
+
dirname as dirname2,
|
|
948
1514
|
extname,
|
|
949
1515
|
isAbsolute,
|
|
950
|
-
join as
|
|
951
|
-
relative,
|
|
952
|
-
resolve as
|
|
1516
|
+
join as join5,
|
|
1517
|
+
relative as relative2,
|
|
1518
|
+
resolve as resolve4
|
|
953
1519
|
} from "path";
|
|
954
1520
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
955
1521
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
@@ -985,9 +1551,9 @@ ${message}`);
|
|
|
985
1551
|
return requireOptionalPeer(specifier);
|
|
986
1552
|
}
|
|
987
1553
|
}, normalizeLoadPaths = (filePath, paths = []) => [
|
|
988
|
-
|
|
1554
|
+
dirname2(filePath),
|
|
989
1555
|
process.cwd(),
|
|
990
|
-
...paths.map((path) =>
|
|
1556
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
991
1557
|
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
992
1558
|
pattern,
|
|
993
1559
|
replacements: Array.isArray(value) ? value : [value]
|
|
@@ -995,7 +1561,7 @@ ${message}`);
|
|
|
995
1561
|
const cwd = process.cwd();
|
|
996
1562
|
if (tsconfigAliasCache?.cwd === cwd)
|
|
997
1563
|
return tsconfigAliasCache;
|
|
998
|
-
const tsconfigPath =
|
|
1564
|
+
const tsconfigPath = resolve4(cwd, "tsconfig.json");
|
|
999
1565
|
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
1000
1566
|
if (!existsSync3(tsconfigPath)) {
|
|
1001
1567
|
tsconfigAliasCache = empty;
|
|
@@ -1004,7 +1570,7 @@ ${message}`);
|
|
|
1004
1570
|
try {
|
|
1005
1571
|
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
1006
1572
|
const compilerOptions = parsed.compilerOptions ?? {};
|
|
1007
|
-
const baseUrl =
|
|
1573
|
+
const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
|
|
1008
1574
|
tsconfigAliasCache = {
|
|
1009
1575
|
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
1010
1576
|
baseUrl,
|
|
@@ -1032,7 +1598,7 @@ ${message}`);
|
|
|
1032
1598
|
continue;
|
|
1033
1599
|
const wildcard = match[1] ?? "";
|
|
1034
1600
|
for (const replacement of alias.replacements) {
|
|
1035
|
-
targets.push(
|
|
1601
|
+
targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
|
|
1036
1602
|
}
|
|
1037
1603
|
}
|
|
1038
1604
|
return targets;
|
|
@@ -1046,21 +1612,21 @@ ${message}`);
|
|
|
1046
1612
|
const ext = extname(basePath);
|
|
1047
1613
|
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
1048
1614
|
`${basePath}${extension}`,
|
|
1049
|
-
|
|
1615
|
+
join5(basePath, `index${extension}`)
|
|
1050
1616
|
]);
|
|
1051
1617
|
if (language === "scss" || language === "sass") {
|
|
1052
1618
|
return paths.flatMap((path) => {
|
|
1053
|
-
const dir =
|
|
1619
|
+
const dir = dirname2(path);
|
|
1054
1620
|
const base = path.slice(dir.length + 1);
|
|
1055
|
-
return [path,
|
|
1621
|
+
return [path, join5(dir, `_${base}`)];
|
|
1056
1622
|
});
|
|
1057
1623
|
}
|
|
1058
1624
|
return paths;
|
|
1059
1625
|
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
1060
1626
|
const rawCandidates = [
|
|
1061
1627
|
...resolveAliasTargets(specifier, config),
|
|
1062
|
-
isAbsolute(specifier) ? specifier :
|
|
1063
|
-
...loadPaths.map((path) =>
|
|
1628
|
+
isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
|
|
1629
|
+
...loadPaths.map((path) => resolve4(path, specifier))
|
|
1064
1630
|
];
|
|
1065
1631
|
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
1066
1632
|
if (existsSync3(candidate))
|
|
@@ -1076,8 +1642,8 @@ ${message}`);
|
|
|
1076
1642
|
path: url.slice(0, markerIndex)
|
|
1077
1643
|
};
|
|
1078
1644
|
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
1079
|
-
const sourceDir =
|
|
1080
|
-
const entryDir =
|
|
1645
|
+
const sourceDir = dirname2(sourceFile);
|
|
1646
|
+
const entryDir = dirname2(entryFile);
|
|
1081
1647
|
if (sourceDir === entryDir)
|
|
1082
1648
|
return contents;
|
|
1083
1649
|
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
@@ -1085,7 +1651,7 @@ ${message}`);
|
|
|
1085
1651
|
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
1086
1652
|
return match;
|
|
1087
1653
|
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
1088
|
-
const rebased =
|
|
1654
|
+
const rebased = relative2(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
|
|
1089
1655
|
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
1090
1656
|
const nextQuote = quote || '"';
|
|
1091
1657
|
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
@@ -1093,7 +1659,7 @@ ${message}`);
|
|
|
1093
1659
|
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
1094
1660
|
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
1095
1661
|
return match;
|
|
1096
|
-
const resolved = resolveImportPath(specifier,
|
|
1662
|
+
const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
|
|
1097
1663
|
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
1098
1664
|
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
1099
1665
|
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
@@ -1123,7 +1689,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1123
1689
|
}
|
|
1124
1690
|
return mod;
|
|
1125
1691
|
}, loadPostcssConfigFile = async (configPath) => {
|
|
1126
|
-
const resolved =
|
|
1692
|
+
const resolved = resolve4(process.cwd(), configPath);
|
|
1127
1693
|
const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
|
|
1128
1694
|
const config = normalizePostcssModule(loaded);
|
|
1129
1695
|
const value = typeof config === "function" ? await config({
|
|
@@ -1183,9 +1749,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1183
1749
|
return result.css;
|
|
1184
1750
|
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
1185
1751
|
canonicalize(specifier, options) {
|
|
1186
|
-
const fromDirectory = options.containingUrl ?
|
|
1752
|
+
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
1187
1753
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
1188
|
-
return resolved ? new URL(pathToFileURL(
|
|
1754
|
+
return resolved ? new URL(pathToFileURL(resolve4(resolved)).href) : null;
|
|
1189
1755
|
},
|
|
1190
1756
|
load(canonicalUrl) {
|
|
1191
1757
|
const filePath = fileURLToPath(canonicalUrl);
|
|
@@ -1202,9 +1768,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1202
1768
|
install(less, pluginManager) {
|
|
1203
1769
|
const baseManager = new less.FileManager;
|
|
1204
1770
|
const manager = Object.create(baseManager);
|
|
1205
|
-
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename,
|
|
1771
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
|
|
1206
1772
|
manager.loadFile = async (filename, currentDirectory) => {
|
|
1207
|
-
const resolved = resolveImportPath(filename,
|
|
1773
|
+
const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
|
|
1208
1774
|
if (!resolved) {
|
|
1209
1775
|
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
1210
1776
|
}
|
|
@@ -1241,29 +1807,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1241
1807
|
const stylusDeps = renderer.deps?.();
|
|
1242
1808
|
if (Array.isArray(stylusDeps)) {
|
|
1243
1809
|
for (const dep of stylusDeps)
|
|
1244
|
-
deps.add(
|
|
1810
|
+
deps.add(resolve4(dep));
|
|
1245
1811
|
}
|
|
1246
1812
|
}
|
|
1247
1813
|
resolveCss(css ?? "");
|
|
1248
1814
|
});
|
|
1249
1815
|
});
|
|
1250
1816
|
}, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
|
|
1251
|
-
const key =
|
|
1817
|
+
const key = resolve4(entry);
|
|
1252
1818
|
const stripped = new Set;
|
|
1253
1819
|
for (const dep of deps) {
|
|
1254
|
-
const resolved =
|
|
1820
|
+
const resolved = resolve4(dep);
|
|
1255
1821
|
if (resolved !== key)
|
|
1256
1822
|
stripped.add(resolved);
|
|
1257
1823
|
}
|
|
1258
1824
|
styleDependencyGraph.set(key, stripped);
|
|
1259
1825
|
}, addStyleImporter = (importerPath, stylePath) => {
|
|
1260
|
-
const key =
|
|
1261
|
-
const target =
|
|
1826
|
+
const key = resolve4(importerPath);
|
|
1827
|
+
const target = resolve4(stylePath);
|
|
1262
1828
|
const deps = styleDependencyGraph.get(key) ?? new Set;
|
|
1263
1829
|
deps.add(target);
|
|
1264
1830
|
styleDependencyGraph.set(key, deps);
|
|
1265
1831
|
}, findStyleEntriesImporting = (changedPath) => {
|
|
1266
|
-
const target =
|
|
1832
|
+
const target = resolve4(changedPath);
|
|
1267
1833
|
const importers = [];
|
|
1268
1834
|
for (const [entry, deps] of styleDependencyGraph) {
|
|
1269
1835
|
if (deps.has(target))
|
|
@@ -1271,13 +1837,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1271
1837
|
}
|
|
1272
1838
|
return importers;
|
|
1273
1839
|
}, recordStyleOutput = (entry, css) => {
|
|
1274
|
-
const key =
|
|
1840
|
+
const key = resolve4(entry);
|
|
1275
1841
|
const hash = createHash("sha1").update(css).digest("hex");
|
|
1276
1842
|
const previous = styleOutputHashes.get(key);
|
|
1277
1843
|
styleOutputHashes.set(key, hash);
|
|
1278
1844
|
return previous !== hash;
|
|
1279
1845
|
}, forgetStyleEntry = (entry) => {
|
|
1280
|
-
const key =
|
|
1846
|
+
const key = resolve4(entry);
|
|
1281
1847
|
styleDependencyGraph.delete(key);
|
|
1282
1848
|
styleOutputHashes.delete(key);
|
|
1283
1849
|
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
@@ -1303,7 +1869,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1303
1869
|
loadPaths,
|
|
1304
1870
|
style: "expanded",
|
|
1305
1871
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1306
|
-
url: new URL(pathToFileURL(
|
|
1872
|
+
url: new URL(pathToFileURL(resolve4(filePath)).href)
|
|
1307
1873
|
});
|
|
1308
1874
|
const css = await runPostcss(result.css, filePath, config);
|
|
1309
1875
|
const loadedUrls = result.loadedUrls ?? [];
|
|
@@ -1311,7 +1877,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1311
1877
|
if (url.protocol !== "file:")
|
|
1312
1878
|
continue;
|
|
1313
1879
|
const dep = fileURLToPath(url);
|
|
1314
|
-
if (
|
|
1880
|
+
if (resolve4(dep) === resolve4(filePath))
|
|
1315
1881
|
continue;
|
|
1316
1882
|
deps.add(dep);
|
|
1317
1883
|
}
|
|
@@ -1432,7 +1998,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1432
1998
|
const start = match.index ?? 0;
|
|
1433
1999
|
const end = start + match[0].length;
|
|
1434
2000
|
parts.push(content.slice(cursor, start));
|
|
1435
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
2001
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
|
|
1436
2002
|
if (visited.has(fullPath) || !existsSync3(fullPath)) {
|
|
1437
2003
|
parts.push(visited.has(fullPath) ? "" : match[0]);
|
|
1438
2004
|
cursor = end;
|
|
@@ -1441,7 +2007,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1441
2007
|
const nextVisited = new Set(visited);
|
|
1442
2008
|
nextVisited.add(fullPath);
|
|
1443
2009
|
const imported = await readFile(fullPath, "utf-8");
|
|
1444
|
-
parts.push(await resolveCssImportsAsync(imported,
|
|
2010
|
+
parts.push(await resolveCssImportsAsync(imported, dirname2(fullPath), nextVisited));
|
|
1445
2011
|
cursor = end;
|
|
1446
2012
|
}
|
|
1447
2013
|
parts.push(content.slice(cursor));
|
|
@@ -1450,13 +2016,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1450
2016
|
if (!isPreprocessableStylePath(filePath)) {
|
|
1451
2017
|
const raw = await readFile(filePath, "utf-8");
|
|
1452
2018
|
const processed = await runPostcss(raw, filePath, config);
|
|
1453
|
-
return resolveCssImportsAsync(processed,
|
|
2019
|
+
return resolveCssImportsAsync(processed, dirname2(filePath), new Set([filePath]));
|
|
1454
2020
|
}
|
|
1455
2021
|
const compiled = await compileStyleSource(filePath, undefined, undefined, config);
|
|
1456
|
-
return resolveCssImportsAsync(compiled,
|
|
2022
|
+
return resolveCssImportsAsync(compiled, dirname2(filePath), new Set([filePath]));
|
|
1457
2023
|
}, resolveCssImportsSync = (content, baseDir, visited) => {
|
|
1458
2024
|
return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
|
|
1459
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
2025
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve4(baseDir, importPath);
|
|
1460
2026
|
if (visited.has(fullPath))
|
|
1461
2027
|
return "";
|
|
1462
2028
|
if (!existsSync3(fullPath))
|
|
@@ -1464,7 +2030,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1464
2030
|
const nextVisited = new Set(visited);
|
|
1465
2031
|
nextVisited.add(fullPath);
|
|
1466
2032
|
const imported = readFileSync3(fullPath, "utf-8");
|
|
1467
|
-
return resolveCssImportsSync(imported,
|
|
2033
|
+
return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
|
|
1468
2034
|
});
|
|
1469
2035
|
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
1470
2036
|
const rawContents = readFileSync3(filePath, "utf-8");
|
|
@@ -1490,18 +2056,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1490
2056
|
loadPaths,
|
|
1491
2057
|
style: "expanded",
|
|
1492
2058
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1493
|
-
url: new URL(pathToFileURL(
|
|
2059
|
+
url: new URL(pathToFileURL(resolve4(filePath)).href)
|
|
1494
2060
|
});
|
|
1495
2061
|
const loadedUrls = result.loadedUrls ?? [];
|
|
1496
2062
|
for (const url of loadedUrls) {
|
|
1497
2063
|
if (url.protocol !== "file:")
|
|
1498
2064
|
continue;
|
|
1499
2065
|
const dep = fileURLToPath(url);
|
|
1500
|
-
if (
|
|
2066
|
+
if (resolve4(dep) === resolve4(filePath))
|
|
1501
2067
|
continue;
|
|
1502
2068
|
addStyleImporter(filePath, dep);
|
|
1503
2069
|
}
|
|
1504
|
-
return resolveCssImportsSync(result.css,
|
|
2070
|
+
return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
|
|
1505
2071
|
}
|
|
1506
2072
|
if (language === "less") {
|
|
1507
2073
|
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
@@ -1509,7 +2075,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
1509
2075
|
if (language === "stylus") {
|
|
1510
2076
|
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
1511
2077
|
}
|
|
1512
|
-
return resolveCssImportsSync(rawContents,
|
|
2078
|
+
return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
|
|
1513
2079
|
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
|
|
1514
2080
|
var init_stylePreprocessor = __esm(() => {
|
|
1515
2081
|
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
@@ -1518,7 +2084,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1518
2084
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
1519
2085
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
1520
2086
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
1521
|
-
requireFromCwd = createRequire(
|
|
2087
|
+
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
1522
2088
|
styleDependencyGraph = new Map;
|
|
1523
2089
|
styleOutputHashes = new Map;
|
|
1524
2090
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
@@ -1526,14 +2092,14 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1526
2092
|
});
|
|
1527
2093
|
|
|
1528
2094
|
// src/core/svelteServerModule.ts
|
|
1529
|
-
import { mkdir, readdir } from "fs/promises";
|
|
1530
|
-
import { basename, dirname as
|
|
1531
|
-
var
|
|
1532
|
-
const importPath =
|
|
2095
|
+
import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
|
|
2096
|
+
import { basename, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve5 } from "path";
|
|
2097
|
+
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2098
|
+
const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
|
|
1533
2099
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1534
2100
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
1535
2101
|
for (const entry of entries) {
|
|
1536
|
-
const entryPath =
|
|
2102
|
+
const entryPath = join6(dir, entry.name);
|
|
1537
2103
|
if (entry.isDirectory())
|
|
1538
2104
|
stack.push(entryPath);
|
|
1539
2105
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -1547,7 +2113,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1547
2113
|
const nextStack = [];
|
|
1548
2114
|
const dirEntries = await Promise.all(dirs.map(async (dir) => ({
|
|
1549
2115
|
dir,
|
|
1550
|
-
entries: await
|
|
2116
|
+
entries: await readdir2(dir, {
|
|
1551
2117
|
encoding: "utf-8",
|
|
1552
2118
|
withFileTypes: true
|
|
1553
2119
|
})
|
|
@@ -1563,11 +2129,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1563
2129
|
if (cachedPath !== undefined) {
|
|
1564
2130
|
return cachedPath;
|
|
1565
2131
|
}
|
|
1566
|
-
if (!sourcePath.includes(`${
|
|
2132
|
+
if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
1567
2133
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
1568
2134
|
return sourcePath;
|
|
1569
2135
|
}
|
|
1570
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
2136
|
+
const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
1571
2137
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
1572
2138
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
1573
2139
|
return nextPath;
|
|
@@ -1575,7 +2141,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1575
2141
|
if (!spec.startsWith(".")) {
|
|
1576
2142
|
return null;
|
|
1577
2143
|
}
|
|
1578
|
-
const basePath =
|
|
2144
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
1579
2145
|
const candidates = [
|
|
1580
2146
|
basePath,
|
|
1581
2147
|
`${basePath}.ts`,
|
|
@@ -1583,19 +2149,19 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1583
2149
|
`${basePath}.mjs`,
|
|
1584
2150
|
`${basePath}.cjs`,
|
|
1585
2151
|
`${basePath}.json`,
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
2152
|
+
join6(basePath, "index.ts"),
|
|
2153
|
+
join6(basePath, "index.js"),
|
|
2154
|
+
join6(basePath, "index.mjs"),
|
|
2155
|
+
join6(basePath, "index.cjs"),
|
|
2156
|
+
join6(basePath, "index.json")
|
|
1591
2157
|
];
|
|
1592
2158
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
1593
2159
|
const foundIndex = existResults.indexOf(true);
|
|
1594
2160
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
1595
|
-
},
|
|
1596
|
-
const relativeSourcePath =
|
|
2161
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
2162
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1597
2163
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1598
|
-
return
|
|
2164
|
+
return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
1599
2165
|
}, resolveSvelteImport = async (spec, from) => {
|
|
1600
2166
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
1601
2167
|
const resolved = resolvePackageImport(spec);
|
|
@@ -1607,7 +2173,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1607
2173
|
if (!spec.startsWith(".")) {
|
|
1608
2174
|
return null;
|
|
1609
2175
|
}
|
|
1610
|
-
const explicitPath =
|
|
2176
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
1611
2177
|
if (extname2(explicitPath) === ".svelte") {
|
|
1612
2178
|
return explicitPath;
|
|
1613
2179
|
}
|
|
@@ -1627,7 +2193,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1627
2193
|
}
|
|
1628
2194
|
await Bun.write(path, content);
|
|
1629
2195
|
}, compileSvelteServerModule = async (sourcePath) => {
|
|
1630
|
-
const cachedModulePath =
|
|
2196
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
1631
2197
|
if (cachedModulePath) {
|
|
1632
2198
|
return cachedModulePath;
|
|
1633
2199
|
}
|
|
@@ -1666,7 +2232,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1666
2232
|
continue;
|
|
1667
2233
|
if (resolvedChildModules[index])
|
|
1668
2234
|
continue;
|
|
1669
|
-
rewrittenModulePaths.set(spec, ensureRelativeImportPath(
|
|
2235
|
+
rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
|
|
1670
2236
|
}
|
|
1671
2237
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
1672
2238
|
transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
|
|
@@ -1680,15 +2246,15 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1680
2246
|
generate: "server"
|
|
1681
2247
|
}).js.code;
|
|
1682
2248
|
for (const [spec, compiledChildPath] of childModulePaths) {
|
|
1683
|
-
compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(
|
|
2249
|
+
compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
|
|
1684
2250
|
}
|
|
1685
2251
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
1686
2252
|
compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
|
|
1687
2253
|
}
|
|
1688
|
-
const compiledModulePath =
|
|
1689
|
-
await
|
|
2254
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
2255
|
+
await mkdir2(dirname3(compiledModulePath), { recursive: true });
|
|
1690
2256
|
await writeIfChanged(compiledModulePath, compiledCode);
|
|
1691
|
-
|
|
2257
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
1692
2258
|
return compiledModulePath;
|
|
1693
2259
|
};
|
|
1694
2260
|
var init_svelteServerModule = __esm(() => {
|
|
@@ -1696,8 +2262,8 @@ var init_svelteServerModule = __esm(() => {
|
|
|
1696
2262
|
init_lowerIslandSyntax();
|
|
1697
2263
|
init_lowerAwaitSlotSyntax();
|
|
1698
2264
|
init_stylePreprocessor();
|
|
1699
|
-
|
|
1700
|
-
|
|
2265
|
+
serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
2266
|
+
compiledModuleCache2 = new Map;
|
|
1701
2267
|
originalSourcePathCache = new Map;
|
|
1702
2268
|
transpiler = new Bun.Transpiler({
|
|
1703
2269
|
loader: "ts",
|
|
@@ -1705,18 +2271,31 @@ var init_svelteServerModule = __esm(() => {
|
|
|
1705
2271
|
});
|
|
1706
2272
|
});
|
|
1707
2273
|
|
|
2274
|
+
// src/utils/vueCompiler.ts
|
|
2275
|
+
var createVueCompiler = async () => {
|
|
2276
|
+
const [compiler, typescript] = await Promise.all([
|
|
2277
|
+
import("@vue/compiler-sfc"),
|
|
2278
|
+
import("typescript")
|
|
2279
|
+
]);
|
|
2280
|
+
compiler.registerTS?.(() => typescript);
|
|
2281
|
+
return compiler;
|
|
2282
|
+
}, compilerPromise, loadVueCompiler = () => {
|
|
2283
|
+
compilerPromise ??= createVueCompiler();
|
|
2284
|
+
return compilerPromise;
|
|
2285
|
+
};
|
|
2286
|
+
|
|
1708
2287
|
// src/core/vueServerModule.ts
|
|
1709
2288
|
import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "fs";
|
|
1710
|
-
import { mkdir as
|
|
1711
|
-
import { dirname as
|
|
2289
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
2290
|
+
import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
|
|
1712
2291
|
var {Transpiler } = globalThis.Bun;
|
|
1713
|
-
var ISLAND_COMPONENT_ID_LENGTH = 8,
|
|
1714
|
-
const importPath =
|
|
2292
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
2293
|
+
const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
|
|
1715
2294
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1716
|
-
},
|
|
1717
|
-
const relativeSourcePath =
|
|
2295
|
+
}, getCachedModulePath3 = (sourcePath) => {
|
|
2296
|
+
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1718
2297
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1719
|
-
return
|
|
2298
|
+
return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
|
|
1720
2299
|
}, writeIfChanged2 = async (path, content) => {
|
|
1721
2300
|
const targetFile = Bun.file(path);
|
|
1722
2301
|
if (await targetFile.exists()) {
|
|
@@ -1743,10 +2322,10 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
1743
2322
|
`) : nonVueLines.join(`
|
|
1744
2323
|
`);
|
|
1745
2324
|
}, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
|
|
1746
|
-
const cachedModulePath =
|
|
2325
|
+
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
1747
2326
|
if (cachedModulePath)
|
|
1748
2327
|
return cachedModulePath;
|
|
1749
|
-
const compiler = await
|
|
2328
|
+
const compiler = await loadVueCompiler();
|
|
1750
2329
|
const source = await Bun.file(sourcePath).text();
|
|
1751
2330
|
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
1752
2331
|
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
@@ -1754,8 +2333,8 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
1754
2333
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
1755
2334
|
fs: {
|
|
1756
2335
|
fileExists: existsSync4,
|
|
1757
|
-
|
|
1758
|
-
|
|
2336
|
+
realpath: realpathSync,
|
|
2337
|
+
readFile: (file) => existsSync4(file) ? readFileSync4(file, "utf-8") : undefined
|
|
1759
2338
|
},
|
|
1760
2339
|
id: componentId,
|
|
1761
2340
|
inlineTemplate: false
|
|
@@ -1776,7 +2355,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
1776
2355
|
}).code : "const ssrRender = () => {};";
|
|
1777
2356
|
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
1778
2357
|
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
1779
|
-
compiledPath: await compileVueServerModule(
|
|
2358
|
+
compiledPath: await compileVueServerModule(resolve6(dirname4(sourcePath), relativeImport)),
|
|
1780
2359
|
spec: relativeImport
|
|
1781
2360
|
})));
|
|
1782
2361
|
const strippedScript = stripExports(compiledScript.content);
|
|
@@ -1788,20 +2367,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
1788
2367
|
"export default script;"
|
|
1789
2368
|
].join(`
|
|
1790
2369
|
`));
|
|
1791
|
-
const compiledModulePath =
|
|
2370
|
+
const compiledModulePath = getCachedModulePath3(sourcePath);
|
|
1792
2371
|
let rewritten = assembled;
|
|
1793
2372
|
for (const child of compiledChildren) {
|
|
1794
2373
|
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
1795
2374
|
}
|
|
1796
|
-
await
|
|
2375
|
+
await mkdir3(dirname4(compiledModulePath), { recursive: true });
|
|
1797
2376
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
1798
|
-
|
|
2377
|
+
compiledModuleCache3.set(sourcePath, compiledModulePath);
|
|
1799
2378
|
return compiledModulePath;
|
|
1800
2379
|
};
|
|
1801
2380
|
var init_vueServerModule = __esm(() => {
|
|
1802
2381
|
init_constants();
|
|
1803
|
-
|
|
1804
|
-
|
|
2382
|
+
serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
|
|
2383
|
+
compiledModuleCache3 = new Map;
|
|
1805
2384
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
1806
2385
|
});
|
|
1807
2386
|
|
|
@@ -1896,8 +2475,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1896
2475
|
throw new Error("Resolved Vue island is not a valid Vue component.");
|
|
1897
2476
|
}
|
|
1898
2477
|
return resolvedComponent;
|
|
2478
|
+
}, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
|
|
2479
|
+
const serverModulePath = await compileAngularServerModule(buildReferencePath);
|
|
2480
|
+
const loadedModule = await import(serverModulePath);
|
|
2481
|
+
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
2482
|
+
return loadedModule[exportName];
|
|
2483
|
+
}
|
|
2484
|
+
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
1899
2485
|
}, resolveAngularServerIslandComponent = async (component) => {
|
|
1900
|
-
const
|
|
2486
|
+
const buildReference = getIslandBuildReference(component);
|
|
2487
|
+
const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
|
|
2488
|
+
const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
|
|
1901
2489
|
if (!isAngularServerIslandComponent(resolvedComponent)) {
|
|
1902
2490
|
throw new Error("Resolved Angular island is not a valid Angular component.");
|
|
1903
2491
|
}
|
|
@@ -1953,6 +2541,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1953
2541
|
};
|
|
1954
2542
|
var init_renderIslandMarkup = __esm(() => {
|
|
1955
2543
|
init_islandSsr();
|
|
2544
|
+
init_angularServerModule();
|
|
1956
2545
|
init_svelteServerModule();
|
|
1957
2546
|
init_vueServerModule();
|
|
1958
2547
|
init_islandMarkupAttributes();
|
|
@@ -2083,5 +2672,5 @@ export {
|
|
|
2083
2672
|
createIslandStore
|
|
2084
2673
|
};
|
|
2085
2674
|
|
|
2086
|
-
//# debugId=
|
|
2675
|
+
//# debugId=0F04C4FDF6B488E264756E2164756E21
|
|
2087
2676
|
//# sourceMappingURL=index.js.map
|