@powerhousedao/shared 6.2.3-dev.1 → 6.2.3-dev.11
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/clis/args/{access-token-To5LaIfL.mjs → access-token-zW_7Brog.mjs} +2 -2
- package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-zW_7Brog.mjs.map} +1 -1
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-CcYbXrBx.mjs → common-BT8ABM57.mjs} +9 -2
- package/dist/clis/args/common-BT8ABM57.mjs.map +1 -0
- package/dist/clis/args/{common-Dsf1vpHV.d.mts → common-yKU4B741.d.mts} +6 -3
- package/dist/clis/args/common-yKU4B741.d.mts.map +1 -0
- package/dist/clis/args/common.d.mts +1 -1
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-BJs9xNFX.mjs} +2 -2
- package/dist/clis/args/{connect-BVVvCmL9.mjs.map → connect-BJs9xNFX.mjs.map} +1 -1
- package/dist/clis/args/{connect-DetTnI8g.d.mts → connect-BtU0MTTc.d.mts} +6 -6
- package/dist/clis/args/{connect-DetTnI8g.d.mts.map → connect-BtU0MTTc.d.mts.map} +1 -1
- package/dist/clis/args/connect.d.mts +1 -1
- package/dist/clis/args/connect.mjs +1 -1
- package/dist/clis/args/{generate-CA916Fvj.mjs → generate-DkFqeNX3.mjs} +2 -2
- package/dist/clis/args/{generate-CA916Fvj.mjs.map → generate-DkFqeNX3.mjs.map} +1 -1
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-Bqbgbalu.mjs → help-mSyWtycB.mjs} +15 -15
- package/dist/clis/args/{help-Bqbgbalu.mjs.map → help-mSyWtycB.mjs.map} +1 -1
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/index.d.mts +3 -3
- package/dist/clis/args/index.mjs +18 -18
- package/dist/clis/args/{init-rz9Ei7nq.mjs → init-Bu8-Ovk8.mjs} +2 -2
- package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-Bu8-Ovk8.mjs.map} +1 -1
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-GjiR0Qqd.mjs} +2 -2
- package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-GjiR0Qqd.mjs.map} +1 -1
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/{install-Sz2DlCHh.mjs → install-B2hLryPk.mjs} +2 -2
- package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-B2hLryPk.mjs.map} +1 -1
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/{list-DM2d6f1m.mjs → list-O6VmV3Cw.mjs} +2 -2
- package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-O6VmV3Cw.mjs.map} +1 -1
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/{login-DiKT5Jfu.mjs → login-BWXdMfMX.mjs} +2 -2
- package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-BWXdMfMX.mjs.map} +1 -1
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-3MTmDiXt.mjs} +2 -2
- package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-3MTmDiXt.mjs.map} +1 -1
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/{publish-DDZYsUfV.mjs → publish--zdKYIOl.mjs} +2 -2
- package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish--zdKYIOl.mjs.map} +1 -1
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-BNVeE6qR.mjs} +2 -2
- package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-BNVeE6qR.mjs.map} +1 -1
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/{service-CHOOr0Gg.mjs → service-x6wsNujS.mjs} +2 -2
- package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-x6wsNujS.mjs.map} +1 -1
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-Cryy_3Qc.mjs} +2 -2
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-Cryy_3Qc.mjs.map} +1 -1
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-DQUsLzCG.mjs} +2 -2
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-DQUsLzCG.mjs.map} +1 -1
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-CeDsvgMv.mjs} +2 -2
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-CeDsvgMv.mjs.map} +1 -1
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/{vetra-DLQ6lhLl.d.mts → vetra-CoMvTJK7.d.mts} +2 -2
- package/dist/clis/args/{vetra-DLQ6lhLl.d.mts.map → vetra-CoMvTJK7.d.mts.map} +1 -1
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-pYJXVf_o.mjs} +2 -2
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-pYJXVf_o.mjs.map} +1 -1
- package/dist/clis/args/vetra.d.mts +1 -1
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-config.d.mts +29 -1
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +138 -19
- package/dist/clis/build-config.mjs.map +1 -1
- package/dist/clis/constants.d.mts +13 -0
- package/dist/clis/constants.d.mts.map +1 -1
- package/dist/clis/constants.mjs +8 -0
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/index.d.mts +16 -0
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +16 -1
- package/dist/clis/index.mjs.map +1 -1
- package/dist/connect/config-loader.d.ts +1 -1
- package/dist/connect/index.d.ts +93 -2
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +180 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/document-drive/index.d.ts +43 -3
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +94 -34
- package/dist/document-drive/index.js.map +1 -1
- package/dist/document-model/index.d.ts +2 -2
- package/dist/document-model/index.js +1 -0
- package/dist/document-model/index.js.map +1 -1
- package/dist/{index-DyYIJtVy.d.ts → index-DP3QgHTq.d.ts} +2 -2
- package/dist/{index-DyYIJtVy.d.ts.map → index-DP3QgHTq.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/processors/index.d.ts +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +1 -1
- package/dist/registry/manifest-slim.d.ts.map +1 -1
- package/dist/registry/manifest-slim.js +2 -1
- package/dist/registry/manifest-slim.js.map +1 -1
- package/dist/{types-CpnWmiFY.d.ts → types-BIoOWpOT.d.ts} +6 -1
- package/dist/types-BIoOWpOT.d.ts.map +1 -0
- package/dist/{types-YqLqb0Zb.d.ts → types-jzM0X9cd.d.ts} +8 -2
- package/dist/{types-YqLqb0Zb.d.ts.map → types-jzM0X9cd.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
- package/dist/clis/args/common-Dsf1vpHV.d.mts.map +0 -1
- package/dist/types-CpnWmiFY.d.ts.map +0 -1
package/dist/connect/index.d.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import { D as PHConnectRuntimeConfig, I as PowerhouseConfig, L as PowerhousePackage, S as PHConnectPwaUrlPattern, _ as PHConnectPwaCacheStrategy, b as PHConnectPwaManifest, g as PHConnectPwa, v as PHConnectPwaFileHandler, x as PHConnectPwaRuntimeCaching, y as PHConnectPwaIcon } from "../types-
|
|
1
|
+
import { D as PHConnectRuntimeConfig, I as PowerhouseConfig, L as PowerhousePackage, S as PHConnectPwaUrlPattern, _ as PHConnectPwaCacheStrategy, b as PHConnectPwaManifest, g as PHConnectPwa, v as PHConnectPwaFileHandler, x as PHConnectPwaRuntimeCaching, y as PHConnectPwaIcon } from "../types-BIoOWpOT.js";
|
|
2
2
|
import { ConfigAdapter, ConfigLoader, ConfigShape, DeepPartial, deepMerge } from "./config-loader.js";
|
|
3
3
|
import { JsonConfigAdapter, JsonConfigAdapterOptions } from "./json-adapter.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
|
+
//#region connect/dynamic-base.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The base a dynamic-base Connect build is compiled against. The build emits
|
|
9
|
+
* this literal wherever a base-relative URL would go, and the serving layer
|
|
10
|
+
* (the dynamic-base vite plugin at build time, the connect proxy at serve
|
|
11
|
+
* time) rewrites it to the base the app is actually deployed under.
|
|
12
|
+
*
|
|
13
|
+
* It lives here, in the browser-safe shared package, rather than in
|
|
14
|
+
* `@powerhousedao/builder-tools`, because both the node-only build toolchain
|
|
15
|
+
* and Connect's own browser code need it. Importing builder-tools from app
|
|
16
|
+
* code pulls the whole build toolchain (and its node-only `read-pkg`
|
|
17
|
+
* dependency) into the browser graph.
|
|
18
|
+
*/
|
|
19
|
+
declare const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
|
|
20
|
+
//#endregion
|
|
6
21
|
//#region connect/env-config.d.ts
|
|
7
22
|
/**
|
|
8
23
|
* Build-time configuration schema
|
|
@@ -911,5 +926,81 @@ declare const phConnectRuntimeConfigSchema: {
|
|
|
911
926
|
};
|
|
912
927
|
};
|
|
913
928
|
//#endregion
|
|
914
|
-
|
|
929
|
+
//#region connect/shared-deps.d.ts
|
|
930
|
+
type SharedDep = {
|
|
931
|
+
specifier: string;
|
|
932
|
+
package: string;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* The dependency set Connect and loaded packages share via the import map.
|
|
936
|
+
* `@powerhousedao/connect` is deliberately absent: it is the Connect app
|
|
937
|
+
* itself (no importable exports), so there is nothing to share.
|
|
938
|
+
*/
|
|
939
|
+
declare const SHARED_DEPS: readonly SharedDep[];
|
|
940
|
+
declare const SHARED_DEP_SPECIFIERS: readonly string[];
|
|
941
|
+
/**
|
|
942
|
+
* The `@powerhousedao/shared` subpaths the production vendor bundles. The
|
|
943
|
+
* bare root is deliberately absent: its type barrel references node-only
|
|
944
|
+
* modules (`clis/`), which the current vite/rolldown cannot bundle for the
|
|
945
|
+
* browser — vendoring the root fails the build (a pre-existing latent
|
|
946
|
+
* issue). A package that imports the bare root is simply not shared; it
|
|
947
|
+
* bundles its own copy.
|
|
948
|
+
*/
|
|
949
|
+
declare const SHARED_SUBPATHS: readonly string[];
|
|
950
|
+
/**
|
|
951
|
+
* The specifiers a package build may safely externalize onto the host's
|
|
952
|
+
* import map — i.e. the ones the vendor actually publishes an entry for.
|
|
953
|
+
*
|
|
954
|
+
* `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as
|
|
955
|
+
* a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and
|
|
956
|
+
* neither are its other subpaths (`analytics`, `constants`, `clis`, ...).
|
|
957
|
+
* Externalizing those would leave a bare specifier in the package's output
|
|
958
|
+
* that nothing in the import map resolves, so the package would fail to load
|
|
959
|
+
* at runtime instead of simply bundling its own copy.
|
|
960
|
+
*/
|
|
961
|
+
declare const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[];
|
|
962
|
+
/** Split a specifier into its package name and subpath ("" for a root). */
|
|
963
|
+
declare function parseDepSpec(spec: string): {
|
|
964
|
+
pkg: string;
|
|
965
|
+
sub: string;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Return the import/export specifiers in `source` that are a shared
|
|
969
|
+
* specifier (or a subpath of one), sorted. Heuristic: only statement
|
|
970
|
+
* positions are scanned (`from "x"`, `import "x"`, `import("x")`;
|
|
971
|
+
* `export … from "x"` is covered by the `from` pattern), so import-like
|
|
972
|
+
* text inside comments or strings can be reported too. That errs toward
|
|
973
|
+
* over-reporting, which is the safe direction for the advisory build
|
|
974
|
+
* warning.
|
|
975
|
+
*/
|
|
976
|
+
declare function findSharedImports(source: string, specs?: readonly string[]): string[];
|
|
977
|
+
/**
|
|
978
|
+
* Rewrite a package source for blob import in a worker context (import maps
|
|
979
|
+
* don't apply there): shared specifiers become their mapped URLs, and
|
|
980
|
+
* relative (`./`, `../`) specifiers become absolute against `sourceUrl`
|
|
981
|
+
* (a blob URL has no directory to resolve against). `#` subpath imports are
|
|
982
|
+
* deliberately left alone: they resolve via the package's own
|
|
983
|
+
* `package.json` "imports" field, which the rewrite cannot reproduce.
|
|
984
|
+
* Returns the input unchanged when nothing matched.
|
|
985
|
+
*/
|
|
986
|
+
declare function rewritePackageSource(source: string, sourceUrl: string, imports: Record<string, string>): string;
|
|
987
|
+
type SharedDepMismatch = {
|
|
988
|
+
package: string;
|
|
989
|
+
required: string;
|
|
990
|
+
provided: string;
|
|
991
|
+
};
|
|
992
|
+
type PackageDeps = {
|
|
993
|
+
dependencies?: Record<string, unknown>;
|
|
994
|
+
peerDependencies?: Record<string, unknown>;
|
|
995
|
+
};
|
|
996
|
+
/**
|
|
997
|
+
* Compare a package's declared ranges against the host's version table.
|
|
998
|
+
* `hostVersions` defines the checked set (only deps present in it are
|
|
999
|
+
* checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)
|
|
1000
|
+
* and unparseable ranges never mismatch.
|
|
1001
|
+
*/
|
|
1002
|
+
declare function checkSharedDeps(pkgJson: PackageDeps, hostVersions: Record<string, string>): SharedDepMismatch[];
|
|
1003
|
+
declare function formatSharedDepWarnings(mismatches: SharedDepMismatch[]): string[];
|
|
1004
|
+
//#endregion
|
|
1005
|
+
export { ConfigAdapter, ConfigLoader, ConfigShape, ConnectBuildEnv, ConnectEnv, ConnectRuntimeEnv, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, DeepPartial, EXTERNALIZABLE_SHARED_SPECIFIERS, JsonConfigAdapter, JsonConfigAdapterOptions, LoadEnvOptions, type PHConnectPwa, type PHConnectPwaCacheStrategy, type PHConnectPwaFileHandler, type PHConnectPwaIcon, type PHConnectPwaManifest, type PHConnectPwaRuntimeCaching, type PHConnectPwaUrlPattern, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, PackageDeps, PwaContribution, PwaWebManifest, ROOT_STORAGE_NAMESPACE, RuntimePowerhouseConfig, SHARED_DEPS, SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, SharedDep, SharedDepMismatch, buildRuntimeConfig, checkSharedDeps, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, findSharedImports, formatSharedDepWarnings, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, parseDepSpec, phConnectRuntimeConfigSchema, powerhousePackageSchema, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
|
|
915
1006
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/runtime-config.ts","../../connect/schema-fragments.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../connect/dynamic-base.ts","../../connect/env-config.ts","../../connect/pwa-config.ts","../../connect/pwa-manifest.ts","../../connect/runtime-config.ts","../../connect/schema-fragments.ts","../../connect/shared-deps.ts"],"mappings":";;;;;;;;;;;;AAYA;;;;;;cAAa,wBAAA;;;;;;cCQP,cAAA,EAAc,CAAA,CAAA,SAAA;;;;;;;;;;AApBI;;cA+IX,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KC/FD,SAAA;EAAc,SAAA;EAAmB,OAAA;AAAA;;;ANU7C;;;cMHa,WAAA,WAAsB,SAAA;AAAA,cA2BtB,qBAAA;;;;ALpCW;;;;;cKgDX,eAAA;;;;;;;;;;;;cAqBA,gCAAA;;iBAQG,YAAA,CAAa,IAAA;EAAiB,GAAA;EAAa,GAAA;AAAA;;;;;;;;;;iBAwB3C,iBAAA,CACd,MAAA,UACA,KAAA;;;;;;;;;;iBA0Bc,oBAAA,CACd,MAAA,UACA,SAAA,UACA,OAAA,EAAS,MAAA;AAAA,KAkCC,iBAAA;EACV,OAAA;EACA,QAAA;EACA,QAAA;AAAA;AAAA,KAGU,WAAA;EACV,YAAA,GAAe,MAAA;EACf,gBAAA,GAAmB,MAAA;AAAA;;;;;;;iBASL,eAAA,CACd,OAAA,EAAS,WAAA,EACT,YAAA,EAAc,MAAA,mBACb,iBAAA;AAAA,iBAkBa,uBAAA,CACd,UAAA,EAAY,iBAAA"}
|
package/dist/connect/index.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { i as buildRuntimeConfig, n as deepMerge, r as DEFAULT_CONNECT_CONFIG, t as ConfigLoader } from "../config-loader-B845Hidf.js";
|
|
2
2
|
import { JsonConfigAdapter } from "./json-adapter.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { satisfies, validRange } from "semver";
|
|
5
|
+
//#region connect/dynamic-base.ts
|
|
6
|
+
/**
|
|
7
|
+
* The base a dynamic-base Connect build is compiled against. The build emits
|
|
8
|
+
* this literal wherever a base-relative URL would go, and the serving layer
|
|
9
|
+
* (the dynamic-base vite plugin at build time, the connect proxy at serve
|
|
10
|
+
* time) rewrites it to the base the app is actually deployed under.
|
|
11
|
+
*
|
|
12
|
+
* It lives here, in the browser-safe shared package, rather than in
|
|
13
|
+
* `@powerhousedao/builder-tools`, because both the node-only build toolchain
|
|
14
|
+
* and Connect's own browser code need it. Importing builder-tools from app
|
|
15
|
+
* code pulls the whole build toolchain (and its node-only `read-pkg`
|
|
16
|
+
* dependency) into the browser graph.
|
|
17
|
+
*/
|
|
18
|
+
const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
|
|
19
|
+
//#endregion
|
|
4
20
|
//#region connect/env-config.ts
|
|
5
21
|
/**
|
|
6
22
|
* Coerces string values to boolean.
|
|
@@ -964,6 +980,169 @@ const phConnectRuntimeConfigSchema = {
|
|
|
964
980
|
}
|
|
965
981
|
};
|
|
966
982
|
//#endregion
|
|
967
|
-
|
|
983
|
+
//#region connect/shared-deps.ts
|
|
984
|
+
/**
|
|
985
|
+
* The dependency set Connect and loaded packages share via the import map.
|
|
986
|
+
* `@powerhousedao/connect` is deliberately absent: it is the Connect app
|
|
987
|
+
* itself (no importable exports), so there is nothing to share.
|
|
988
|
+
*/
|
|
989
|
+
const SHARED_DEPS = [
|
|
990
|
+
{
|
|
991
|
+
specifier: "document-model",
|
|
992
|
+
package: "document-model"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
specifier: "@powerhousedao/document-engineering",
|
|
996
|
+
package: "@powerhousedao/document-engineering"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
specifier: "@powerhousedao/shared",
|
|
1000
|
+
package: "@powerhousedao/shared"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
specifier: "@powerhousedao/shared/registry/urls",
|
|
1004
|
+
package: "@powerhousedao/shared"
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
specifier: "@powerhousedao/design-system/connect",
|
|
1008
|
+
package: "@powerhousedao/design-system"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
specifier: "@powerhousedao/reactor-browser",
|
|
1012
|
+
package: "@powerhousedao/reactor-browser"
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
specifier: "zod",
|
|
1016
|
+
package: "zod"
|
|
1017
|
+
}
|
|
1018
|
+
];
|
|
1019
|
+
const SHARED_DEP_SPECIFIERS = SHARED_DEPS.map((d) => d.specifier);
|
|
1020
|
+
/**
|
|
1021
|
+
* The `@powerhousedao/shared` subpaths the production vendor bundles. The
|
|
1022
|
+
* bare root is deliberately absent: its type barrel references node-only
|
|
1023
|
+
* modules (`clis/`), which the current vite/rolldown cannot bundle for the
|
|
1024
|
+
* browser — vendoring the root fails the build (a pre-existing latent
|
|
1025
|
+
* issue). A package that imports the bare root is simply not shared; it
|
|
1026
|
+
* bundles its own copy.
|
|
1027
|
+
*/
|
|
1028
|
+
const SHARED_SUBPATHS = [
|
|
1029
|
+
"connect",
|
|
1030
|
+
"document-model",
|
|
1031
|
+
"processors",
|
|
1032
|
+
"document-drive",
|
|
1033
|
+
"registry",
|
|
1034
|
+
"registry/urls",
|
|
1035
|
+
"registry/manifest-slim"
|
|
1036
|
+
];
|
|
1037
|
+
/**
|
|
1038
|
+
* The specifiers a package build may safely externalize onto the host's
|
|
1039
|
+
* import map — i.e. the ones the vendor actually publishes an entry for.
|
|
1040
|
+
*
|
|
1041
|
+
* `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as
|
|
1042
|
+
* a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and
|
|
1043
|
+
* neither are its other subpaths (`analytics`, `constants`, `clis`, ...).
|
|
1044
|
+
* Externalizing those would leave a bare specifier in the package's output
|
|
1045
|
+
* that nothing in the import map resolves, so the package would fail to load
|
|
1046
|
+
* at runtime instead of simply bundling its own copy.
|
|
1047
|
+
*/
|
|
1048
|
+
const EXTERNALIZABLE_SHARED_SPECIFIERS = [...new Set([...SHARED_DEP_SPECIFIERS.filter((s) => s !== "@powerhousedao/shared"), ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`)])];
|
|
1049
|
+
/** Split a specifier into its package name and subpath ("" for a root). */
|
|
1050
|
+
function parseDepSpec(spec) {
|
|
1051
|
+
if (spec.startsWith("@")) {
|
|
1052
|
+
const parts = spec.split("/");
|
|
1053
|
+
return {
|
|
1054
|
+
pkg: parts.slice(0, 2).join("/"),
|
|
1055
|
+
sub: parts.slice(2).join("/")
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
const i = spec.indexOf("/");
|
|
1059
|
+
return i === -1 ? {
|
|
1060
|
+
pkg: spec,
|
|
1061
|
+
sub: ""
|
|
1062
|
+
} : {
|
|
1063
|
+
pkg: spec.slice(0, i),
|
|
1064
|
+
sub: spec.slice(i + 1)
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
function isSharedSpecifier(spec, specs) {
|
|
1068
|
+
return specs.some((s) => spec === s || spec.startsWith(s + "/"));
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Return the import/export specifiers in `source` that are a shared
|
|
1072
|
+
* specifier (or a subpath of one), sorted. Heuristic: only statement
|
|
1073
|
+
* positions are scanned (`from "x"`, `import "x"`, `import("x")`;
|
|
1074
|
+
* `export … from "x"` is covered by the `from` pattern), so import-like
|
|
1075
|
+
* text inside comments or strings can be reported too. That errs toward
|
|
1076
|
+
* over-reporting, which is the safe direction for the advisory build
|
|
1077
|
+
* warning.
|
|
1078
|
+
*/
|
|
1079
|
+
function findSharedImports(source, specs = SHARED_DEP_SPECIFIERS) {
|
|
1080
|
+
const found = /* @__PURE__ */ new Set();
|
|
1081
|
+
for (const re of [
|
|
1082
|
+
/\bfrom\s+["']([^"'\\]+)["']/g,
|
|
1083
|
+
/\bimport\s+["']([^"'\\]+)["']/g,
|
|
1084
|
+
/\bimport\s*\(\s*["']([^"'\\]+)["']\s*\)/g
|
|
1085
|
+
]) for (const m of source.matchAll(re)) {
|
|
1086
|
+
const spec = m[1];
|
|
1087
|
+
if (isSharedSpecifier(spec, specs)) found.add(spec);
|
|
1088
|
+
}
|
|
1089
|
+
return [...found].sort();
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Rewrite a package source for blob import in a worker context (import maps
|
|
1093
|
+
* don't apply there): shared specifiers become their mapped URLs, and
|
|
1094
|
+
* relative (`./`, `../`) specifiers become absolute against `sourceUrl`
|
|
1095
|
+
* (a blob URL has no directory to resolve against). `#` subpath imports are
|
|
1096
|
+
* deliberately left alone: they resolve via the package's own
|
|
1097
|
+
* `package.json` "imports" field, which the rewrite cannot reproduce.
|
|
1098
|
+
* Returns the input unchanged when nothing matched.
|
|
1099
|
+
*/
|
|
1100
|
+
function rewritePackageSource(source, sourceUrl, imports) {
|
|
1101
|
+
if (!Object.keys(imports).length) return source;
|
|
1102
|
+
const base = new URL(sourceUrl);
|
|
1103
|
+
const map = (spec) => {
|
|
1104
|
+
const mapped = imports[spec];
|
|
1105
|
+
if (mapped) return mapped;
|
|
1106
|
+
if (spec.startsWith("./") || spec.startsWith("../")) return new URL(spec, base).href;
|
|
1107
|
+
return null;
|
|
1108
|
+
};
|
|
1109
|
+
let out = source;
|
|
1110
|
+
for (const re of [
|
|
1111
|
+
/\bfrom\s+(["'])([^"'\\]+)\1/g,
|
|
1112
|
+
/\bimport\s+(["'])([^"'\\]+)\1/g,
|
|
1113
|
+
/\bimport\s*\(\s*(["'])([^"'\\]+)\1\s*\)/g
|
|
1114
|
+
]) out = out.replace(re, (match, quote, spec) => {
|
|
1115
|
+
const mapped = map(spec);
|
|
1116
|
+
return mapped ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`) : match;
|
|
1117
|
+
});
|
|
1118
|
+
return out;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Compare a package's declared ranges against the host's version table.
|
|
1122
|
+
* `hostVersions` defines the checked set (only deps present in it are
|
|
1123
|
+
* checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)
|
|
1124
|
+
* and unparseable ranges never mismatch.
|
|
1125
|
+
*/
|
|
1126
|
+
function checkSharedDeps(pkgJson, hostVersions) {
|
|
1127
|
+
const out = [];
|
|
1128
|
+
const entries = [...Object.entries(pkgJson.dependencies ?? {}), ...Object.entries(pkgJson.peerDependencies ?? {})];
|
|
1129
|
+
for (const [dep, range] of entries) {
|
|
1130
|
+
const provided = hostVersions[dep];
|
|
1131
|
+
if (provided === void 0 || typeof range !== "string") continue;
|
|
1132
|
+
if (range === "*" || /^[a-z]+:/i.test(range)) continue;
|
|
1133
|
+
if (!validRange(range)) continue;
|
|
1134
|
+
if (!satisfies(provided, range, { includePrerelease: true })) out.push({
|
|
1135
|
+
package: dep,
|
|
1136
|
+
required: range,
|
|
1137
|
+
provided
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
return out;
|
|
1141
|
+
}
|
|
1142
|
+
function formatSharedDepWarnings(mismatches) {
|
|
1143
|
+
return mismatches.map((m) => `${m.package}: requires ${m.required}, Connect provides ${m.provided}`);
|
|
1144
|
+
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
export { ConfigLoader, DEFAULT_CONNECT_CONFIG, DYNAMIC_BASE_PLACEHOLDER, EXTERNALIZABLE_SHARED_SPECIFIERS, JsonConfigAdapter, PWA_FILE_HANDLER_ACTION, PWA_IDB_KEY, PWA_IDB_NAME, PWA_IDB_STORE, PWA_IDB_VERSION, ROOT_STORAGE_NAMESPACE, SHARED_DEPS, SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, buildRuntimeConfig, checkSharedDeps, connectEnvSchema, dedupeFileHandlers, dedupeIcons, deepMerge, findSharedImports, formatSharedDepWarnings, getStorageNamespace, loadConnectEnv, loadRuntimeEnv, mergeManifest, mergePwaConfig, normalizeBasePath, parseDepSpec, phConnectRuntimeConfigSchema, powerhousePackageSchema, rewritePackageSource, runtimeEnvSchema, setConnectEnv, toRegExpOrString, unionStrings, withInferredCategory };
|
|
968
1147
|
|
|
969
1148
|
//# sourceMappingURL=index.js.map
|