@powerhousedao/builder-tools 6.0.0-dev.104 → 6.0.0-dev.106

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.
Files changed (41) hide show
  1. package/dist/index.d.mts +193 -0
  2. package/dist/index.d.mts.map +1 -0
  3. package/dist/index.mjs +696 -0
  4. package/dist/index.mjs.map +1 -0
  5. package/package.json +20 -17
  6. package/dist/bundle.d.ts +0 -2
  7. package/dist/bundle.d.ts.map +0 -1
  8. package/dist/connect-utils/build.d.ts +0 -3
  9. package/dist/connect-utils/build.d.ts.map +0 -1
  10. package/dist/connect-utils/constants.d.ts +0 -5
  11. package/dist/connect-utils/constants.d.ts.map +0 -1
  12. package/dist/connect-utils/helpers.d.ts +0 -48
  13. package/dist/connect-utils/helpers.d.ts.map +0 -1
  14. package/dist/connect-utils/index.d.ts +0 -15
  15. package/dist/connect-utils/index.d.ts.map +0 -1
  16. package/dist/connect-utils/preview.d.ts +0 -3
  17. package/dist/connect-utils/preview.d.ts.map +0 -1
  18. package/dist/connect-utils/studio.d.ts +0 -7
  19. package/dist/connect-utils/studio.d.ts.map +0 -1
  20. package/dist/connect-utils/types.d.ts +0 -37
  21. package/dist/connect-utils/types.d.ts.map +0 -1
  22. package/dist/connect-utils/vite-config.d.ts +0 -61
  23. package/dist/connect-utils/vite-config.d.ts.map +0 -1
  24. package/dist/connect-utils/vite-plugins/base.d.ts +0 -10
  25. package/dist/connect-utils/vite-plugins/base.d.ts.map +0 -1
  26. package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts +0 -3
  27. package/dist/connect-utils/vite-plugins/document-models-hmr.d.ts.map +0 -1
  28. package/dist/connect-utils/vite-plugins/editors-hmr.d.ts +0 -3
  29. package/dist/connect-utils/vite-plugins/editors-hmr.d.ts.map +0 -1
  30. package/dist/connect-utils/vite-plugins/external-packages.d.ts +0 -3
  31. package/dist/connect-utils/vite-plugins/external-packages.d.ts.map +0 -1
  32. package/dist/connect-utils/vite-plugins/importmap.d.ts +0 -23
  33. package/dist/connect-utils/vite-plugins/importmap.d.ts.map +0 -1
  34. package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts +0 -2
  35. package/dist/connect-utils/vite-plugins/ph-external-packages.d.ts.map +0 -1
  36. package/dist/connect-utils/vite-plugins/studio.d.ts +0 -3
  37. package/dist/connect-utils/vite-plugins/studio.d.ts.map +0 -1
  38. package/dist/index.d.ts +0 -2
  39. package/dist/index.d.ts.map +0 -1
  40. package/dist/index.js +0 -111943
  41. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,193 @@
1
+ import { CommonServerOptions, InlineConfig, Plugin, PluginOption } from "vite";
2
+ import { Package } from "resolve.exports";
3
+ import { PowerhouseConfig } from "@powerhousedao/config";
4
+
5
+ //#region connect-utils/constants.d.ts
6
+ declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
7
+ declare const IMPORT_SCRIPT_FILE = "external-packages.js";
8
+ declare const LOCAL_PACKAGE_ID = "ph:local-package";
9
+ declare const PH_DIR_NAME = ".ph";
10
+ //#endregion
11
+ //#region connect-utils/types.d.ts
12
+ type IConnectOptions = {
13
+ mode: string;
14
+ dirname: string;
15
+ envDir?: string;
16
+ powerhouseConfig?: PowerhouseConfig;
17
+ watchTimeout?: number;
18
+ };
19
+ type ConnectCommonOptions = {
20
+ base?: string;
21
+ mode?: string;
22
+ configFile?: string;
23
+ projectRoot?: string;
24
+ viteConfigFile?: string;
25
+ disableLocalPackage?: boolean;
26
+ defaultDrivesUrl?: string[];
27
+ drivesPreserveStrategy?: "preserve-all" | "preserve-by-url-and-detach";
28
+ };
29
+ type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
30
+ force?: boolean;
31
+ };
32
+ type ConnectStudioOptions = ConnectCommonOptions & {
33
+ devServerOptions?: ViteDevOptions;
34
+ printUrls?: boolean;
35
+ bindCLIShortcuts?: boolean;
36
+ };
37
+ type ConnectBuildOptions = ConnectCommonOptions & {
38
+ outDir?: string;
39
+ };
40
+ type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
41
+ outDir?: string;
42
+ printUrls?: boolean;
43
+ bindCLIShortcuts?: boolean;
44
+ };
45
+ //#endregion
46
+ //#region connect-utils/helpers.d.ts
47
+ declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
48
+ declare function commonConnectOptionsToEnv(options: ConnectCommonOptions): void;
49
+ declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
50
+ declare function resolvePackage(packageName: string, root?: string): string;
51
+ declare function resolveConnectPackageJson(root?: string): JSON | null;
52
+ /**
53
+ * Finds the dist dir of Connect on the local machine
54
+ */
55
+ declare function resolveConnectBundle(root?: string): string;
56
+ declare function resolveConnectPublicDir(root?: string): string;
57
+ /**
58
+ * Copies the Connect dist dir to the target path
59
+ */
60
+ declare function copyConnect(sourcePath: string, targetPath: string): void;
61
+ /**
62
+ * Backs up the index.html file
63
+ *
64
+ * Needed when running the Connect Studio dev server on Windows
65
+ */
66
+ declare function backupIndexHtml(appPath: string, restore?: boolean): void;
67
+ declare function removeBase64EnvValues(appPath: string): void;
68
+ declare function readJsonFile(filePath: string): PowerhouseConfig | null;
69
+ /**
70
+ * 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.
71
+ */
72
+ declare function makeImportScriptFromPackages(args: {
73
+ packages: string[];
74
+ importStyles?: boolean;
75
+ localJsPath?: string;
76
+ localCssPath?: string;
77
+ }): string;
78
+ declare function ensureNodeVersion(minVersion?: string): void;
79
+ declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
80
+ /**
81
+ * Appends the contents to the <head> tag of the index.html file
82
+ */
83
+ declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
84
+ /**
85
+ * Prepends the contents to the <head> tag of the index.html file
86
+ */
87
+ declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
88
+ declare function runTsc(outDir: string): void;
89
+ declare function stripVersionFromPackage(packageName: string): string;
90
+ //#endregion
91
+ //#region connect-utils/vite-config.d.ts
92
+ declare const connectClientConfig: {
93
+ readonly meta: readonly [{
94
+ readonly tag: "meta";
95
+ readonly attrs: {
96
+ readonly "http-equiv": "Content-Security-Policy";
97
+ readonly content: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://esm.sh http://localhost:8080; object-src 'none'; base-uri 'self';";
98
+ };
99
+ }, {
100
+ readonly tag: "meta";
101
+ readonly attrs: {
102
+ readonly property: "og:title";
103
+ readonly content: "Connect";
104
+ };
105
+ }, {
106
+ readonly tag: "meta";
107
+ readonly attrs: {
108
+ readonly property: "og:type";
109
+ readonly content: "website";
110
+ };
111
+ }, {
112
+ readonly tag: "meta";
113
+ readonly attrs: {
114
+ readonly property: "og:url";
115
+ readonly content: "https://apps.powerhouse.io/powerhouse/connect/";
116
+ };
117
+ }, {
118
+ readonly tag: "meta";
119
+ readonly attrs: {
120
+ readonly property: "og:description";
121
+ 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.";
122
+ };
123
+ }, {
124
+ readonly tag: "meta";
125
+ readonly attrs: {
126
+ readonly property: "og:image";
127
+ readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
128
+ };
129
+ }, {
130
+ readonly tag: "meta";
131
+ readonly attrs: {
132
+ readonly name: "twitter:card";
133
+ readonly content: "summary_large_image";
134
+ };
135
+ }, {
136
+ readonly tag: "meta";
137
+ readonly attrs: {
138
+ readonly name: "twitter:image";
139
+ readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
140
+ };
141
+ }, {
142
+ readonly tag: "meta";
143
+ readonly attrs: {
144
+ readonly name: "twitter:title";
145
+ readonly content: "Connect";
146
+ };
147
+ }, {
148
+ readonly tag: "meta";
149
+ readonly attrs: {
150
+ readonly name: "twitter:description";
151
+ 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.";
152
+ };
153
+ }];
154
+ };
155
+ declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
156
+ //#endregion
157
+ //#region connect-utils/vite-plugins/base.d.ts
158
+ declare const externalIds: RegExp[];
159
+ declare function viteIgnoreStaticImport(_importKeys: (string | RegExp | false | undefined)[]): Plugin;
160
+ declare function viteReplaceImports(imports: Record<string, string>): PluginOption;
161
+ declare function findPackageJson(packageName: string): Promise<{
162
+ packageJson: Package;
163
+ path: string;
164
+ }>;
165
+ //#endregion
166
+ //#region connect-utils/vite-plugins/importmap.d.ts
167
+ type Provider = "node_modules" | "esm.sh";
168
+ type Dependency = {
169
+ name: string;
170
+ version?: string;
171
+ provider: Provider;
172
+ dependencies?: string[];
173
+ };
174
+ /**
175
+ * Vite plugin to bundle or copy dependencies and inject an import map into `index.html`.
176
+ *
177
+ * @param {string} outputDir - The directory where the modules should be placed.
178
+ * @param {(string | { name: string; provider: string })[]} dependencies -
179
+ * List of dependencies to process. Can be:
180
+ * - A string (dependency is copied as is).
181
+ * - An object `{ name, provide }` where:
182
+ * - `name` (string): The module name.
183
+ * - `provider` (string): Where to retrieve the module bundle. Defaults to node_modules.
184
+ *
185
+ * @returns {Plugin} A Vite plugin that processes dependencies and injects an import map.
186
+ */
187
+ declare function generateImportMapPlugin(outputDir: string, dependencies: (string | Dependency)[]): PluginOption[];
188
+ //#endregion
189
+ //#region connect-utils/vite-plugins/studio.d.ts
190
+ declare function viteConnectDevStudioPlugin(enabled: boolean | undefined, connectPath: string, env?: Record<string, string>): PluginOption[];
191
+ //#endregion
192
+ export { ConnectBuildOptions, ConnectCommonOptions, ConnectPreviewOptions, ConnectStudioOptions, DEFAULT_CONNECT_OUTDIR, Dependency, EXTERNAL_PACKAGES_IMPORT, IConnectOptions, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, PH_DIR_NAME, Provider, ViteDevOptions, appendToHtmlHead, backupIndexHtml, commonConnectOptionsToEnv, connectClientConfig, copyConnect, ensureNodeVersion, externalIds, findPackageJson, generateImportMapPlugin, getConnectBaseViteConfig, makeImportScriptFromPackages, prependToHtmlHead, readJsonFile, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolvePackage, resolveViteConfigPath, runShellScriptPlugin, runTsc, stripVersionFromPackage, viteConnectDevStudioPlugin, viteIgnoreStaticImport, viteReplaceImports };
193
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../connect-utils/constants.ts","../connect-utils/types.ts","../connect-utils/helpers.ts","../connect-utils/vite-config.ts","../connect-utils/vite-plugins/base.ts","../connect-utils/vite-plugins/importmap.ts","../connect-utils/vite-plugins/studio.ts"],"mappings":";;;;;cAAa,wBAAA;AAAA,cACA,kBAAA;AAAA,cACA,gBAAA;AAAA,cACA,WAAA;;;KCAD,eAAA;EACV,IAAA;EACA,OAAA;EACA,MAAA;EACA,gBAAA,GAAmB,gBAAA;EACnB,YAAA;AAAA;AAAA,KAGU,oBAAA;EAEV,IAAA;EAEA,IAAA;EAEA,UAAA;EAEA,WAAA;EAEA,cAAA;EAEA,mBAAA;EAEA,gBAAA;EAEA,sBAAA;AAAA;AAAA,KAGU,cAAA,GAAiB,IAAA,CAC3B,mBAAA;EAEI,KAAA;AAAA;AAAA,KAEM,oBAAA,GAAuB,oBAAA;EACjC,gBAAA,GAAmB,cAAA;EACnB,SAAA;EACA,gBAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,oBAAA;EAEhC,MAAA;AAAA;AAAA,KAGU,qBAAA,GAAwB,oBAAA,GAClC,IAAA,CAAK,cAAA;EAEH,MAAA;EACA,SAAA;EACA,gBAAA;AAAA;;;cCv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