@holo-js/kernel 0.3.7 → 0.3.10

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.ts CHANGED
@@ -43,6 +43,9 @@ type HoloPluginCliContributions = {
43
43
  type HoloPluginMigrationContributions = {
44
44
  readonly publish?: string;
45
45
  };
46
+ type HoloPluginProjectContributions = {
47
+ readonly prepare?: string;
48
+ };
46
49
  type HoloPluginFrameworkTsconfigKind = 'nuxt' | 'next' | 'sveltekit';
47
50
  type HoloPluginPackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
48
51
  type HoloPluginFrameworkContribution = {
@@ -90,6 +93,7 @@ type HoloPluginContributions = {
90
93
  readonly runtime?: HoloPluginRuntimeContributions;
91
94
  readonly cli?: HoloPluginCliContributions;
92
95
  readonly migrations?: HoloPluginMigrationContributions;
96
+ readonly project?: HoloPluginProjectContributions;
93
97
  };
94
98
  type HoloPluginDefinition = {
95
99
  readonly id: string;
@@ -169,6 +173,110 @@ declare const DEFAULT_HOLO_PROJECT_PATHS: Readonly<HoloProjectPaths>;
169
173
  declare function normalizeHoloProjectConfig(config?: HoloProjectConfig): NormalizedHoloProjectConfig;
170
174
  declare function defineHoloProject<TConfig extends HoloProjectConfig>(config: TConfig): NormalizedHoloProjectConfig & TConfig;
171
175
 
176
+ declare const HOLO_PROJECT_PREPARE_API_VERSION: 1;
177
+ type HoloProjectPrepareCommand = 'prepare' | 'dev' | 'build';
178
+ type HoloProjectPrepareChangeKind = 'created' | 'changed' | 'deleted';
179
+ interface HoloProjectPrepareChange {
180
+ readonly path: string;
181
+ readonly kind: HoloProjectPrepareChangeKind;
182
+ }
183
+ type HoloProjectPrepareRun = {
184
+ readonly kind: 'full';
185
+ readonly command: HoloProjectPrepareCommand;
186
+ readonly reason: 'initial' | 'explicit' | 'configuration-changed' | 'dependencies-changed' | 'plugin-requested';
187
+ } | {
188
+ readonly kind: 'incremental';
189
+ readonly command: 'dev';
190
+ readonly changes: readonly HoloProjectPrepareChange[];
191
+ };
192
+ interface HoloProjectPrepareFramework {
193
+ readonly id: string;
194
+ readonly displayName: string;
195
+ readonly adapterPackage: `@holo-js/${string}`;
196
+ readonly fluxPackage?: `@holo-js/${string}`;
197
+ readonly capabilities: {
198
+ readonly managedBroadcastAuthRoute: boolean;
199
+ };
200
+ }
201
+ interface HoloProjectPreparePlugin {
202
+ readonly id: string;
203
+ readonly name?: string;
204
+ readonly packageName: string;
205
+ readonly packageRoot: string;
206
+ }
207
+ interface HoloProjectPrepareLogger {
208
+ info(message: string): void;
209
+ warn(message: string): void;
210
+ }
211
+ interface HoloProjectPrepareContext {
212
+ readonly projectRoot: string;
213
+ readonly generatedRoot: string;
214
+ readonly pluginGeneratedRoot: string;
215
+ readonly config: NormalizedHoloProjectConfig;
216
+ readonly framework?: HoloProjectPrepareFramework;
217
+ readonly plugin: HoloProjectPreparePlugin;
218
+ readonly run: HoloProjectPrepareRun;
219
+ readonly signal: AbortSignal;
220
+ readonly logger: HoloProjectPrepareLogger;
221
+ }
222
+ type HoloProjectArtifactContents = string | Uint8Array;
223
+ interface HoloGeneratedProjectArtifact {
224
+ readonly path: string;
225
+ readonly contents: HoloProjectArtifactContents;
226
+ }
227
+ interface HoloManagedProjectArtifact {
228
+ readonly path: string;
229
+ readonly contents: HoloProjectArtifactContents;
230
+ }
231
+ interface HoloProjectPrepareWatch {
232
+ readonly roots?: readonly string[];
233
+ readonly excludes?: readonly string[];
234
+ }
235
+ interface HoloProjectPrepareSource {
236
+ readonly path: string;
237
+ readonly line?: number;
238
+ readonly column?: number;
239
+ }
240
+ interface HoloProjectPrepareDiagnostic {
241
+ readonly severity: 'info' | 'warning';
242
+ readonly code: string;
243
+ readonly message: string;
244
+ readonly source?: HoloProjectPrepareSource;
245
+ readonly hint?: string;
246
+ }
247
+ interface HoloProjectPrepareFailure {
248
+ readonly code: string;
249
+ readonly message: string;
250
+ readonly source?: HoloProjectPrepareSource;
251
+ readonly hint?: string;
252
+ }
253
+ declare class HoloProjectPrepareError extends Error {
254
+ readonly failure: Readonly<HoloProjectPrepareFailure>;
255
+ constructor(failure: HoloProjectPrepareFailure);
256
+ }
257
+ interface HoloProjectPreparedResult {
258
+ readonly kind: 'prepared';
259
+ readonly generatedArtifacts?: readonly HoloGeneratedProjectArtifact[];
260
+ readonly managedArtifacts?: readonly HoloManagedProjectArtifact[];
261
+ readonly watch?: HoloProjectPrepareWatch;
262
+ readonly diagnostics?: readonly HoloProjectPrepareDiagnostic[];
263
+ }
264
+ interface HoloProjectPrepareFullRetry {
265
+ readonly kind: 'retry-full';
266
+ readonly reason: string;
267
+ }
268
+ type HoloProjectPrepareResult = HoloProjectPreparedResult | HoloProjectPrepareFullRetry;
269
+ interface HoloProjectPreparer {
270
+ readonly apiVersion: typeof HOLO_PROJECT_PREPARE_API_VERSION;
271
+ prepare(context: HoloProjectPrepareContext): HoloProjectPrepareResult | Promise<HoloProjectPrepareResult>;
272
+ }
273
+ type HoloProjectPrepareModule = HoloProjectPreparer | {
274
+ readonly default: HoloProjectPreparer;
275
+ } | {
276
+ readonly preparer: HoloProjectPreparer;
277
+ };
278
+ declare function defineHoloProjectPreparer<TPreparer extends HoloProjectPreparer>(preparer: TPreparer): Readonly<TPreparer>;
279
+
172
280
  interface HoloRedisConnectionConfig {
173
281
  readonly url?: string;
174
282
  readonly clusters?: readonly HoloRedisClusterNodeConfig[];
@@ -219,4 +327,4 @@ declare function resolveNormalizedRedisConnection(config: NormalizedHoloRedisCon
219
327
  declare function normalizeRedisConfig(config?: HoloRedisConfig): NormalizedHoloRedisConfig;
220
328
  declare function defineRedisConfig<TConfig extends HoloRedisConfig>(config: TConfig): Readonly<TConfig>;
221
329
 
222
- export { DEFAULT_HOLO_PROJECT_PATHS, DEFAULT_REDIS_CONNECTION, DEFAULT_REDIS_DB, DEFAULT_REDIS_HOST, DEFAULT_REDIS_PORT, type HoloDatabaseDriver, type HoloPluginBroadcastContributions, type HoloPluginCacheContributions, type HoloPluginCliContributions, type HoloPluginConfigContributions, type HoloPluginContributions, type HoloPluginDefinition, type HoloPluginDependencyContributions, type HoloPluginFrameworkContribution, type HoloPluginFrameworkTsconfigKind, type HoloPluginMailContributions, type HoloPluginMigrationContributions, type HoloPluginNotificationContributions, type HoloPluginPackageManager, type HoloPluginQueueContributions, type HoloPluginRuntimeContributions, type HoloPluginRuntimeMapContributions, type HoloPluginRuntimeModule, type HoloProjectConfig, type HoloProjectConnectionConfig, type HoloProjectDatabaseConfig, type HoloProjectPaths, type HoloRedisClusterNodeConfig, type HoloRedisConfig, type HoloRedisConnectionConfig, type LoadedHoloPluginDefinition, type NormalizedHoloProjectConfig, type NormalizedHoloRedisClusterNodeConfig, type NormalizedHoloRedisConfig, type NormalizedHoloRedisConnectionConfig, type PluginLoadOptions, type RuntimeContribution, RuntimeLifecycle, type RuntimeLifecycleContext, createRuntimeLifecycle, defineHoloPlugin, defineHoloProject, defineRedisConfig, holoRedisDefaults, loadHoloPluginBootModules, loadHoloPluginContributionModules, loadHoloPluginDefinitions, normalizeHoloPluginDefinition, normalizeHoloProjectConfig, normalizeRedisConfig, resolveHoloPluginModulePath, resolveNormalizedRedisConnection };
330
+ export { DEFAULT_HOLO_PROJECT_PATHS, DEFAULT_REDIS_CONNECTION, DEFAULT_REDIS_DB, DEFAULT_REDIS_HOST, DEFAULT_REDIS_PORT, HOLO_PROJECT_PREPARE_API_VERSION, type HoloDatabaseDriver, type HoloGeneratedProjectArtifact, type HoloManagedProjectArtifact, type HoloPluginBroadcastContributions, type HoloPluginCacheContributions, type HoloPluginCliContributions, type HoloPluginConfigContributions, type HoloPluginContributions, type HoloPluginDefinition, type HoloPluginDependencyContributions, type HoloPluginFrameworkContribution, type HoloPluginFrameworkTsconfigKind, type HoloPluginMailContributions, type HoloPluginMigrationContributions, type HoloPluginNotificationContributions, type HoloPluginPackageManager, type HoloPluginProjectContributions, type HoloPluginQueueContributions, type HoloPluginRuntimeContributions, type HoloPluginRuntimeMapContributions, type HoloPluginRuntimeModule, type HoloProjectArtifactContents, type HoloProjectConfig, type HoloProjectConnectionConfig, type HoloProjectDatabaseConfig, type HoloProjectPaths, type HoloProjectPrepareChange, type HoloProjectPrepareChangeKind, type HoloProjectPrepareCommand, type HoloProjectPrepareContext, type HoloProjectPrepareDiagnostic, HoloProjectPrepareError, type HoloProjectPrepareFailure, type HoloProjectPrepareFramework, type HoloProjectPrepareFullRetry, type HoloProjectPrepareLogger, type HoloProjectPrepareModule, type HoloProjectPreparePlugin, type HoloProjectPrepareResult, type HoloProjectPrepareRun, type HoloProjectPrepareSource, type HoloProjectPrepareWatch, type HoloProjectPreparedResult, type HoloProjectPreparer, type HoloRedisClusterNodeConfig, type HoloRedisConfig, type HoloRedisConnectionConfig, type LoadedHoloPluginDefinition, type NormalizedHoloProjectConfig, type NormalizedHoloRedisClusterNodeConfig, type NormalizedHoloRedisConfig, type NormalizedHoloRedisConnectionConfig, type PluginLoadOptions, type RuntimeContribution, RuntimeLifecycle, type RuntimeLifecycleContext, createRuntimeLifecycle, defineHoloPlugin, defineHoloProject, defineHoloProjectPreparer, defineRedisConfig, holoRedisDefaults, loadHoloPluginBootModules, loadHoloPluginContributionModules, loadHoloPluginDefinitions, normalizeHoloPluginDefinition, normalizeHoloProjectConfig, normalizeRedisConfig, resolveHoloPluginModulePath, resolveNormalizedRedisConnection };
package/dist/index.mjs CHANGED
@@ -85,7 +85,7 @@ import { readFile } from "fs/promises";
85
85
  import { dirname, isAbsolute, join, relative, resolve } from "path";
86
86
  import { pathToFileURL } from "url";
87
87
  function isRecord(value) {
88
- return !!value && typeof value === "object" && !Array.isArray(value);
88
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
89
89
  }
90
90
  function normalizeString(value) {
91
91
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
@@ -123,6 +123,22 @@ function normalizeHoloPluginDefinition(value) {
123
123
  if (!isRecord(candidate) || !normalizeString(candidate.id)) {
124
124
  throw new Error("[Holo Plugins] Plugin entry must export a plugin definition with an id.");
125
125
  }
126
+ if (isRecord(candidate.contributes) && "project" in candidate.contributes) {
127
+ const project = candidate.contributes.project;
128
+ if (!isRecord(project)) {
129
+ throw new Error("[Holo Plugins] contributes.project must be an object.");
130
+ }
131
+ if ("prepare" in project && !normalizeString(project.prepare)) {
132
+ throw new Error("[Holo Plugins] contributes.project.prepare must be a non-empty string.");
133
+ }
134
+ return Object.freeze({
135
+ ...candidate,
136
+ contributes: Object.freeze({
137
+ ...candidate.contributes,
138
+ project: Object.freeze({ prepare: normalizeString(project.prepare) })
139
+ })
140
+ });
141
+ }
126
142
  return Object.freeze({ ...candidate });
127
143
  }
128
144
  function defineHoloPlugin(plugin) {
@@ -243,6 +259,20 @@ function defineHoloProject(config) {
243
259
  return normalizeHoloProjectConfig(config);
244
260
  }
245
261
 
262
+ // src/project-prepare.ts
263
+ var HOLO_PROJECT_PREPARE_API_VERSION = 1;
264
+ var HoloProjectPrepareError = class extends Error {
265
+ failure;
266
+ constructor(failure) {
267
+ super(failure.message);
268
+ this.name = "HoloProjectPrepareError";
269
+ this.failure = Object.freeze({ ...failure });
270
+ }
271
+ };
272
+ function defineHoloProjectPreparer(preparer) {
273
+ return Object.freeze({ ...preparer });
274
+ }
275
+
246
276
  // src/redis.ts
247
277
  var DEFAULT_REDIS_CONNECTION = "default";
248
278
  var DEFAULT_REDIS_HOST = "127.0.0.1";
@@ -402,10 +432,13 @@ export {
402
432
  DEFAULT_REDIS_DB,
403
433
  DEFAULT_REDIS_HOST,
404
434
  DEFAULT_REDIS_PORT,
435
+ HOLO_PROJECT_PREPARE_API_VERSION,
436
+ HoloProjectPrepareError,
405
437
  RuntimeLifecycle,
406
438
  createRuntimeLifecycle,
407
439
  defineHoloPlugin,
408
440
  defineHoloProject,
441
+ defineHoloProjectPreparer,
409
442
  defineRedisConfig,
410
443
  holoRedisDefaults,
411
444
  isHoloHttpErrorStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/kernel",
3
- "version": "0.3.7",
3
+ "version": "0.3.10",
4
4
  "description": "Holo-JS Framework - dependency-free contracts, plugins, and runtime lifecycle",
5
5
  "type": "module",
6
6
  "license": "MIT",