@fluid-app/fluid-cli-widget 0.1.37 → 0.1.39
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/dist/{index-DW3icMxz.d.mts → index-o4ZcD2C9.d.mts} +7 -2
- package/dist/{index-DW3icMxz.d.mts.map → index-o4ZcD2C9.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{src-CzqGGQnf.mjs → src-CTSiuhqb.mjs} +57 -4
- package/dist/src-CTSiuhqb.mjs.map +1 -0
- package/dist/vite/plugin.d.mts +1 -1
- package/dist/vite/plugin.mjs +1 -1
- package/package.json +4 -4
- package/dist/src-CzqGGQnf.mjs.map +0 -1
|
@@ -190,10 +190,15 @@ declare function createWidgetDevServerConfig(): UserConfig;
|
|
|
190
190
|
* imports to the request origin keeps the entire dev module graph on the
|
|
191
191
|
* widget server.
|
|
192
192
|
*
|
|
193
|
+
* Callers obtain `workerSdkUrl` from `resolveWorkerSdkUrl`, which owns the
|
|
194
|
+
* `/@id/` fallback. The parameter is deliberately required: defaulting to the
|
|
195
|
+
* alias here would let a caller silently reintroduce the two-module-record
|
|
196
|
+
* split of MIST-PW-01.
|
|
197
|
+
*
|
|
193
198
|
* Dev-only: this only ever serves from `configureServer` (the
|
|
194
199
|
* plugin's `apply: "serve"` gate), never a built/published package.
|
|
195
200
|
*/
|
|
196
|
-
declare function buildRuntimeEntryBootstrapScript(entryPath: string, origin: string): string;
|
|
201
|
+
declare function buildRuntimeEntryBootstrapScript(entryPath: string, origin: string, workerSdkUrl: string): string;
|
|
197
202
|
/**
|
|
198
203
|
* The shared development descriptor workflow appends Vite's `?direct` query
|
|
199
204
|
* to CSS URLs so preview hosts receive real CSS instead of JS style modules.
|
|
@@ -202,4 +207,4 @@ declare function buildRuntimeEntryBootstrapScript(entryPath: string, origin: str
|
|
|
202
207
|
declare function createDevWidgetPackageDescriptors(configModule: Readonly<Record<string, unknown>>, origin: string, owner?: WidgetPackageOwnerKind): readonly RemoteDomWidgetPackageDescriptor[];
|
|
203
208
|
//#endregion
|
|
204
209
|
export { fluidWidgetDevPlugin as a, createWidgetDevServerConfig as i, buildRuntimeEntryBootstrapScript as n, ValidatedWidgetPackageBuild as o, createDevWidgetPackageDescriptors as r, WidgetPackageValidationError as s, FluidWidgetDevPluginOptions as t };
|
|
205
|
-
//# sourceMappingURL=index-
|
|
210
|
+
//# sourceMappingURL=index-o4ZcD2C9.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-o4ZcD2C9.d.mts","names":[],"sources":["../../../portal/core/src/remote-dom-widget-package.ts","../../widget-tooling/src/internal/widget-package-validation.ts","../../widget-tooling/src/dev-routes.ts"],"mappings":";;;cAMa,kCAAA;AAAA,cACA,yBAAA;AAAA,KAED,aAAA;AAAA,KAEA,SAAA,GAAY,aAAA,YAAyB,SAAA,KAAc,UAAA;AAAA,UAE9C,UAAA;EAAA,UACS,GAAA,WAAA,SAAA;AAAA;AAAA,UA4DT,oCAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;AAAA;AAAA,UAGM,yBAAA;EAAA,SACN,IAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,IAAA;EAAA,SACA,QAAA;EAAA,SACA,cAAA,EAAgB,UAAA;EAAA,SAChB,YAAA,EAAc,UAAA;EAAA,SACd,SAAA;EAAA,SACA,SAAA;EAAA,SACA,aAAA;EAAA,SACA,YAAA,WAAuB,oCAAA;AAAA;;;;;;UAQjB,gCAAA;EAAA,SACN,eAAA,SAAwB,kCAAA;EAAA,SACxB,OAAA,SAAgB,yBAAA;EAAA,SAChB,SAAA;EAAA,SACA,MAAA;EAAA,SACA,OAAA;EAAA,SACA,cAAA;EAAA,SACA,OAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA,WAAkB,yBAAA;AAAA;;;KCnFjB,sBAAA;AAAA,UAKK,wB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,YAAA;;;;;;iBAwCc,iCAAA,CACd,YAAA,EAAc,QAAA,CAAS,MAAA,oBACvB,MAAA,UACA,KAAA,GAAO,sBAAA,YACG,gCAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ValidatedWidgetPackageBuild, s as WidgetPackageValidationError } from "./index-
|
|
1
|
+
import { o as ValidatedWidgetPackageBuild, s as WidgetPackageValidationError } from "./index-o4ZcD2C9.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { FluidPlugin } from "@fluid-app/fluid-cli";
|
|
4
4
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as fluidOsV0WidgetPackageGitCredentialCreate, l as WidgetToolingError, n as loadAndValidateWidgetPackage, r as publishWidgetPackage$1, t as buildWidgetPackage$1 } from "./src-
|
|
1
|
+
import { i as fluidOsV0WidgetPackageGitCredentialCreate, l as WidgetToolingError, n as loadAndValidateWidgetPackage, r as publishWidgetPackage$1, t as buildWidgetPackage$1 } from "./src-CTSiuhqb.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -574,9 +574,9 @@ function isRecord$3(value) {
|
|
|
574
574
|
}
|
|
575
575
|
//#endregion
|
|
576
576
|
//#region src/utils/template.ts
|
|
577
|
-
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.
|
|
578
|
-
const EMBEDDED_CLI_CORE_VERSION = "0.1.
|
|
579
|
-
const EMBEDDED_CLI_WIDGET_VERSION = "0.1.
|
|
577
|
+
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.482";
|
|
578
|
+
const EMBEDDED_CLI_CORE_VERSION = "0.1.19";
|
|
579
|
+
const EMBEDDED_CLI_WIDGET_VERSION = "0.1.39";
|
|
580
580
|
function getDefaultTemplatePath() {
|
|
581
581
|
return path.join(findPackageRoot(), "templates", "default");
|
|
582
582
|
}
|
|
@@ -605,7 +605,9 @@ function fluidWidgetDevPlugin(options = {}) {
|
|
|
605
605
|
server.middlewares.use(async (request, response, next) => {
|
|
606
606
|
const pathname = (request.url ?? "").split("?")[0] ?? "";
|
|
607
607
|
if (pathname === "/__runtime-entry__" || pathname === "/__runtime-entry__/") {
|
|
608
|
-
|
|
608
|
+
if (handleOptions(request, response)) return;
|
|
609
|
+
const origin = getRequestOrigin(request);
|
|
610
|
+
sendJavaScript(request, response, buildRuntimeEntryBootstrapScript(entryModulePath, origin, await resolveWorkerSdkUrl(server, origin)));
|
|
609
611
|
return;
|
|
610
612
|
}
|
|
611
613
|
if (pathname === "/__widget-packages__" || pathname === "/__widget-packages__/") {
|
|
@@ -636,6 +638,11 @@ function fluidWidgetDevPlugin(options = {}) {
|
|
|
636
638
|
function createWidgetDevServerConfig() {
|
|
637
639
|
return {
|
|
638
640
|
optimizeDeps: { include: ["@fluid-app/portal-sdk/widgets/worker"] },
|
|
641
|
+
resolve: { dedupe: [
|
|
642
|
+
"@fluid-app/portal-sdk",
|
|
643
|
+
"react",
|
|
644
|
+
"react-dom"
|
|
645
|
+
] },
|
|
639
646
|
ssr: { noExternal: ["@fluid-app/portal-sdk"] }
|
|
640
647
|
};
|
|
641
648
|
}
|
|
@@ -646,6 +653,48 @@ function createWidgetDevServerConfig() {
|
|
|
646
653
|
const WIDGET_ENTRY_MODULE_PATH = "/src/index.ts";
|
|
647
654
|
/** Source-relative path of a standalone widget project's package source. */
|
|
648
655
|
const WIDGET_CONFIG_MODULE_PATH = "/fluid.widget.config.ts";
|
|
656
|
+
/** Bare specifier of the SDK worker module the bootstrap prepares. */
|
|
657
|
+
const WORKER_SDK_SPECIFIER = "@fluid-app/portal-sdk/widgets/worker";
|
|
658
|
+
/**
|
|
659
|
+
* Resolves the bootstrap's SDK worker import to the same module URL the
|
|
660
|
+
* widget entry's rewritten bare import uses.
|
|
661
|
+
*
|
|
662
|
+
* The bootstrap used to import the hardcoded alias
|
|
663
|
+
* `/@id/@fluid-app/portal-sdk/widgets/worker`. Vite serves the optimized
|
|
664
|
+
* module body inline at that URL while the entry's rewritten import uses the
|
|
665
|
+
* canonical `/node_modules/.vite/deps/...?v=<hash>` URL — same bytes, two
|
|
666
|
+
* resolved URLs, two records in the worker's ES module map. The network
|
|
667
|
+
* guard's re-entry check is module-instance-local, so the second evaluation
|
|
668
|
+
* threw on every dev preview load (MIST-PW-01). Resolving server-side at
|
|
669
|
+
* request time keeps both imports on one module record.
|
|
670
|
+
*
|
|
671
|
+
* Falls back to the `/@id/` alias when resolution fails — no worse than the
|
|
672
|
+
* previous behavior, and the widget-runtime duplicate-install tripwire names
|
|
673
|
+
* the condition if the split ever regresses.
|
|
674
|
+
*/
|
|
675
|
+
async function resolveWorkerSdkUrl(server, origin) {
|
|
676
|
+
const fallback = new URL(`/@id/${WORKER_SDK_SPECIFIER}`, origin).toString();
|
|
677
|
+
try {
|
|
678
|
+
const resolved = await server.pluginContainer.resolveId(WORKER_SDK_SPECIFIER, void 0, { ssr: false });
|
|
679
|
+
if (!resolved?.id) return fallback;
|
|
680
|
+
const url = moduleIdToUrl(resolved.id, server.config.root);
|
|
681
|
+
return url ? new URL(url, origin).toString() : fallback;
|
|
682
|
+
} catch {
|
|
683
|
+
return fallback;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Mirrors Vite import-analysis URL normalization for the id shapes the
|
|
688
|
+
* resolver produces here: a file under the served root (the optimized-deps
|
|
689
|
+
* dir lives at `<root>/node_modules/.vite`) becomes a root-relative URL; any
|
|
690
|
+
* other absolute file path is served through `/@fs/`. Ids and root arrive
|
|
691
|
+
* posix-normalized from Vite, Windows drive letters included.
|
|
692
|
+
*/
|
|
693
|
+
function moduleIdToUrl(id, root) {
|
|
694
|
+
const rootPrefix = root.endsWith("/") ? root : `${root}/`;
|
|
695
|
+
if (id.startsWith(rootPrefix)) return `/${id.slice(rootPrefix.length)}`;
|
|
696
|
+
if (id.startsWith("/") || /^[A-Za-z]:\//.test(id)) return `/@fs/${id.replace(/^\//, "")}`;
|
|
697
|
+
}
|
|
649
698
|
/**
|
|
650
699
|
* Builds the `/__runtime-entry__` worker bootstrap. Runtime-verified
|
|
651
700
|
* against a real widget dev server + `@fluid-app/widget-runtime` host
|
|
@@ -701,12 +750,16 @@ const WIDGET_CONFIG_MODULE_PATH = "/fluid.widget.config.ts";
|
|
|
701
750
|
* imports to the request origin keeps the entire dev module graph on the
|
|
702
751
|
* widget server.
|
|
703
752
|
*
|
|
753
|
+
* Callers obtain `workerSdkUrl` from `resolveWorkerSdkUrl`, which owns the
|
|
754
|
+
* `/@id/` fallback. The parameter is deliberately required: defaulting to the
|
|
755
|
+
* alias here would let a caller silently reintroduce the two-module-record
|
|
756
|
+
* split of MIST-PW-01.
|
|
757
|
+
*
|
|
704
758
|
* Dev-only: this only ever serves from `configureServer` (the
|
|
705
759
|
* plugin's `apply: "serve"` gate), never a built/published package.
|
|
706
760
|
*/
|
|
707
|
-
function buildRuntimeEntryBootstrapScript(entryPath, origin) {
|
|
761
|
+
function buildRuntimeEntryBootstrapScript(entryPath, origin, workerSdkUrl) {
|
|
708
762
|
const refreshRuntimeUrl = new URL("/@react-refresh", origin).toString();
|
|
709
|
-
const workerSdkUrl = new URL("/@id/@fluid-app/portal-sdk/widgets/worker", origin).toString();
|
|
710
763
|
const entryUrl = new URL(entryPath, origin).toString();
|
|
711
764
|
return [
|
|
712
765
|
"// Dev-only worker bootstrap — see buildRuntimeEntryBootstrapScript",
|
|
@@ -2004,4 +2057,4 @@ function toPublicUploadErrorCode(code) {
|
|
|
2004
2057
|
//#endregion
|
|
2005
2058
|
export { buildRuntimeEntryBootstrapScript as a, fluidWidgetDevPlugin as c, fluidOsV0WidgetPackageGitCredentialCreate as i, WidgetToolingError as l, loadAndValidateWidgetPackage as n, createDevWidgetPackageDescriptors as o, publishWidgetPackage as r, createWidgetDevServerConfig as s, buildWidgetPackage as t };
|
|
2006
2059
|
|
|
2007
|
-
//# sourceMappingURL=src-
|
|
2060
|
+
//# sourceMappingURL=src-CTSiuhqb.mjs.map
|