@jointhedots/gear 1.1.18 → 1.2.2

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 (113) hide show
  1. package/esm/builder/build-app-bundle.d.ts +28 -0
  2. package/esm/builder/build-app-bundle.js +4 -7
  3. package/esm/builder/build-app-host.d.ts +28 -0
  4. package/esm/builder/build-app-host.js +0 -1
  5. package/esm/builder/build-application.d.ts +47 -0
  6. package/esm/builder/build-application.js +3 -5
  7. package/esm/builder/build-library.d.ts +20 -0
  8. package/esm/builder/build-library.js +1 -2
  9. package/esm/builder/build-target.d.ts +27 -0
  10. package/esm/builder/build-target.js +3 -4
  11. package/esm/builder/helpers/emit-bundle-manifest.d.ts +9 -0
  12. package/esm/builder/helpers/emit-bundle-manifest.js +1 -2
  13. package/esm/builder/helpers/emit-components-dts.d.ts +9 -0
  14. package/esm/builder/helpers/emit-components-dts.js +1 -2
  15. package/esm/builder/helpers/emit-esmodules.d.ts +61 -0
  16. package/esm/builder/helpers/emit-esmodules.js +5 -6
  17. package/esm/builder/helpers/emit-package-manifest.d.ts +9 -0
  18. package/esm/builder/helpers/emit-package-manifest.js +0 -1
  19. package/esm/builder/helpers/emit-static-assets.d.ts +14 -0
  20. package/esm/builder/helpers/emit-static-assets.js +1 -2
  21. package/esm/builder/helpers/emit-typescript-definition.d.ts +35 -0
  22. package/esm/builder/helpers/emit-typescript-definition.js +6 -7
  23. package/esm/builder/helpers/path-helpers.d.ts +9 -0
  24. package/esm/builder/helpers/path-helpers.js +0 -1
  25. package/esm/builder/helpers/task.d.ts +8 -0
  26. package/esm/builder/helpers/task.js +0 -1
  27. package/esm/cli.d.ts +2 -0
  28. package/esm/cli.js +1 -4
  29. package/esm/commands/init.d.ts +2 -0
  30. package/esm/commands/init.js +0 -1
  31. package/esm/commands/install.d.ts +5 -0
  32. package/esm/commands/install.js +4 -5
  33. package/esm/commands/make.d.ts +16 -0
  34. package/esm/commands/make.js +5 -5
  35. package/esm/commands/run.d.ts +8 -0
  36. package/esm/commands/run.js +6 -7
  37. package/esm/commands/serve.d.ts +9 -0
  38. package/esm/commands/serve.js +3 -4
  39. package/esm/core/commands/interface.d.ts +26 -0
  40. package/esm/core/commands/interface.js +21 -0
  41. package/esm/core/components/components.d.ts +73 -0
  42. package/esm/core/components/components.js +2 -0
  43. package/esm/core/components/helpers.d.ts +7 -0
  44. package/esm/core/components/helpers.js +68 -0
  45. package/esm/core/components/manifold.d.ts +77 -0
  46. package/esm/core/components/manifold.js +442 -0
  47. package/esm/core/components/mod.d.ts +4 -0
  48. package/esm/core/components/mod.js +4 -0
  49. package/esm/core/components/provider.d.ts +42 -0
  50. package/esm/core/components/provider.js +127 -0
  51. package/esm/core/logging/mod.d.ts +53 -0
  52. package/esm/core/logging/mod.js +142 -0
  53. package/esm/core/logging/trace.d.ts +51 -0
  54. package/esm/core/logging/trace.js +17 -0
  55. package/esm/core/mod-browser.d.ts +1 -0
  56. package/esm/core/mod-browser.js +1 -0
  57. package/esm/core/mod-node.d.ts +1 -0
  58. package/esm/core/mod-node.js +1 -0
  59. package/esm/core/mod.d.ts +5 -0
  60. package/esm/core/mod.js +5 -0
  61. package/esm/core/schema/helpers.d.ts +36 -0
  62. package/esm/core/schema/helpers.js +163 -0
  63. package/esm/core/schema/mod.d.ts +3 -0
  64. package/esm/core/schema/mod.js +3 -0
  65. package/esm/core/schema/schema.d.ts +376 -0
  66. package/esm/core/schema/schema.js +234 -0
  67. package/esm/core/schema/zod.d.ts +44 -0
  68. package/esm/core/schema/zod.js +127 -0
  69. package/esm/core/services/mod.d.ts +5 -0
  70. package/esm/core/services/mod.js +5 -0
  71. package/esm/core/services/service-accessor.d.ts +17 -0
  72. package/esm/core/services/service-accessor.js +20 -0
  73. package/esm/core/services/service-definitions.d.ts +37 -0
  74. package/esm/core/services/service-definitions.js +44 -0
  75. package/esm/core/services/service-points.d.ts +40 -0
  76. package/esm/core/services/service-points.js +164 -0
  77. package/esm/core/services/service-specification.d.ts +52 -0
  78. package/esm/core/services/service-specification.js +59 -0
  79. package/esm/core/services/settings.d.ts +29 -0
  80. package/esm/core/services/settings.js +123 -0
  81. package/esm/utils/file.d.ts +39 -0
  82. package/esm/utils/file.js +3 -4
  83. package/esm/utils/graph-ordering.d.ts +21 -0
  84. package/esm/utils/graph-ordering.js +0 -1
  85. package/esm/utils/normalized-name.d.ts +17 -0
  86. package/esm/utils/normalized-name.js +0 -1
  87. package/esm/workspace/component.d.ts +70 -0
  88. package/esm/workspace/component.js +0 -1
  89. package/esm/workspace/helpers/config-loader.d.ts +37 -0
  90. package/esm/workspace/helpers/config-loader.js +4 -5
  91. package/esm/workspace/helpers/create-manifests.d.ts +13 -0
  92. package/esm/workspace/helpers/create-manifests.js +1 -2
  93. package/esm/workspace/helpers/discover-workspace.d.ts +4 -0
  94. package/esm/workspace/helpers/discover-workspace.js +130 -134
  95. package/esm/workspace/helpers/lockfile.d.ts +5 -0
  96. package/esm/workspace/helpers/lockfile.js +0 -1
  97. package/esm/workspace/helpers/logger.d.ts +65 -0
  98. package/esm/workspace/helpers/logger.js +0 -1
  99. package/esm/workspace/helpers/package-npm.d.ts +1 -0
  100. package/esm/workspace/helpers/package-npm.js +0 -1
  101. package/esm/workspace/mod.d.ts +1 -0
  102. package/esm/workspace/mod.js +1 -0
  103. package/esm/workspace/packager.d.ts +5 -0
  104. package/esm/workspace/packager.js +1 -2
  105. package/esm/workspace/packagers/packager-standard.d.ts +7 -0
  106. package/esm/workspace/packagers/packager-standard.js +48 -24
  107. package/esm/workspace/storage.d.ts +59 -0
  108. package/esm/workspace/storage.js +19 -15
  109. package/esm/workspace/workspace.d.ts +161 -0
  110. package/esm/workspace/workspace.js +25 -17
  111. package/package.json +25 -18
  112. package/esm/commands/publish.js +0 -36
  113. package/esm/publish/publish_aws_s3.js +0 -67
@@ -0,0 +1,123 @@
1
+ export var WriteMode;
2
+ (function (WriteMode) {
3
+ WriteMode[WriteMode["Default"] = 0] = "Default";
4
+ WriteMode[WriteMode["Reset"] = 1] = "Reset";
5
+ WriteMode[WriteMode["Temporary"] = 2] = "Temporary";
6
+ })(WriteMode || (WriteMode = {}));
7
+ export class AccountSettings {
8
+ name;
9
+ key = null;
10
+ stores = createSettingStores();
11
+ temporaries = createSettingStores();
12
+ settings = createSettingStores();
13
+ constructor(name) {
14
+ this.name = name;
15
+ this.key = `settings://${this.name}`;
16
+ try {
17
+ const bytes = localStorage.getItem(this.key);
18
+ this.restore(JSON.parse(bytes).stores);
19
+ }
20
+ catch (_) { }
21
+ try {
22
+ window.addEventListener("storage", (evt) => {
23
+ const { key, newValue } = evt;
24
+ if (key === this.key) {
25
+ try {
26
+ this.restore(JSON.parse(newValue).stores);
27
+ }
28
+ catch (_) { }
29
+ }
30
+ });
31
+ }
32
+ catch (e) {
33
+ console.error(e.message);
34
+ }
35
+ }
36
+ get(group, key) {
37
+ let data = this.settings[group][key];
38
+ if (!data) {
39
+ const bytes = this.temporaries[group][key] || this.stores[group][key];
40
+ if (bytes) {
41
+ data = JSON.parse(bytes);
42
+ this.settings[group][key] = data;
43
+ }
44
+ }
45
+ return data;
46
+ }
47
+ set(group, key, descriptor, mode = WriteMode.Default) {
48
+ const data = JSON.stringify(descriptor);
49
+ if (this.write(group, key, data, mode)) {
50
+ this.settings[group][key] = descriptor;
51
+ notifySettingsChange(this, group, key);
52
+ return true;
53
+ }
54
+ return false;
55
+ }
56
+ list(group) {
57
+ if (Object.keys(this.temporaries[group]).length > 0) {
58
+ return Object.keys(Object.assign({}, this.stores[group], this.temporaries[group]));
59
+ }
60
+ else {
61
+ return Object.keys(this.stores[group]);
62
+ }
63
+ }
64
+ read(key) {
65
+ return this.stores[key];
66
+ }
67
+ write(group, key, data, mode) {
68
+ if (mode !== WriteMode.Reset && this.temporaries[group][key] !== undefined) {
69
+ mode = WriteMode.Temporary;
70
+ }
71
+ if (mode === WriteMode.Temporary) {
72
+ if (this.temporaries[group][key] !== data) {
73
+ this.temporaries[group][key] = data;
74
+ this.settings[group][key] = null;
75
+ return true;
76
+ }
77
+ }
78
+ else if (this.stores[group][key] !== data) {
79
+ this.stores[group][key] = data;
80
+ this.settings[group][key] = null;
81
+ if (mode === WriteMode.Default) {
82
+ localStorage.setItem(this.key, JSON.stringify({ stores: this.stores }));
83
+ }
84
+ return true;
85
+ }
86
+ return false;
87
+ }
88
+ restore(stores) {
89
+ for (const group in stores) {
90
+ for (const key in stores[group]) {
91
+ if (this.write(group, key, stores[group][key], WriteMode.Reset)) {
92
+ notifySettingsChange(this, group, key);
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ const Settings_ChangeHandlers = new Set();
99
+ const Settings = new AccountSettings("default");
100
+ export function getSettings() {
101
+ return Settings;
102
+ }
103
+ export function listenSettings(handler) {
104
+ Settings_ChangeHandlers.add(handler);
105
+ return handler;
106
+ }
107
+ export function unlistenSettings(handler) {
108
+ Settings_ChangeHandlers.delete(handler);
109
+ }
110
+ function notifySettingsChange(settings, group, key) {
111
+ if (settings === Settings && settings.settings[group][key] !== undefined) {
112
+ for (const handler of Settings_ChangeHandlers) {
113
+ handler(group, key);
114
+ }
115
+ }
116
+ }
117
+ function createSettingStores() {
118
+ return {
119
+ service_points: {},
120
+ components: {},
121
+ shareds: {},
122
+ };
123
+ }
@@ -0,0 +1,39 @@
1
+ import Fs from "node:fs";
2
+ export declare const PackageRootDir: string;
3
+ export declare const file: {
4
+ exists(path: string): boolean;
5
+ copy: {
6
+ toFile(src: string, dest: string): string;
7
+ toDir(src: string, dest: string): string;
8
+ };
9
+ move: {
10
+ toFile(src: string, dest: string): string;
11
+ toDir(src: string, dest: string): string;
12
+ };
13
+ read: {
14
+ json(path: string): any;
15
+ text(path: string): string;
16
+ };
17
+ write: {
18
+ json(path: string, data: any): void;
19
+ text(path: string, data: string): void;
20
+ };
21
+ find: {
22
+ upperDir(base: string, subpath: string): string;
23
+ };
24
+ remove(path: string): void;
25
+ };
26
+ export declare const directory: {
27
+ exists(path: string): boolean;
28
+ filenames(path: string, recursive?: Boolean): string[];
29
+ copy(src: string, dest: string, filter?: (name: string, path: string, stats: Fs.Stats) => boolean): void;
30
+ make(path: string): void;
31
+ remove(path: string, onlyInner?: boolean): void;
32
+ clean(path: string): void;
33
+ };
34
+ export declare function make_relative_path(baseDir: string, ...path: string[]): string;
35
+ export declare function make_normalized_path(baseDir: string, ...path: string[]): string;
36
+ export declare function make_normalized_dirname(baseDir: string, ...path: string[]): string;
37
+ export declare function make_canonical_path(baseDir: string, ...path: string[]): string;
38
+ /** Resolve a file path with extension probing */
39
+ export declare function resolve_normalized_suffixed_path(baseDir: string, path: string, exts?: string[]): string | null;
package/esm/utils/file.js CHANGED
@@ -1,6 +1,6 @@
1
- import Path from "path";
2
- import Fs from "fs";
3
- import { fileURLToPath } from "url";
1
+ import Path from "node:path";
2
+ import Fs from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
4
  export const PackageRootDir = Path.resolve(fileURLToPath(import.meta.url), "../../..");
5
5
  export const file = {
6
6
  exists(path) {
@@ -212,4 +212,3 @@ export function resolve_normalized_suffixed_path(baseDir, path, exts = FILE_EXTE
212
212
  }
213
213
  return null;
214
214
  }
215
- //# sourceMappingURL=file.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Topological sort using Tarjan's algorithm.
3
+ * Returns nodes in dependency order (dependencies come first).
4
+ * Throws if a cycle is detected.
5
+ *
6
+ * @param nodes - Array of node identifiers
7
+ * @param edges - Function that returns outgoing edges (dependencies) for a node
8
+ * @returns Nodes in topological order
9
+ */
10
+ export declare function topologicalSort<T>(nodes: Iterable<T>, edges: (node: T) => Iterable<T>): T[];
11
+ /**
12
+ * Get topological order with cycle detection that returns cycle info instead of throwing.
13
+ *
14
+ * @param nodes - Array of node identifiers
15
+ * @param edges - Function that returns outgoing edges for a node
16
+ * @returns Object with ordered nodes and any detected cycles
17
+ */
18
+ export declare function getGraphOrder<T>(nodes: Iterable<T>, edges: (node: T) => Iterable<T>): {
19
+ order: T[];
20
+ cycles: T[][];
21
+ };
@@ -83,4 +83,3 @@ export function getGraphOrder(nodes, edges) {
83
83
  }
84
84
  return { order, cycles };
85
85
  }
86
- //# sourceMappingURL=graph-ordering.js.map
@@ -0,0 +1,17 @@
1
+ export declare enum NameStyle {
2
+ OBJECT = "object",
3
+ WEBC = "webc",
4
+ URN = "urn",
5
+ URL = "url",
6
+ DNS = "dns"
7
+ }
8
+ export type NameStyleConfig = {
9
+ namespace: string;
10
+ key: string;
11
+ };
12
+ export declare const NormalizedNameSeparators: Record<NameStyle, NameStyleConfig>;
13
+ export declare function detectNormalizedNameStyle(name: string): NameStyle;
14
+ export declare function isNormalizedName(name: string, expectedStyle?: NameStyle): boolean;
15
+ export declare function getNormalizedKeys(name: string, fromStyle?: NameStyle): string[];
16
+ export declare function makeNormalizedName(name: string, targetStyle: NameStyle, fromStyle?: NameStyle): string;
17
+ export declare function computeNameHashID(identity: string): string;
@@ -93,4 +93,3 @@ export function computeNameHashID(identity) {
93
93
  hasher.write(identity);
94
94
  return hasher.digest().toString("base64url");
95
95
  }
96
- //# sourceMappingURL=normalized-name.js.map
@@ -0,0 +1,70 @@
1
+ export type JSONSchema = any;
2
+ export type ResourceEntry<ResourceInterface = any> = ResourceLink<ResourceInterface> | {
3
+ type: ResourceLink<ResourceFactory<ResourceInterface>>;
4
+ data?: any;
5
+ };
6
+ export type ResourceFactory<ResourceInterface = any> = (data: any) => Promise<ResourceInterface>;
7
+ export type ResourceLink<ResourceInterface = any> = string;
8
+ export type ComponentID = string;
9
+ export type BundleID = ComponentID;
10
+ export type ComponentSpec = {
11
+ "view"?: {
12
+ properties: Record<string, JSONSchema>;
13
+ };
14
+ "component"?: {
15
+ services: string[];
16
+ attributes: Record<string, JSONSchema>;
17
+ };
18
+ [customSpec: string]: any;
19
+ };
20
+ export type ComponentManifest<Data extends any = unknown> = {
21
+ $id: string;
22
+ type?: string;
23
+ name?: string;
24
+ icon?: string;
25
+ title?: string;
26
+ tags?: string[];
27
+ keywords?: string[];
28
+ description?: string;
29
+ selectors?: string[];
30
+ specs?: Record<string, ComponentSpec>;
31
+ data?: Data;
32
+ resources?: Record<string, ResourceEntry>;
33
+ apis?: Record<string, ResourceEntry>;
34
+ };
35
+ /** Configuration for a distributed package */
36
+ export interface DistributedConfig {
37
+ /** Version specifier (e.g., "*", "^18.0.0") */
38
+ version?: string;
39
+ /** Interop type: 'esm' | 'cjs-default' | 'cjs-named' */
40
+ interop?: 'esm' | 'cjs-default' | 'cjs-named';
41
+ /** List of named exports to re-export (required for cjs-named interop) */
42
+ exports?: string[];
43
+ }
44
+ export type BundleManifest = ComponentManifest<{
45
+ alias?: string;
46
+ package?: string;
47
+ baseline?: string;
48
+ namespaces?: string[];
49
+ dependencies?: string[];
50
+ distribueds?: {
51
+ [packageName: string]: string | DistributedConfig;
52
+ };
53
+ exports?: {
54
+ [id: string]: string;
55
+ };
56
+ components?: ComponentPublication[];
57
+ }>;
58
+ export interface ComponentPublication {
59
+ id: ComponentID;
60
+ ref?: string;
61
+ type?: string;
62
+ title: string;
63
+ icon?: string;
64
+ description?: string;
65
+ services?: string[];
66
+ keywords?: string[];
67
+ tags?: string[];
68
+ }
69
+ export declare function checkComponentManifest(manif: ComponentManifest, path: string): Error;
70
+ export declare function makeComponentPublication(manif: ComponentManifest): ComponentPublication;
@@ -20,4 +20,3 @@ export function makeComponentPublication(manif) {
20
20
  tags: manif.tags,
21
21
  };
22
22
  }
23
- //# sourceMappingURL=component.js.map
@@ -0,0 +1,37 @@
1
+ /** Supported config file extensions in precedence order */
2
+ export declare const config_extensions: readonly [".json", ".yaml", ".yml", ".toml"];
3
+ export type ConfigExtension = typeof config_extensions[number];
4
+ /**
5
+ * Check whether a filename matches a config base name (e.g. "component", "application")
6
+ * in any supported format (json, yaml, yml, toml).
7
+ * Matches exact names like `component.json` and dotted prefixes like `foo.component.yaml`.
8
+ */
9
+ export declare function is_config_filename(fname: string, config_base: string): boolean;
10
+ /**
11
+ * Parse a config string based on its file extension.
12
+ */
13
+ export declare function parseConfigContent(text: string, ext: ConfigExtension): any;
14
+ /**
15
+ * Read and parse a config file. The format is determined by its extension.
16
+ * Returns `undefined` if the file doesn't exist or can't be parsed.
17
+ */
18
+ export declare function readConfigFile<T = any>(path: string): Promise<T | undefined>;
19
+ /**
20
+ * Read and parse a config file synchronously.
21
+ * Returns `undefined` if the file doesn't exist or can't be parsed.
22
+ */
23
+ export declare function readConfigFileSync<T = any>(path: string): T | undefined;
24
+ /**
25
+ * Find config files matching a base name (e.g. "bundle.component") in a directory.
26
+ * Returns all matching paths across supported extensions.
27
+ */
28
+ export declare function findConfigFile(dir: string, baseName: string, fnames?: string[]): string;
29
+ /**
30
+ * Read a singleton config file (exactly one format must exist).
31
+ * Throws if multiple formats are found for the same base name.
32
+ * Returns `undefined` if no matching file exists.
33
+ */
34
+ export declare function readSingletonConfigFile<T = any>(dir: string, baseName: string, fnames?: string[]): Promise<{
35
+ data: T;
36
+ path: string;
37
+ } | undefined>;
@@ -1,8 +1,8 @@
1
- import YAML from 'yaml';
2
- import TOML from 'toml';
3
- import Path from 'node:path';
1
+ import YAML from "yaml";
2
+ import TOML from "toml";
3
+ import Path from "node:path";
4
4
  import Fsp from "node:fs/promises";
5
- import Fs from 'node:fs';
5
+ import Fs from "node:fs";
6
6
  /** Supported config file extensions in precedence order */
7
7
  export const config_extensions = [".json", ".yaml", ".yml", ".toml"];
8
8
  /**
@@ -97,4 +97,3 @@ export async function readSingletonConfigFile(dir, baseName, fnames) {
97
97
  const data = await readConfigFile(path);
98
98
  return data !== undefined ? { data, path } : undefined;
99
99
  }
100
- //# sourceMappingURL=config-loader.js.map
@@ -0,0 +1,13 @@
1
+ import { type BundleManifest } from "../component.ts";
2
+ import type { Bundle, Library, PackageDescriptor } from "../workspace.ts";
3
+ export type ExportEntry = {
4
+ id: string;
5
+ exported?: string;
6
+ basename: string;
7
+ filename: string;
8
+ source: string;
9
+ };
10
+ export type ExportEntries = Record<string, ExportEntry>;
11
+ export declare function create_export_map(lib: Library, bun: Bundle): ExportEntries;
12
+ export declare function create_bundle_manifest(lib: Library, bun: Bundle): BundleManifest;
13
+ export declare function create_package_manifest(lib: Library, bun: Bundle, build_version?: string): PackageDescriptor;
@@ -84,7 +84,7 @@ export function create_package_manifest(lib, bun, build_version) {
84
84
  optionalDependencies: undefined,
85
85
  };
86
86
  if (pkg_manif.dependencies) {
87
- const resolved = lib.workspace.resolved_versions;
87
+ const resolved = lib.resolved_versions;
88
88
  for (const dep in pkg_manif.dependencies) {
89
89
  if (pkg_manif.dependencies[dep] === "*") {
90
90
  const dep_resolved = resolved[dep];
@@ -111,4 +111,3 @@ export function create_package_manifest(lib, bun, build_version) {
111
111
  }
112
112
  return pkg_manif;
113
113
  }
114
- //# sourceMappingURL=create-manifests.js.map
@@ -0,0 +1,4 @@
1
+ import { Library, Workspace } from "../workspace.ts";
2
+ export declare function discover_component(lib: Library, fpath: string): Promise<boolean>;
3
+ export declare function discover_library_definitions(lib: Library, path: string, subdir?: boolean): Promise<void>;
4
+ export declare function discover_workspace(ws: Workspace): Promise<Workspace>;