@hyperfrontend/features 0.1.0 → 0.2.0

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 (159) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/_dependencies/@hyperfrontend/builder/bundle/dependencies/index.cjs.js +1 -0
  3. package/_dependencies/@hyperfrontend/builder/bundle/dependencies/index.esm.js +1 -0
  4. package/_dependencies/@hyperfrontend/builder/bundle/dependencies/worker/index.cjs.js +1 -0
  5. package/_dependencies/@hyperfrontend/builder/bundle/dependencies/worker/index.esm.js +1 -0
  6. package/_dependencies/@hyperfrontend/builder/bundle/index.cjs.js +12 -10
  7. package/_dependencies/@hyperfrontend/builder/bundle/index.esm.js +14 -12
  8. package/_dependencies/@hyperfrontend/builder/bundle/rollup/index.cjs.js +2 -0
  9. package/_dependencies/@hyperfrontend/builder/bundle/rollup/index.esm.js +2 -0
  10. package/_dependencies/@hyperfrontend/builder/bundle/rollup/worker/index.cjs.js +2 -0
  11. package/_dependencies/@hyperfrontend/builder/bundle/rollup/worker/index.esm.js +2 -0
  12. package/_dependencies/@hyperfrontend/builder/index.cjs.js +87 -53
  13. package/_dependencies/@hyperfrontend/builder/index.esm.js +89 -55
  14. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js +4 -0
  15. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js +3 -1
  16. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.cjs.js +10 -0
  17. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.esm.js +6 -0
  18. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js +5 -0
  19. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js +5 -1
  20. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js +2 -2
  21. package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.esm.js +2 -2
  22. package/_dependencies/@hyperfrontend/network-protocol/browser/channel/index.cjs.js +5 -19
  23. package/_dependencies/@hyperfrontend/network-protocol/browser/channel/index.esm.js +1 -15
  24. package/_dependencies/@hyperfrontend/network-protocol/browser/data/index.cjs.js +15 -23
  25. package/_dependencies/@hyperfrontend/network-protocol/browser/data/index.esm.js +7 -15
  26. package/_dependencies/@hyperfrontend/network-protocol/browser/packet/index.cjs.js +6 -14
  27. package/_dependencies/@hyperfrontend/network-protocol/browser/packet/index.esm.js +7 -15
  28. package/_dependencies/@hyperfrontend/network-protocol/browser/receiver/index.cjs.js +4 -18
  29. package/_dependencies/@hyperfrontend/network-protocol/browser/receiver/index.esm.js +1 -15
  30. package/_dependencies/@hyperfrontend/network-protocol/browser/sender/index.cjs.js +5 -19
  31. package/_dependencies/@hyperfrontend/network-protocol/browser/sender/index.esm.js +2 -16
  32. package/_dependencies/@hyperfrontend/network-protocol/browser/v1/index.cjs.js +16 -24
  33. package/_dependencies/@hyperfrontend/network-protocol/browser/v1/index.esm.js +7 -15
  34. package/_dependencies/@hyperfrontend/network-protocol/browser/v2/index.cjs.js +16 -24
  35. package/_dependencies/@hyperfrontend/network-protocol/browser/v2/index.esm.js +7 -15
  36. package/_dependencies/@hyperfrontend/network-protocol/node/channel/index.cjs.js +3 -17
  37. package/_dependencies/@hyperfrontend/network-protocol/node/channel/index.esm.js +1 -15
  38. package/_dependencies/@hyperfrontend/network-protocol/node/data/index.cjs.js +6 -14
  39. package/_dependencies/@hyperfrontend/network-protocol/node/data/index.esm.js +7 -15
  40. package/_dependencies/@hyperfrontend/network-protocol/node/packet/index.cjs.js +6 -14
  41. package/_dependencies/@hyperfrontend/network-protocol/node/packet/index.esm.js +7 -15
  42. package/_dependencies/@hyperfrontend/network-protocol/node/receiver/index.cjs.js +3 -17
  43. package/_dependencies/@hyperfrontend/network-protocol/node/receiver/index.esm.js +1 -15
  44. package/_dependencies/@hyperfrontend/network-protocol/node/sender/index.cjs.js +2 -16
  45. package/_dependencies/@hyperfrontend/network-protocol/node/sender/index.esm.js +2 -16
  46. package/_dependencies/@hyperfrontend/network-protocol/node/v1/index.cjs.js +6 -14
  47. package/_dependencies/@hyperfrontend/network-protocol/node/v1/index.esm.js +7 -15
  48. package/_dependencies/@hyperfrontend/network-protocol/node/v2/index.cjs.js +6 -14
  49. package/_dependencies/@hyperfrontend/network-protocol/node/v2/index.esm.js +7 -15
  50. package/_dependencies/@hyperfrontend/nexus/index.cjs.js +49 -19
  51. package/_dependencies/@hyperfrontend/nexus/index.esm.js +49 -19
  52. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js +62 -0
  53. package/_dependencies/@hyperfrontend/project-scope/core/fs/index.esm.js +60 -2
  54. package/_shared/generators/feature/generate-feature-module/index.esm.js +11 -6
  55. package/_shared/generators/metadata/generate-metadata/index.esm.js +1 -0
  56. package/_shared/shared/control/index.cjs.js +12 -2
  57. package/_shared/shared/control/index.esm.js +12 -2
  58. package/_shared/shared/request/index.cjs.js +91 -0
  59. package/_shared/shared/request/index.esm.js +88 -0
  60. package/_shared/shared/shutdown/index.esm.js +12 -0
  61. package/bin/hf.js +643 -70
  62. package/bundle/host/index.iife.js +290 -4041
  63. package/bundle/host/index.iife.min.js +1 -1
  64. package/bundle/host/index.umd.js +290 -4041
  65. package/bundle/host/index.umd.min.js +1 -1
  66. package/bundle/hostee/index.iife.js +215 -2893
  67. package/bundle/hostee/index.iife.min.js +1 -1
  68. package/bundle/hostee/index.umd.js +215 -2893
  69. package/bundle/hostee/index.umd.min.js +1 -1
  70. package/cli/args.d.ts +2 -0
  71. package/cli/args.d.ts.map +1 -1
  72. package/cli/commands/build.d.ts +8 -5
  73. package/cli/commands/build.d.ts.map +1 -1
  74. package/cli/commands/dev.d.ts +7 -2
  75. package/cli/commands/dev.d.ts.map +1 -1
  76. package/cli/config/resolve.d.ts +3 -1
  77. package/cli/config/resolve.d.ts.map +1 -1
  78. package/cli/index.cjs.js +643 -70
  79. package/cli/index.d.ts +21 -10
  80. package/cli/index.esm.js +591 -60
  81. package/cli/usage.d.ts +1 -1
  82. package/cli/usage.d.ts.map +1 -1
  83. package/generators/feature/generate-feature-module.d.ts.map +1 -1
  84. package/generators/index.cjs.js +435 -42
  85. package/generators/index.d.ts +9 -8
  86. package/generators/index.esm.js +404 -30
  87. package/generators/metadata/generate-metadata.d.ts +4 -4
  88. package/generators/metadata/generate-metadata.d.ts.map +1 -1
  89. package/generators/shell/connector-types.d.ts +19 -0
  90. package/generators/shell/connector-types.d.ts.map +1 -0
  91. package/generators/shell/generate-shell.d.ts +5 -4
  92. package/generators/shell/generate-shell.d.ts.map +1 -1
  93. package/generators/shell/schema-type.d.ts +20 -0
  94. package/generators/shell/schema-type.d.ts.map +1 -0
  95. package/generators/shell/source-literal.d.ts +28 -0
  96. package/generators/shell/source-literal.d.ts.map +1 -1
  97. package/host/create-shell.d.ts +4 -1
  98. package/host/create-shell.d.ts.map +1 -1
  99. package/host/display-modes/dialog.d.ts +1 -1
  100. package/host/display-modes/dialog.d.ts.map +1 -1
  101. package/host/display-modes/embedded.d.ts +1 -1
  102. package/host/display-modes/embedded.d.ts.map +1 -1
  103. package/host/index.cjs.js +150 -30
  104. package/host/index.d.ts +53 -38
  105. package/host/index.d.ts.map +1 -1
  106. package/host/index.esm.js +129 -9
  107. package/host/lifecycle.d.ts.map +1 -1
  108. package/host/plugins.d.ts +1 -34
  109. package/host/plugins.d.ts.map +1 -1
  110. package/host/types.d.ts +49 -0
  111. package/host/types.d.ts.map +1 -1
  112. package/hostee/index.cjs.js +54 -9
  113. package/hostee/index.d.ts +41 -1
  114. package/hostee/index.d.ts.map +1 -1
  115. package/hostee/index.esm.js +51 -6
  116. package/hostee/lifecycle.d.ts.map +1 -1
  117. package/hostee/types.d.ts +40 -0
  118. package/hostee/types.d.ts.map +1 -1
  119. package/index.cjs.js +32 -1
  120. package/index.d.ts +89 -3
  121. package/index.d.ts.map +1 -1
  122. package/index.esm.js +32 -1
  123. package/nx/executors/build/index.cjs.js +14975 -137
  124. package/nx/executors/build/index.esm.js +14935 -115
  125. package/nx/executors/serve/executor.d.ts.map +1 -1
  126. package/nx/executors/serve/index.cjs.js +6594 -80
  127. package/nx/executors/serve/index.esm.js +6529 -44
  128. package/nx/generators/feature/index.cjs.js +8751 -108
  129. package/nx/generators/feature/index.esm.js +8711 -81
  130. package/package.json +15 -5
  131. package/server/debug-ui/index.d.ts +2 -0
  132. package/server/debug-ui/index.d.ts.map +1 -0
  133. package/server/debug-ui/index.html +15 -0
  134. package/server/debug-ui/index.iife.js +427 -0
  135. package/server/debug-ui/index.iife.min.js +1 -0
  136. package/server/dev-server.d.ts.map +1 -1
  137. package/server/index.cjs.js +78 -10
  138. package/server/index.esm.js +78 -11
  139. package/server/module-dir.d.ts +17 -0
  140. package/server/module-dir.d.ts.map +1 -0
  141. package/server/module-dir.stub.d.ts +15 -0
  142. package/server/module-dir.stub.d.ts.map +1 -0
  143. package/shared/contract.d.ts +1 -1
  144. package/shared/contract.d.ts.map +1 -1
  145. package/shared/control.d.ts +4 -0
  146. package/shared/control.d.ts.map +1 -1
  147. package/shared/invert-contract.d.ts +20 -0
  148. package/shared/invert-contract.d.ts.map +1 -0
  149. package/shared/request.d.ts +68 -0
  150. package/shared/request.d.ts.map +1 -0
  151. package/{nx/shared → shared}/shutdown.d.ts +3 -2
  152. package/shared/shutdown.d.ts.map +1 -0
  153. package/shared/types.d.ts +72 -1
  154. package/shared/types.d.ts.map +1 -1
  155. package/_shared/nx/shared/context/index.cjs.js +0 -18
  156. package/_shared/nx/shared/context/index.esm.js +0 -16
  157. package/nx/shared/shutdown.d.ts.map +0 -1
  158. package/server/debug-ui/bootstrap.d.ts +0 -2
  159. package/server/debug-ui/bootstrap.d.ts.map +0 -1
package/cli/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ResolvedFeatureConfig, FeatureContract, SecurityProtocol } from '..';
2
- import { resolveDevConfig, startDevServer } from '../server';
2
+ import { resolveDevConfig, startDevServer, DevServerHandle } from '../server';
3
3
  import { createTree, commitChanges } from '../_dependencies/@hyperfrontend/project-scope/vfs/index.js';
4
4
 
5
5
  /**
@@ -30,6 +30,8 @@ interface CliFlags {
30
30
  readonly cwd?: string;
31
31
  /** Target entry file `init` wires the glue import into (`--entry`). */
32
32
  readonly entry?: string;
33
+ /** Acknowledge an explicit `--protocol none` build and produce an open connector (`--allow-open`). */
34
+ readonly allowOpen?: boolean;
33
35
  /** Suppress prompts and fail on any unresolved required key (`--ci`). */
34
36
  readonly ci: boolean;
35
37
  /** Suppress prompts, accepting defaults (`--yes`). */
@@ -104,6 +106,8 @@ interface ResolvedBuildBundle {
104
106
  readonly contract: FeatureContract;
105
107
  /** The resolved security envelope (`none` unless overridden). */
106
108
  readonly protocol: SecurityProtocol;
109
+ /** Whether the protocol came from a flag or the config file rather than the default. */
110
+ readonly protocolExplicit: boolean;
107
111
  /** Absolute path of the config file that was loaded, when one was found. */
108
112
  readonly sourcePath?: string;
109
113
  }
@@ -113,7 +117,7 @@ interface ResolvedBuildBundle {
113
117
  * replaces its whole top-level key (no deep merge).
114
118
  *
115
119
  * @param options - The working directory and parsed flags.
116
- * @returns The resolved config, loaded contract, protocol, and source path.
120
+ * @returns The resolved config, loaded contract, protocol (with its explicitness), and source path.
117
121
  * @throws {Error} When the config or contract is missing required keys or malformed.
118
122
  *
119
123
  * @example Resolving from a discovered config plus a flag override
@@ -125,9 +129,9 @@ declare function resolveBuildConfig(options: ResolveBuildConfigOptions): Promise
125
129
 
126
130
  /** Inputs handed to the builder for a single connector build. */
127
131
  interface BuildRunnerInput {
128
- /** Temp directory holding the generated connector sources. */
132
+ /** Staging directory (inside the consumer project) holding the generated connector sources. */
129
133
  readonly projectRoot: string;
130
- /** Workspace root the builder resolves against. */
134
+ /** The consumer project root, supplying `node_modules` and the TypeScript toolchain. */
131
135
  readonly workspaceRoot: string;
132
136
  /** Directory the bundled package is emitted into. */
133
137
  readonly outputPath: string;
@@ -153,9 +157,12 @@ interface RunBuildOptions extends BuildDeps {
153
157
  readonly stderr: NodeJS.WritableStream;
154
158
  }
155
159
  /**
156
- * Builds the connector: resolve config → generate the host connector into a temp
157
- * dir → bundle via the builder → pack a tarball into `--out`. A `v1`/`v2` security
158
- * protocol is required for production output, and the temp dir is always removed.
160
+ * Builds the connector: resolve config → generate the host connector into a
161
+ * hidden staging dir inside the project → bundle via the builder → pack a
162
+ * tarball into `--out`. A `v1`/`v2` security protocol is required for production
163
+ * output; an explicit `--protocol none` builds only when paired with
164
+ * `--allow-open`, acknowledging the open channel. The staging dir is always
165
+ * removed.
159
166
  *
160
167
  * @param options - Flags, working directory, output sinks, and injectable deps.
161
168
  * @returns The process exit code.
@@ -173,6 +180,8 @@ interface DevDeps {
173
180
  readonly resolveConfig?: typeof resolveDevConfig;
174
181
  /** Starts the resolved dev server. */
175
182
  readonly startServer?: typeof startDevServer;
183
+ /** Holds the command open while the servers run; receives the running handle and resolves once serving should end. Defaults to waiting for `SIGINT`/`SIGTERM`, then closing every server. */
184
+ readonly waitForClose?: (handle: DevServerHandle) => Promise<void>;
176
185
  }
177
186
  /** Inputs for a single `dev` invocation. */
178
187
  interface RunDevOptions extends DevDeps {
@@ -187,8 +196,10 @@ interface RunDevOptions extends DevDeps {
187
196
  }
188
197
  /**
189
198
  * Resolves the `hf-dev.config.*` through the shared tiered loader and starts the
190
- * dev server: one static server per app plus the debug UI. The returned promise
191
- * resolves once the servers are listening; the process stays alive serving them.
199
+ * dev server: one static server per app plus the debug UI. After printing the
200
+ * server URLs the returned promise stays pending while the servers run; it
201
+ * resolves with the success code once a shutdown signal (`SIGINT`/`SIGTERM`,
202
+ * e.g. Ctrl-C) arrives and every server has closed cleanly.
192
203
  *
193
204
  * @param options - Flags, working directory, output sinks, and injectable deps.
194
205
  * @returns The process exit code.
@@ -302,7 +313,7 @@ declare const EXIT_CANCELLED = 130;
302
313
  * Documents the three commands and the shared flag surface so the headless
303
314
  * (`--ci`) path is discoverable without reading the docs.
304
315
  */
305
- declare const USAGE = "@hyperfrontend/features \u2014 build, embed, and orchestrate micro-frontend features\n\nUsage: hf <command> [options]\n\nCommands:\n init Scaffold the feature glue module and wire it into your app\n build Generate the host connector, bundle it, and pack a tarball\n dev Resolve the dev-server config and start the debug UI\n\nOptions:\n --name <name> Feature name\n --version <version> Feature version\n --contract <path> Path to the *.contract.{json,ts,js} file\n --entry <path> Entry file to wire the glue import into (init)\n --url <url> URL the connector loads the feature from (build)\n --protocol <none|v1|v2> Security envelope enforced at build time\n --out <dir> Output directory for the built connector (build)\n --apps <path> Path to the dev-server apps array (dev)\n --port <number> Port the dev-server debug UI listens on (dev)\n --config <path> Path to the whole feature.config.* / hf-dev.config.* file\n --cwd <dir> Working-directory override\n --ci, --yes Run headlessly; error on any unresolved required key\n --dry-run Preview file changes without writing them\n -h, --help Print this help\n";
316
+ declare const USAGE = "@hyperfrontend/features \u2014 build, embed, and orchestrate micro-frontend features\n\nUsage: hf <command> [options]\n\nCommands:\n init Scaffold the feature glue module and wire it into your app\n build Generate the host connector, bundle it, and pack a tarball\n dev Start the app servers and debug UI, serving until Ctrl-C\n\nOptions:\n --name <name> Feature name\n --version <version> Feature version\n --contract <path> Path to the *.contract.{json,ts,js} file\n --entry <path> Entry file to wire the glue import into (init)\n --url <url> URL the connector loads the feature from (build)\n --protocol <none|v1|v2> Security envelope enforced at build time\n --allow-open Acknowledge an explicit '--protocol none' and build an open, unauthenticated connector (build)\n --out <dir> Output directory for the built connector (build)\n --apps <path> Path to the dev-server apps array (dev)\n --port <number> Port the dev-server debug UI listens on (dev)\n --config <path> Path to the whole feature.config.* / hf-dev.config.* file\n --cwd <dir> Working-directory override\n --ci, --yes Run headlessly; error on any unresolved required key\n --dry-run Preview file changes without writing them\n -h, --help Print this help\n";
306
317
 
307
318
  export { DEV_CONFIG_BASENAME, EXIT_CANCELLED, EXIT_ERROR, EXIT_OK, FEATURE_CONFIG_BASENAME, USAGE, discoverConfigFile, loadModuleFile, parseCliArgs, resolveBuildConfig, runBuild, runDev, runFeaturesCli, runInit };
308
319
  export type { BuildDeps, BuildRunnerInput, CliFlags, DevDeps, InitDeps, ParsedArgs, ResolveBuildConfigOptions, ResolvedBuildBundle, RunBuildOptions, RunDevOptions, RunFeaturesCliOptions, RunInitOptions };