@powerhousedao/builder-tools 6.2.3-dev.24 → 6.2.3-dev.25

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.d.mts CHANGED
@@ -2,17 +2,16 @@ import { DYNAMIC_BASE_PLACEHOLDER } from "@powerhousedao/shared/connect";
2
2
  import { CommonServerOptions, HtmlTagDescriptor, InlineConfig, Plugin } from "vite";
3
3
  import { PowerhouseConfig, PowerhousePackage } from "@powerhousedao/config";
4
4
  import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
5
-
6
5
  //#region connect-utils/constants.d.ts
7
- declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
8
- declare const IMPORT_SCRIPT_FILE = "external-packages.js";
9
- declare const LOCAL_PACKAGE_ID = "ph:local-package";
10
- declare const PH_DIR_NAME = ".ph";
6
+ export declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
7
+ export declare const IMPORT_SCRIPT_FILE = "external-packages.js";
8
+ export declare const LOCAL_PACKAGE_ID = "ph:local-package";
9
+ export declare const PH_DIR_NAME = ".ph";
11
10
  //#endregion
12
11
  //#region connect-utils/vite-plugins/build-hash.d.ts
13
12
  /** Name of the build-identity file emitted into the build output. */
14
- declare const BUILD_HASH_FILE: "build-hash.json";
15
- interface BuildHashInput {
13
+ export declare const BUILD_HASH_FILE: "build-hash.json";
14
+ export interface BuildHashInput {
16
15
  /** Monorepo workspace git SHA (CI/dev builds); empty outside the monorepo. */
17
16
  workspaceGitSha: string;
18
17
  /** Monorepo workspace version (CI/dev builds); empty outside it. */
@@ -39,8 +38,8 @@ interface BuildHashInput {
39
38
  * (define `PH_CONNECT_BUILD_HASH`) to `build-hash.json`, which the build
40
39
  * emits alongside the app and the server must serve no-cache.
41
40
  */
42
- declare function computeBuildHash(input: BuildHashInput): string;
43
- declare function buildHashFromBuildOptions(options: {
41
+ export declare function computeBuildHash(input: BuildHashInput): string;
42
+ export declare function buildHashFromBuildOptions(options: {
44
43
  dirname: string;
45
44
  phConfig: unknown;
46
45
  packages: ReadonlyArray<{
@@ -58,10 +57,10 @@ declare function buildHashFromBuildOptions(options: {
58
57
  * Build-only: dev (studio) never runs generateBundle, and the SPA check
59
58
  * treats a missing file as "nothing to compare" and stays silent.
60
59
  */
61
- declare function connectBuildHashPlugin(buildHash: string): Plugin;
60
+ export declare function connectBuildHashPlugin(buildHash: string): Plugin;
62
61
  //#endregion
63
62
  //#region connect-utils/externalize-vendor.d.ts
64
- interface VendorPrebuildOptions {
63
+ export interface VendorPrebuildOptions {
65
64
  /** Project root the vendor deps resolve from. */
66
65
  dirname: string;
67
66
  /** Specifiers to prebuild into the vendor (defaults to the dev set). */
@@ -92,14 +91,14 @@ interface VendorPrebuildOptions {
92
91
  * it's externalized from the build (see `VENDOR_EXTERNAL`) so the vendor shares
93
92
  * the dev server's single React instance via the import map.
94
93
  */
95
- declare const DEFAULT_VENDOR_INCLUDE: string[];
94
+ export declare const DEFAULT_VENDOR_INCLUDE: string[];
96
95
  /**
97
96
  * React-family specifiers kept external to the vendor build. The vendor's chunks
98
97
  * emit bare imports for these; `devReactImportmapPlugin`'s import map resolves
99
98
  * them to Vite's pre-bundled React, so there is exactly one React instance.
100
99
  */
101
- declare const VENDOR_EXTERNAL: string[];
102
- interface PrebuiltVendor {
100
+ export declare const VENDOR_EXTERNAL: string[];
101
+ export interface PrebuiltVendor {
103
102
  vendorDir: string;
104
103
  /** import map: bare specifier -> "/__vendor__/<entry>.js" (base-relative). */
105
104
  imports: Record<string, string>;
@@ -107,18 +106,18 @@ interface PrebuiltVendor {
107
106
  versions: Record<string, string>;
108
107
  }
109
108
  /** URL prefix the vendor bundle is served under by the dev middleware. */
110
- declare const VENDOR_URL_PREFIX = "/__vendor__/";
109
+ export declare const VENDOR_URL_PREFIX = "/__vendor__/";
111
110
  /**
112
111
  * Build the prebuilt vendor (once, in a throwaway subprocess) and return its dir
113
112
  * + import map. Idempotent: reuses a cached vendor built for the same dep set.
114
113
  * Returns null on any failure (caller falls back to a normal dev server).
115
114
  */
116
- declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
115
+ export declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
117
116
  /**
118
117
  * The published specifiers whose entry file the vendor build never emitted.
119
118
  * URLs are base-less (`/__vendor__/x.js`) and resolve inside `vendorDir`.
120
119
  */
121
- declare function missingVendorEntries(vendorDir: string, imports: Record<string, string>): {
120
+ export declare function missingVendorEntries(vendorDir: string, imports: Record<string, string>): {
122
121
  spec: string;
123
122
  url: string;
124
123
  }[];
@@ -132,10 +131,10 @@ declare function missingVendorEntries(vendorDir: string, imports: Record<string,
132
131
  * VENDOR_DYNAMIC_BASE default already carries the vendor segment — that
133
132
  * trailing segment is dropped first so it is never doubled.
134
133
  */
135
- declare function withVendorBase(imports: Record<string, string>, base: string): Record<string, string>;
134
+ export declare function withVendorBase(imports: Record<string, string>, base: string): Record<string, string>;
136
135
  //#endregion
137
136
  //#region connect-utils/types.d.ts
138
- type IConnectOptions = {
137
+ export type IConnectOptions = {
139
138
  mode: string;
140
139
  dirname: string;
141
140
  envDir?: string;
@@ -172,7 +171,7 @@ type IConnectOptions = {
172
171
  versions: Record<string, string>;
173
172
  };
174
173
  };
175
- type ConnectCommonOptions = {
174
+ export type ConnectCommonOptions = {
176
175
  base?: string;
177
176
  mode?: string;
178
177
  configFile?: string;
@@ -182,71 +181,71 @@ type ConnectCommonOptions = {
182
181
  defaultDrivesUrl?: string[];
183
182
  drivesPreserveStrategy?: "preserve-all" | "preserve-by-url-and-detach";
184
183
  };
185
- type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
184
+ export type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
186
185
  force?: boolean;
187
186
  };
188
- type ConnectStudioOptions = ConnectCommonOptions & {
187
+ export type ConnectStudioOptions = ConnectCommonOptions & {
189
188
  devServerOptions?: ViteDevOptions;
190
189
  printUrls?: boolean;
191
190
  bindCLIShortcuts?: boolean;
192
191
  };
193
- type ConnectBuildOptions = ConnectCommonOptions & {
192
+ export type ConnectBuildOptions = ConnectCommonOptions & {
194
193
  outDir?: string;
195
194
  };
196
- type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
195
+ export type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
197
196
  outDir?: string;
198
197
  printUrls?: boolean;
199
198
  bindCLIShortcuts?: boolean;
200
199
  };
201
200
  //#endregion
202
201
  //#region connect-utils/helpers.d.ts
203
- declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
204
- declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
205
- declare function resolvePackage(packageName: string, root?: string): string;
206
- declare function resolveConnectPackageJson(root?: string): JSON | null;
202
+ export declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
203
+ export declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
204
+ export declare function resolvePackage(packageName: string, root?: string): string;
205
+ export declare function resolveConnectPackageJson(root?: string): JSON | null;
207
206
  /**
208
207
  * Finds the dist dir of Connect on the local machine
209
208
  */
210
- declare function resolveConnectBundle(root?: string): string;
211
- declare function resolveConnectPublicDir(root?: string): string;
209
+ export declare function resolveConnectBundle(root?: string): string;
210
+ export declare function resolveConnectPublicDir(root?: string): string;
212
211
  /**
213
212
  * Copies the Connect dist dir to the target path
214
213
  */
215
- declare function copyConnect(sourcePath: string, targetPath: string): void;
214
+ export declare function copyConnect(sourcePath: string, targetPath: string): void;
216
215
  /**
217
216
  * Backs up the index.html file
218
217
  *
219
218
  * Needed when running the Connect Studio dev server on Windows
220
219
  */
221
- declare function backupIndexHtml(appPath: string, restore?: boolean): void;
222
- declare function removeBase64EnvValues(appPath: string): void;
223
- declare function readJsonFile(filePath: string): PowerhouseConfig | null;
220
+ export declare function backupIndexHtml(appPath: string, restore?: boolean): void;
221
+ export declare function removeBase64EnvValues(appPath: string): void;
222
+ export declare function readJsonFile(filePath: string): PowerhouseConfig | null;
224
223
  /**
225
224
  * Takes a list of Powerhouse project packages and optionally local Powerhouse packages and outputs a js file which exports those packages for use in Connect Studio.
226
225
  */
227
- declare function makeImportScriptFromPackages(args: {
226
+ export declare function makeImportScriptFromPackages(args: {
228
227
  packages: string[];
229
228
  importStyles?: boolean;
230
229
  localJsPath?: string;
231
230
  localCssPath?: string;
232
231
  }): string;
233
- declare function ensureNodeVersion(minVersion?: string): void;
234
- declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
232
+ export declare function ensureNodeVersion(minVersion?: string): void;
233
+ export declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
235
234
  /**
236
235
  * Appends the contents to the <head> tag of the index.html file
237
236
  */
238
- declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
237
+ export declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
239
238
  /**
240
239
  * Prepends the contents to the <head> tag of the index.html file
241
240
  */
242
- declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
243
- declare function runTsc(outDir: string): void;
244
- declare function stripVersionFromPackage(packageName: string): string;
241
+ export declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
242
+ export declare function runTsc(outDir: string): void;
243
+ export declare function stripVersionFromPackage(packageName: string): string;
245
244
  //#endregion
246
245
  //#region connect-utils/runtime-config-schema.d.ts
247
- declare const RUNTIME_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.config.json";
248
- declare const RUNTIME_CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/powerhouse-inc/powerhouse/main/packages/builder-tools/connect-utils/runtime-config.schema.json";
249
- declare const runtimeConfigSchema: {
246
+ export declare const RUNTIME_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.config.json";
247
+ export declare const RUNTIME_CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/powerhouse-inc/powerhouse/main/packages/builder-tools/connect-utils/runtime-config.schema.json";
248
+ export declare const runtimeConfigSchema: {
250
249
  readonly $schema: "http://json-schema.org/draft-07/schema#";
251
250
  readonly $id: "https://powerhouse.inc/schemas/powerhouse.config.json";
252
251
  readonly title: "Powerhouse Connect runtime configuration";
@@ -455,7 +454,7 @@ declare const runtimeConfigSchema: {
455
454
  readonly preserveStrategy: {
456
455
  readonly type: "string";
457
456
  readonly enum: readonly ["preserve-all", "preserve-by-url-and-detach"];
458
- readonly description: "Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default \u2014 opt-in only.";
457
+ readonly description: "Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.";
459
458
  };
460
459
  readonly sections: {
461
460
  readonly type: "object";
@@ -667,7 +666,7 @@ declare const runtimeConfigSchema: {
667
666
  readonly pwa: {
668
667
  readonly type: "object";
669
668
  readonly additionalProperties: false;
670
- readonly description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here \u2014 it is derived from the manifest's category field.) Only applied when connect.app.offline is true.";
669
+ readonly description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.";
671
670
  readonly properties: {
672
671
  readonly manifest: {
673
672
  readonly type: "object";
@@ -732,7 +731,7 @@ declare const runtimeConfigSchema: {
732
731
  readonly properties: {
733
732
  readonly accept: {
734
733
  readonly type: "object";
735
- readonly description: "MIME type \u2192 file extensions. Each extension must start with '.'; browsers ignore entries without it.";
734
+ readonly description: "MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.";
736
735
  readonly additionalProperties: {
737
736
  readonly type: "array";
738
737
  readonly items: {
@@ -917,7 +916,7 @@ declare const runtimeConfigSchema: {
917
916
  };
918
917
  //#endregion
919
918
  //#region connect-utils/vite-config.d.ts
920
- declare function getConnectHtmlTags(options?: {
919
+ export declare function getConnectHtmlTags(options?: {
921
920
  registryUrl?: string | null;
922
921
  injectTo?: HtmlTagDescriptor["injectTo"];
923
922
  }): [{
@@ -926,72 +925,72 @@ declare function getConnectHtmlTags(options?: {
926
925
  readonly "http-equiv": "Content-Security-Policy";
927
926
  readonly content: `script-src 'self' 'unsafe-inline' 'unsafe-eval'${string}; worker-src 'self' blob:; object-src 'none'; base-uri 'self';`;
928
927
  };
929
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
928
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
930
929
  }, {
931
930
  readonly tag: "meta";
932
931
  readonly attrs: {
933
932
  readonly property: "og:title";
934
933
  readonly content: "Connect";
935
934
  };
936
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
935
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
937
936
  }, {
938
937
  readonly tag: "meta";
939
938
  readonly attrs: {
940
939
  readonly property: "og:type";
941
940
  readonly content: "website";
942
941
  };
943
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
942
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
944
943
  }, {
945
944
  readonly tag: "meta";
946
945
  readonly attrs: {
947
946
  readonly property: "og:url";
948
947
  readonly content: "https://apps.powerhouse.io/powerhouse/connect/";
949
948
  };
950
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
949
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
951
950
  }, {
952
951
  readonly tag: "meta";
953
952
  readonly attrs: {
954
953
  readonly property: "og:description";
955
954
  readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
956
955
  };
957
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
956
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
958
957
  }, {
959
958
  readonly tag: "meta";
960
959
  readonly attrs: {
961
960
  readonly property: "og:image";
962
961
  readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
963
962
  };
964
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
963
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
965
964
  }, {
966
965
  readonly tag: "meta";
967
966
  readonly attrs: {
968
967
  readonly name: "twitter:card";
969
968
  readonly content: "summary_large_image";
970
969
  };
971
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
970
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
972
971
  }, {
973
972
  readonly tag: "meta";
974
973
  readonly attrs: {
975
974
  readonly name: "twitter:image";
976
975
  readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
977
976
  };
978
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
977
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
979
978
  }, {
980
979
  readonly tag: "meta";
981
980
  readonly attrs: {
982
981
  readonly name: "twitter:title";
983
982
  readonly content: "Connect";
984
983
  };
985
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
984
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
986
985
  }, {
987
986
  readonly tag: "meta";
988
987
  readonly attrs: {
989
988
  readonly name: "twitter:description";
990
989
  readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
991
990
  };
992
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
991
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
993
992
  }];
994
- declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
993
+ export declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
995
994
  //#endregion
996
995
  //#region connect-utils/vite-plugins/dynamic-base.d.ts
997
996
  /**
@@ -1022,14 +1021,14 @@ declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfi
1022
1021
  * they need no rewrite once the stylesheet itself is loaded from the right
1023
1022
  * prefix (which the HTML substitution handles).
1024
1023
  */
1025
- declare function connectDynamicBasePlugin(options?: {
1024
+ export declare function connectDynamicBasePlugin(options?: {
1026
1025
  forWorker?: boolean;
1027
1026
  workerStripPrefix?: string;
1028
1027
  }): Plugin;
1029
- declare function escapeForRegExp(s: string): string;
1028
+ export declare function escapeForRegExp(s: string): string;
1030
1029
  //#endregion
1031
1030
  //#region connect-utils/vite-plugins/ph-config.d.ts
1032
- type PhConfigPluginOptions = {
1031
+ export type PhConfigPluginOptions = {
1033
1032
  packages: PowerhousePackage[];
1034
1033
  projectRoot?: string;
1035
1034
  connect?: PHConnectRuntimeConfig;
@@ -1047,7 +1046,7 @@ type PhConfigPluginOptions = {
1047
1046
  */
1048
1047
  cliConnectOverride?: PHConnectRuntimeConfig;
1049
1048
  };
1050
- declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
1049
+ export declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
1051
1050
  //#endregion
1052
1051
  //#region connect-utils/vite-plugins/theme-boot.d.ts
1053
1052
  /**
@@ -1055,19 +1054,21 @@ declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
1055
1054
  * ph-clint connect proxy) and this plugin both check it, so the script is
1056
1055
  * applied exactly once no matter which layer runs first.
1057
1056
  */
1058
- declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
1057
+ export declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
1059
1058
  /**
1060
1059
  * Injects the theme boot script at the top of `<head>` of every emitted
1061
1060
  * index.html, so built Connect apps render the stored theme from first paint
1062
1061
  * without depending on a serve-time injector.
1063
1062
  */
1064
- declare function connectThemeBootPlugin(): Plugin;
1063
+ export declare function connectThemeBootPlugin(): Plugin;
1065
1064
  //#endregion
1066
1065
  //#region connect-utils/vite-plugins/vendor-import-map.d.ts
1067
- type VendorImportMapOptions = {
1068
- /** bare specifier -> URL (already base-prefixed by the caller). */imports: Record<string, string>;
1066
+ export type VendorImportMapOptions = {
1067
+ /** bare specifier -> URL (already base-prefixed by the caller). */
1068
+ imports: Record<string, string>;
1069
1069
  };
1070
- declare function vendorImportMapPlugin(options: VendorImportMapOptions): Plugin;
1070
+ export declare function vendorImportMapPlugin(options: VendorImportMapOptions): Plugin;
1071
1071
  //#endregion
1072
- export { BUILD_HASH_FILE, BuildHashInput, ConnectBuildOptions, ConnectCommonOptions, ConnectPreviewOptions, ConnectStudioOptions, DEFAULT_CONNECT_OUTDIR, DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, EXTERNAL_PACKAGES_IMPORT, IConnectOptions, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, PH_DIR_NAME, PhConfigPluginOptions, PrebuiltVendor, RUNTIME_CONFIG_SCHEMA_ID, RUNTIME_CONFIG_SCHEMA_URL, THEME_BOOT_MARKER, VENDOR_EXTERNAL, VENDOR_URL_PREFIX, VendorImportMapOptions, VendorPrebuildOptions, ViteDevOptions, appendToHtmlHead, backupIndexHtml, buildHashFromBuildOptions, computeBuildHash, connectBuildHashPlugin, connectDynamicBasePlugin, connectThemeBootPlugin, copyConnect, ensureNodeVersion, escapeForRegExp, getConnectBaseViteConfig, getConnectHtmlTags, makeImportScriptFromPackages, missingVendorEntries, phConfigPlugin, prebuildConnectVendor, prependToHtmlHead, readJsonFile, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolvePackage, resolveViteConfigPath, runShellScriptPlugin, runTsc, runtimeConfigSchema, stripVersionFromPackage, vendorImportMapPlugin, withVendorBase };
1072
+ export { DYNAMIC_BASE_PLACEHOLDER };
1073
+ export {};
1073
1074
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../connect-utils/constants.ts","../connect-utils/vite-plugins/build-hash.ts","../connect-utils/externalize-vendor.ts","../connect-utils/types.ts","../connect-utils/helpers.ts","../connect-utils/runtime-config-schema.ts","../connect-utils/vite-config.ts","../connect-utils/vite-plugins/dynamic-base.ts","../connect-utils/vite-plugins/ph-config.ts","../connect-utils/vite-plugins/theme-boot.ts","../connect-utils/vite-plugins/vendor-import-map.ts"],"mappings":";;;;;;cAAa,wBAAA;AAAA,cACA,kBAAA;AAAA,cACA,gBAAA;AAAA,cACA,WAAA;;;;cCGA,eAAA;AAAA,UAEI,cAAA;;EAEf,eAAA;EDVW;ECYX,gBAAA;;;EAGA,qBAAA;EDdW;ECgBX,aAAA;;EAEA,QAAA;EDlB6B;ECoB7B,eAAA;EDnB2B;ECqB3B,cAAA;EDrB2B;ECuB3B,kBAAA;AAAA;;;;;;;;AAnBF;iBA8BgB,gBAAA,CAAiB,KAAA,EAAO,cAAA;AAAA,iBAyCxB,yBAAA,CAA0B,OAAA;EACxC,OAAA;EACA,QAAA;EACA,QAAA,EAAU,aAAA;IACR,WAAA;IACA,OAAA;IACA,QAAA;EAAA;EAEF,eAAA;EACA,cAAA;EACA,kBAAA;AAAA;;;;;;AAnDF;iBAyEgB,sBAAA,CAAuB,SAAA,WAAoB,MAAA;;;UC3D1C,qBAAA;;EAEf,OAAA;;EAEA,OAAA;;EAEA,QAAA;EFxDmC;EE0DnC,SAAA;EF1DmC;EE4DnC,QAAA;IAAa,OAAA;EAAA;;;;AF1Df;;;;;AACA;EEmEE,IAAA;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCsBG,kBAAA,CACd,OAAA;EACE,WAAA;EACA,QAAA,GAAW,iBAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiJC,wBAAA,CAAyB,OAAA,EAAS,eAAA,GAAe,YAAA;;;ANhMjE;;;;;AACA;;;;;;;;ACGA;;;;;AAEA;;;;;;;;;;ADNA,iBOiFgB,wBAAA,CACd,OAAA;EAAW,SAAA;EAAqB,iBAAA;AAAA,IAC/B,MAAA;AAAA,iBAuDa,eAAA,CAAgB,CAAA;;;KChIpB,qBAAA;EACV,QAAA,EAAU,iBAAA;EACV,WAAA;EACA,OAAA,GAAU,sBAAA;ERfyB;;;;AACrC;;EQqBE,kBAAA;ERrB6B;;AAC/B;;;EQ0BE,kBAAA,GAAqB,sBAAA;AAAA;AAAA,iBAsBP,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,MAAA;;;;;;;;cC3CnD,iBAAA;;;;;ATNb;iBS6BgB,sBAAA,CAAA,GAA0B,MAAA;;;KCnB9B,sBAAA;qEAEV,OAAA,EAAS,MAAA;AAAA;AAAA,iBA4BK,qBAAA,CAAsB,OAAA,EAAS,sBAAA,GAAyB,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../connect-utils/constants.ts","../connect-utils/vite-plugins/build-hash.ts","../connect-utils/externalize-vendor.ts","../connect-utils/types.ts","../connect-utils/helpers.ts","../connect-utils/runtime-config-schema.ts","../connect-utils/vite-config.ts","../connect-utils/vite-plugins/dynamic-base.ts","../connect-utils/vite-plugins/ph-config.ts","../connect-utils/vite-plugins/theme-boot.ts","../connect-utils/vite-plugins/vendor-import-map.ts"],"mappings":";;;;;qBAAa;qBACA;qBACA;qBACA;;;;qBCGA;iBAEI;;EAEf;;EAEA;;;EAGA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;wBAWc,iBAAiB,OAAO;wBAyCxB,0BAA0B;EACxC;EACA;EACA,UAAU;IACR;IACA;IACA;;EAEF;EACA;EACA;;;;;;;;wBAsBc,uBAAuB,oBAAoB;;;iBC3D1C;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;IAAa;;;;;;;;;;;EAUb;;EAEA;;;;;;;qBAQW;;;;;;qBAcA;iBAYI;EACf;;EAEA,SAAS;;EAET,UAAU;;;qBAIC;;;;;;wBAWS,sBACpB,SAAS,wBACR,QAAQ;;;;;wBAsYK,qBACd,mBACA,SAAS;EACN;EAAc;;;;;;;;;;;;wBAoBH,eACd,SAAS,wBACT,eACC;;;YC5hBS;EACV;EACA;EACA;EACA,mBAAmB;EACnB;;;;;;;;;;;;EAYA,qBAAqB;;;;;;EAMrB;EAGA;EAIA;;;;;;;EAOA;IACE,SAAS;IACT,UAAU;;;YAIF;EAEV;EAEA;EAEA;EAEA;EAEA;EAEA;EAEA;EAEA;;YAGU,iBAAiB,KAC3B;EAEI;;YAEM,uBAAuB;EACjC,mBAAmB;EACnB;EACA;;YAGU,sBAAsB;EAEhC;;YAGU,wBAAwB,uBAClC,KAAK;EAEH;EACA;EACA;;;;qBC5ES;wBAEG,sBACd,SAAS,KAAK;wBAMA,eAAe,qBAAqB;wBAMpC,0BAA0B,gBAAoB;;;;wBAiB9C,qBAAqB;wBASrB,wBAAwB;;;;wBAWxB,YAAY,oBAAoB;;;;;;wBAiBhC,gBAAgB,iBAAiB;wBAWjC,sBAAs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AMJ;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;WAMG;;aAEH;aACA;;;;WAMG;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;WAMG;;aAEH;aACA;;;;WAKG;;aAEH;aACA;;;;wBA6DQ,yBAAyB,SAAS,kBAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBC/GjD,yBACd;EAAW;EAAqB;IAC/B;wBAuDa,gBAAgB;;;YChIpB;EACV,UAAU;EACV;EACA,UAAU;;;;;;;EAOV;;;;;;EAMA,qBAAqB;;wBAsBP,eAAe,SAAS,wBAAwB;;;;;;;;qBC3CnD;;;;;;wBAuBG,0BAA0B;;;YCnB9B;;EAEV,SAAS;;wBA4BK,sBAAsB,SAAS,yBAAyB"}
package/dist/index.mjs CHANGED
@@ -44,7 +44,8 @@ function computeBuildHash(input) {
44
44
  */
45
45
  function readConnectVersion(projectRoot) {
46
46
  try {
47
- let dir = dirname(createRequire(join(projectRoot, "package.json")).resolve("@powerhousedao/connect", { paths: [projectRoot] }));
47
+ const entry = createRequire(join(projectRoot, "package.json")).resolve("@powerhousedao/connect", { paths: [projectRoot] });
48
+ let dir = dirname(entry);
48
49
  for (;;) {
49
50
  try {
50
51
  const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
@@ -98,7 +99,8 @@ function connectBuildHashPlugin(buildHash) {
98
99
  const RUNTIME_GLOBAL = "globalThis.__PH_DYNAMIC_BASE__";
99
100
  const BASE_EXPR = `(${RUNTIME_GLOBAL}||"/")`;
100
101
  function workerPrelude(stripPrefix) {
101
- return `${RUNTIME_GLOBAL}=self.location.pathname.replace(/${escapeForRegExp(stripPrefix).replace(/\//g, "\\/")}assets\\/[^/]*$/,"");\n`;
102
+ const prefix = escapeForRegExp(stripPrefix).replace(/\//g, "\\/");
103
+ return `${RUNTIME_GLOBAL}=self.location.pathname.replace(/${prefix}assets\\/[^/]*$/,"");\n`;
102
104
  }
103
105
  const PLACEHOLDER_LITERAL = new RegExp(`(["'\`])${escapeForRegExp(DYNAMIC_BASE_PLACEHOLDER)}((?:(?!\\1)[^$])*)\\1`, "g");
104
106
  /**
@@ -314,7 +316,8 @@ function resolveDepVersions(dirname$2, specs) {
314
316
  version = String(meta.version ?? "unknown");
315
317
  } catch {
316
318
  try {
317
- let dir = dirname(req.resolve(spec));
319
+ const entry = req.resolve(spec);
320
+ let dir = dirname(entry);
318
321
  for (let depth = 0; depth < 8; depth++) {
319
322
  if (existsSync(join(dir, "package.json"))) {
320
323
  const meta = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
@@ -345,7 +348,7 @@ function sameSet(a, b) {
345
348
  const s = new Set(a);
346
349
  return b.every((x) => s.has(x));
347
350
  }
348
- const LOCK_STALE_MS = 5 * 6e4;
351
+ const LOCK_STALE_MS = 3e5;
349
352
  const LOCK_HEARTBEAT_MS = 6e4;
350
353
  const ownerFile = (lockDir) => join(lockDir, "owner");
351
354
  function lockIsStale(lockDir) {
@@ -487,7 +490,8 @@ function expandIncludeSubpaths(dirname, include) {
487
490
  function missingVendorEntries(vendorDir, imports) {
488
491
  const prefix = VENDOR_URL_PREFIX;
489
492
  return Object.entries(imports).filter(([, url]) => {
490
- return !existsSync(join(vendorDir, url.startsWith(prefix) ? url.slice(12) : url));
493
+ const rel = url.startsWith(prefix) ? url.slice(12) : url;
494
+ return !existsSync(join(vendorDir, rel));
491
495
  }).map(([spec, url]) => ({
492
496
  spec,
493
497
  url
@@ -764,7 +768,8 @@ function resolveConnectPackageJson(root = process.cwd()) {
764
768
  */
765
769
  function resolveConnectBundle(root = process.cwd()) {
766
770
  const connectIndexPath = resolvePackage("@powerhousedao/connect", root);
767
- return join(connectIndexPath.substring(0, connectIndexPath.indexOf("connect") + 7), "dist/");
771
+ const connectRootPath = connectIndexPath.substring(0, connectIndexPath.indexOf("connect") + 7);
772
+ return join(connectRootPath, "dist/");
768
773
  }
769
774
  function resolveConnectPublicDir(root = process.cwd()) {
770
775
  const connectIconPath = resolvePackage("@powerhousedao/connect/public/icon.ico", root);
@@ -1111,7 +1116,7 @@ async function devReactImportmapPlugin(projectRoot = process.cwd()) {
1111
1116
  REACT_DEPS.forEach((d) => include.add(d));
1112
1117
  if (vendorActive) {
1113
1118
  HEAVY_LIBS.forEach((d) => include.delete(d));
1114
- cfg.optimizeDeps.exclude = [...new Set([...cfg.optimizeDeps.exclude ?? [], ...HEAVY_LIBS])];
1119
+ cfg.optimizeDeps.exclude = [.../* @__PURE__ */ new Set([...cfg.optimizeDeps.exclude ?? [], ...HEAVY_LIBS])];
1115
1120
  }
1116
1121
  cfg.optimizeDeps.include = [...include];
1117
1122
  },
@@ -1227,7 +1232,7 @@ function connectFaviconPlugin(opts = {}) {
1227
1232
  res.end(readFileSync(resolved.id));
1228
1233
  }).catch(() => next());
1229
1234
  };
1230
- const paths = new Set([faviconRoute, "/icon.ico"]);
1235
+ const paths = /* @__PURE__ */ new Set([faviconRoute, "/icon.ico"]);
1231
1236
  for (const path of paths) server.middlewares.use(path, handler);
1232
1237
  },
1233
1238
  async generateBundle(_options, bundle) {
@@ -1267,13 +1272,15 @@ function readProjectPackageInfo(projectRoot) {
1267
1272
  }
1268
1273
  function phConfigPlugin(options) {
1269
1274
  const localPackage = readProjectPackageInfo(options.projectRoot ?? process.cwd());
1270
- const withDefaults = deepMerge(DEFAULT_CONNECT_CONFIG, options.connect ?? {});
1275
+ const sourceConnect = options.connect ?? {};
1276
+ const withDefaults = deepMerge(DEFAULT_CONNECT_CONFIG, sourceConnect);
1271
1277
  const mergedConnect = options.cliConnectOverride ? deepMerge(withDefaults, options.cliConnectOverride) : withDefaults;
1272
- const runtimeConfig = buildRuntimeConfig({
1278
+ const source = {
1273
1279
  packages: options.packages,
1274
1280
  packageRegistryUrl: options.packageRegistryUrl,
1275
1281
  connect: mergedConnect
1276
- }, localPackage);
1282
+ };
1283
+ const runtimeConfig = buildRuntimeConfig(source, localPackage);
1277
1284
  const content = JSON.stringify({
1278
1285
  $schema: RUNTIME_CONFIG_SCHEMA_URL,
1279
1286
  ...runtimeConfig
@@ -1326,11 +1333,13 @@ function toPwaContribution(manifest, fallbackLabel, onWarn) {
1326
1333
  if (!isPlainObject(manifest)) return null;
1327
1334
  const label = typeof manifest.name === "string" && manifest.name ? manifest.name : fallbackLabel;
1328
1335
  let config = {};
1329
- if (manifest.pwa !== void 0) if (!isPlainObject(manifest.pwa)) onWarn(`PWA config: ${label} declares a non-object 'pwa' field in its manifest; ignored.`);
1330
- else {
1331
- const parsed = PwaConfigSchema.safeParse(manifest.pwa);
1332
- if (!parsed.success) onWarn(`PWA config: ${label}'s pwa fragment is invalid; ignored. ${formatZodIssues(parsed.error)}`);
1333
- else config = parsed.data;
1336
+ if (manifest.pwa !== void 0) {
1337
+ if (!isPlainObject(manifest.pwa)) onWarn(`PWA config: ${label} declares a non-object 'pwa' field in its manifest; ignored.`);
1338
+ else {
1339
+ const parsed = PwaConfigSchema.safeParse(manifest.pwa);
1340
+ if (!parsed.success) onWarn(`PWA config: ${label}'s pwa fragment is invalid; ignored. ${formatZodIssues(parsed.error)}`);
1341
+ else config = parsed.data;
1342
+ }
1334
1343
  }
1335
1344
  config = withInferredCategory(config, manifest.category);
1336
1345
  if (Object.keys(config).length === 0) return null;
@@ -1439,7 +1448,8 @@ function collectProjectPwaContribution(options) {
1439
1448
  }
1440
1449
  if (!isPlainObject(manifest)) return null;
1441
1450
  const label = typeof manifest.name === "string" && manifest.name ? manifest.name : "project manifest";
1442
- const withCategory = withInferredCategory(manifest.pwa === void 0 ? {} : parsePwaConfigStrict(manifest.pwa, `pwa in ${manifestPath}`), manifest.category);
1451
+ const config = manifest.pwa === void 0 ? {} : parsePwaConfigStrict(manifest.pwa, `pwa in ${manifestPath}`);
1452
+ const withCategory = withInferredCategory(config, manifest.category);
1443
1453
  if (Object.keys(withCategory).length === 0) return null;
1444
1454
  return {
1445
1455
  source: label,
@@ -1580,7 +1590,7 @@ const BASE_MANIFEST = {
1580
1590
  * declarative runtimeCaching option.
1581
1591
  */
1582
1592
  const BASE_PRECACHE = {
1583
- maximumFileSizeToCacheInBytes: 16 * 1024 * 1024,
1593
+ maximumFileSizeToCacheInBytes: 16777216,
1584
1594
  globPatterns: ["**/*.{js,css,html,wasm,data,ico,png,svg,webp,woff,woff2}"],
1585
1595
  globIgnores: [
1586
1596
  "**/powerhouse.config.json",
@@ -2047,7 +2057,8 @@ function getLocalPackageNamesFromPowerhouseConfig({ packages }) {
2047
2057
  }
2048
2058
  function getConnectBaseViteConfig(options) {
2049
2059
  const mode = options.mode;
2050
- const fileEnv = loadEnv(mode, options.envDir ?? options.dirname, "PH_");
2060
+ const envDir = options.envDir ?? options.dirname;
2061
+ const fileEnv = loadEnv(mode, envDir, "PH_");
2051
2062
  const env = loadConnectEnv({
2052
2063
  processEnv: process.env,
2053
2064
  fileEnv
@@ -2119,9 +2130,10 @@ function getConnectBaseViteConfig(options) {
2119
2130
  });
2120
2131
  const projectContribution = collectProjectPwaContribution({ projectRoot: options.dirname });
2121
2132
  if (projectContribution) contributions.push(projectContribution);
2133
+ const mergedPwa = mergePwaConfig(contributions, projectPwa, pwaWarn);
2122
2134
  return connectPwaPlugins({
2123
2135
  offlineEnabled,
2124
- pwa: mergePwaConfig(contributions, projectPwa, pwaWarn)
2136
+ pwa: mergedPwa
2125
2137
  });
2126
2138
  })();
2127
2139
  const reactExternal = [