@jointhedots/gear 1.2.0 → 1.2.3
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/esm/builder/build-app-bundle.d.ts +29 -0
- package/esm/builder/build-app-bundle.js +9 -6
- package/esm/builder/build-app-host.d.ts +28 -0
- package/esm/builder/build-app-host.js +20 -19
- package/esm/builder/build-application.d.ts +51 -0
- package/esm/builder/build-application.js +53 -74
- package/esm/builder/build-library.d.ts +21 -0
- package/esm/builder/build-library.js +13 -10
- package/esm/builder/build-target.d.ts +36 -0
- package/esm/builder/build-target.js +20 -12
- package/esm/builder/helpers/emit-artifact.d.ts +13 -0
- package/esm/builder/helpers/emit-artifact.js +40 -0
- package/esm/builder/helpers/emit-bundle-manifest.d.ts +19 -0
- package/esm/builder/helpers/emit-bundle-manifest.js +38 -16
- package/esm/builder/helpers/emit-components-dts.d.ts +9 -0
- package/esm/builder/helpers/emit-components-dts.js +1 -2
- package/esm/builder/helpers/emit-esmodules.d.ts +61 -0
- package/esm/builder/helpers/emit-esmodules.js +22 -23
- package/esm/builder/helpers/emit-package-manifest.d.ts +9 -0
- package/esm/builder/helpers/emit-package-manifest.js +1 -2
- package/esm/builder/helpers/emit-static-assets.d.ts +14 -0
- package/esm/builder/helpers/emit-static-assets.js +1 -2
- package/esm/builder/helpers/emit-typescript-definition.d.ts +35 -0
- package/esm/builder/helpers/emit-typescript-definition.js +7 -8
- package/esm/builder/helpers/path-helpers.d.ts +9 -0
- package/esm/builder/helpers/path-helpers.js +0 -1
- package/esm/builder/helpers/task.d.ts +8 -0
- package/esm/builder/helpers/task.js +0 -1
- package/esm/cli.d.ts +2 -0
- package/esm/cli.js +1 -4
- package/esm/commands/init.d.ts +2 -0
- package/esm/commands/init.js +0 -1
- package/esm/commands/install.d.ts +5 -0
- package/esm/commands/install.js +3 -4
- package/esm/commands/make.d.ts +17 -0
- package/esm/commands/make.js +12 -5
- package/esm/commands/run.d.ts +8 -0
- package/esm/commands/run.js +6 -7
- package/esm/commands/serve.d.ts +9 -0
- package/esm/commands/serve.js +11 -13
- package/esm/core/commands/interface.d.ts +26 -0
- package/esm/core/commands/interface.js +21 -0
- package/esm/core/components/components.d.ts +73 -0
- package/esm/core/components/components.js +2 -0
- package/esm/core/components/helpers.d.ts +7 -0
- package/esm/core/components/helpers.js +68 -0
- package/esm/core/components/manifold.d.ts +77 -0
- package/esm/core/components/manifold.js +442 -0
- package/esm/core/components/mod.d.ts +4 -0
- package/esm/core/components/mod.js +4 -0
- package/esm/core/components/provider.d.ts +42 -0
- package/esm/core/components/provider.js +127 -0
- package/esm/core/logging/mod.d.ts +53 -0
- package/esm/core/logging/mod.js +142 -0
- package/esm/core/logging/trace.d.ts +51 -0
- package/esm/core/logging/trace.js +17 -0
- package/esm/core/mod-browser.d.ts +1 -0
- package/esm/core/mod-browser.js +1 -0
- package/esm/core/mod-node.d.ts +1 -0
- package/esm/core/mod-node.js +1 -0
- package/esm/core/mod.d.ts +5 -0
- package/esm/core/mod.js +5 -0
- package/esm/core/schema/helpers.d.ts +36 -0
- package/esm/core/schema/helpers.js +163 -0
- package/esm/core/schema/mod.d.ts +3 -0
- package/esm/core/schema/mod.js +3 -0
- package/esm/core/schema/schema.d.ts +376 -0
- package/esm/core/schema/schema.js +234 -0
- package/esm/core/schema/zod.d.ts +44 -0
- package/esm/core/schema/zod.js +127 -0
- package/esm/core/services/mod.d.ts +5 -0
- package/esm/core/services/mod.js +5 -0
- package/esm/core/services/service-accessor.d.ts +17 -0
- package/esm/core/services/service-accessor.js +20 -0
- package/esm/core/services/service-definitions.d.ts +37 -0
- package/esm/core/services/service-definitions.js +44 -0
- package/esm/core/services/service-points.d.ts +40 -0
- package/esm/core/services/service-points.js +164 -0
- package/esm/core/services/service-specification.d.ts +52 -0
- package/esm/core/services/service-specification.js +59 -0
- package/esm/core/services/settings.d.ts +29 -0
- package/esm/core/services/settings.js +123 -0
- package/esm/utils/file.d.ts +39 -0
- package/esm/utils/file.js +3 -4
- package/esm/utils/graph-ordering.d.ts +21 -0
- package/esm/utils/graph-ordering.js +0 -1
- package/esm/utils/normalized-name.d.ts +17 -0
- package/esm/utils/normalized-name.js +0 -1
- package/esm/workspace/component.d.ts +70 -0
- package/esm/workspace/component.js +0 -1
- package/esm/workspace/helpers/config-loader.d.ts +37 -0
- package/esm/workspace/helpers/config-loader.js +4 -5
- package/esm/workspace/helpers/create-manifests.d.ts +13 -0
- package/esm/workspace/helpers/create-manifests.js +3 -4
- package/esm/workspace/helpers/discover-workspace.d.ts +4 -0
- package/esm/workspace/helpers/discover-workspace.js +19 -30
- package/esm/workspace/helpers/lockfile.d.ts +5 -0
- package/esm/workspace/helpers/lockfile.js +13 -14
- package/esm/workspace/helpers/logger.d.ts +65 -0
- package/esm/workspace/helpers/logger.js +1 -2
- package/esm/workspace/helpers/package-npm.d.ts +1 -0
- package/esm/workspace/helpers/package-npm.js +0 -1
- package/esm/workspace/mod.d.ts +1 -0
- package/esm/workspace/mod.js +1 -0
- package/esm/workspace/packager.d.ts +5 -0
- package/esm/workspace/packager.js +1 -2
- package/esm/workspace/packagers/packager-standard.d.ts +7 -0
- package/esm/workspace/packagers/packager-standard.js +3 -4
- package/esm/workspace/storage.d.ts +59 -0
- package/esm/workspace/storage.js +4 -5
- package/esm/workspace/workspace.d.ts +165 -0
- package/esm/workspace/workspace.js +27 -16
- package/package.json +74 -66
- package/esm/commands/publish.js +0 -36
- package/esm/publish/publish_aws_s3.js +0 -67
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import {} from "../workspace/component.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Bundle, Library } from "../workspace/workspace.js";
|
|
3
3
|
import { ESModulesTask } from "./helpers/emit-esmodules.js";
|
|
4
4
|
import {} from "../workspace/storage.js";
|
|
5
5
|
import { AssetsTask } from "./helpers/emit-static-assets.js";
|
|
6
6
|
export class BuildTarget {
|
|
7
7
|
name;
|
|
8
8
|
storage;
|
|
9
|
-
|
|
9
|
+
library;
|
|
10
10
|
devmode;
|
|
11
11
|
watch;
|
|
12
12
|
clean;
|
|
13
|
+
onNotification;
|
|
13
14
|
components = new Map();
|
|
14
15
|
esmodules = new ESModulesTask(this);
|
|
15
16
|
assets = new AssetsTask(this);
|
|
16
17
|
tasks = [];
|
|
18
|
+
finalTasks = [];
|
|
17
19
|
transaction = null;
|
|
18
20
|
log;
|
|
19
|
-
constructor(name, storage,
|
|
21
|
+
constructor(name, storage, library, devmode, watch, clean, onNotification) {
|
|
20
22
|
this.name = name;
|
|
21
23
|
this.storage = storage;
|
|
22
|
-
this.
|
|
24
|
+
this.library = library;
|
|
23
25
|
this.devmode = devmode;
|
|
24
26
|
this.watch = watch;
|
|
25
27
|
this.clean = clean;
|
|
26
|
-
this.
|
|
28
|
+
this.onNotification = onNotification;
|
|
29
|
+
this.log = library.log.logger.get(`build:${name}`);
|
|
27
30
|
}
|
|
28
31
|
edit() {
|
|
29
32
|
if (!this.transaction)
|
|
@@ -36,10 +39,11 @@ export class BuildTarget {
|
|
|
36
39
|
this.transaction = null;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
|
-
add_component(descriptor, baseDir,
|
|
42
|
+
add_component(descriptor, baseDir, origin) {
|
|
40
43
|
const id = descriptor.$id;
|
|
41
44
|
if (this.components.has(id)) {
|
|
42
|
-
|
|
45
|
+
this.log.error(createComponentDuplicateMessage(id, origin));
|
|
46
|
+
return false;
|
|
43
47
|
}
|
|
44
48
|
const manifest = {
|
|
45
49
|
...descriptor,
|
|
@@ -50,16 +54,17 @@ export class BuildTarget {
|
|
|
50
54
|
if (descriptor.apis) {
|
|
51
55
|
manifest.apis = {};
|
|
52
56
|
for (const name in descriptor.apis) {
|
|
53
|
-
manifest.apis[name] = this.esmodules.add_resource_entry(descriptor.apis[name], baseDir,
|
|
57
|
+
manifest.apis[name] = this.esmodules.add_resource_entry(descriptor.apis[name], baseDir, origin);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
if (descriptor.resources) {
|
|
57
61
|
manifest.resources = {};
|
|
58
62
|
for (const name in descriptor.resources) {
|
|
59
|
-
manifest.resources[name] = this.esmodules.add_resource_entry(descriptor.resources[name], baseDir,
|
|
63
|
+
manifest.resources[name] = this.esmodules.add_resource_entry(descriptor.resources[name], baseDir, origin);
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
this.components.set(id, manifest);
|
|
67
|
+
return true;
|
|
63
68
|
}
|
|
64
69
|
async chrona(task) {
|
|
65
70
|
const name = task.constructor.name;
|
|
@@ -84,6 +89,7 @@ export class BuildTarget {
|
|
|
84
89
|
// Trace time
|
|
85
90
|
const buildTime = (Date.now() - buildStartTime) / 1000;
|
|
86
91
|
this.log.info(`Build completed in ${buildTime.toFixed(2)}s`);
|
|
92
|
+
this.onNotification?.({ type: "build-complete", target: this.name, elapsed: buildTime });
|
|
87
93
|
if (this.watch) {
|
|
88
94
|
await new Promise((resolve) => {
|
|
89
95
|
process.on('SIGQUIT', () => resolve(null));
|
|
@@ -91,13 +97,16 @@ export class BuildTarget {
|
|
|
91
97
|
}
|
|
92
98
|
else {
|
|
93
99
|
await this.store();
|
|
100
|
+
for (const task of this.finalTasks) {
|
|
101
|
+
await this.chrona(task);
|
|
102
|
+
}
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
|
-
function createComponentDuplicateMessage(id,
|
|
106
|
+
function createComponentDuplicateMessage(id, origin) {
|
|
98
107
|
const duplicates = [];
|
|
99
108
|
const libs = [];
|
|
100
|
-
for (const bun of library.shelve) {
|
|
109
|
+
for (const bun of origin.library.shelve) {
|
|
101
110
|
for (const [cpath, cmanifest] of bun.components.entries()) {
|
|
102
111
|
if (cmanifest.$id === id) {
|
|
103
112
|
duplicates.push(`\n - ${cpath}`);
|
|
@@ -107,4 +116,3 @@ function createComponentDuplicateMessage(id, library) {
|
|
|
107
116
|
}
|
|
108
117
|
return `Component '${id}' declared multiple times: ${duplicates.join("")}\n> libraries:${libs.join("")}\n`;
|
|
109
118
|
}
|
|
110
|
-
//# sourceMappingURL=build-target.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BuildTask } from "./task.ts";
|
|
2
|
+
import type { BuildTarget } from "../build-target.ts";
|
|
3
|
+
export declare class ArtifactNpmTask extends BuildTask {
|
|
4
|
+
readonly outputDir: string;
|
|
5
|
+
constructor(target: BuildTarget, outputDir: string);
|
|
6
|
+
execute(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ArtifactZipTask extends BuildTask {
|
|
9
|
+
readonly outputDir: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
constructor(target: BuildTarget, outputDir: string, name: string);
|
|
12
|
+
execute(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Path from "node:path";
|
|
2
|
+
import FS from "node:fs";
|
|
3
|
+
import ChildProcess from "node:child_process";
|
|
4
|
+
import { BuildTask } from "./task.js";
|
|
5
|
+
export class ArtifactNpmTask extends BuildTask {
|
|
6
|
+
outputDir;
|
|
7
|
+
constructor(target, outputDir) {
|
|
8
|
+
super(target);
|
|
9
|
+
this.outputDir = outputDir;
|
|
10
|
+
}
|
|
11
|
+
async execute() {
|
|
12
|
+
const sourceDir = this.target.storage.getBaseDirFS();
|
|
13
|
+
FS.mkdirSync(this.outputDir, { recursive: true });
|
|
14
|
+
this.log.info(`📦 npm pack → ${this.outputDir}`);
|
|
15
|
+
ChildProcess.execSync("npm pack --pack-destination " + JSON.stringify(this.outputDir), { cwd: sourceDir });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ArtifactZipTask extends BuildTask {
|
|
19
|
+
outputDir;
|
|
20
|
+
name;
|
|
21
|
+
constructor(target, outputDir, name) {
|
|
22
|
+
super(target);
|
|
23
|
+
this.outputDir = outputDir;
|
|
24
|
+
this.name = name;
|
|
25
|
+
}
|
|
26
|
+
async execute() {
|
|
27
|
+
const sourceDir = this.target.storage.getBaseDirFS();
|
|
28
|
+
FS.mkdirSync(this.outputDir, { recursive: true });
|
|
29
|
+
const outPath = Path.join(this.outputDir, `${this.name}.zip`);
|
|
30
|
+
this.log.info(`📦 zip → ${outPath}`);
|
|
31
|
+
const parent = Path.dirname(sourceDir);
|
|
32
|
+
const base = Path.basename(sourceDir);
|
|
33
|
+
if (process.platform === 'win32') {
|
|
34
|
+
ChildProcess.execSync(`powershell -NoProfile -Command "Compress-Archive -Path '${base}\\*' -DestinationPath '${outPath}' -Force"`, { cwd: parent });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
ChildProcess.execSync(`zip -r ${JSON.stringify(outPath)} ${JSON.stringify(base)}`, { cwd: parent });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type BundleManifest } from "../../workspace/component.ts";
|
|
2
|
+
import { type AppDescriptor, type Bundle } from "../../workspace/workspace.ts";
|
|
3
|
+
import { BuildTarget } from "../build-target.ts";
|
|
4
|
+
import { BuildTask } from "./task.ts";
|
|
5
|
+
export declare abstract class BaseManifestTask extends BuildTask {
|
|
6
|
+
write_manifest(manifest: BundleManifest): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare class BundleManifestTask extends BaseManifestTask {
|
|
9
|
+
readonly target: BuildTarget;
|
|
10
|
+
readonly bundle: Bundle;
|
|
11
|
+
constructor(target: BuildTarget, bundle: Bundle);
|
|
12
|
+
execute(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare class ApplicationManifestTask extends BaseManifestTask {
|
|
15
|
+
readonly target: BuildTarget;
|
|
16
|
+
readonly app: AppDescriptor;
|
|
17
|
+
constructor(target: BuildTarget, app: AppDescriptor);
|
|
18
|
+
execute(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { makeComponentPublication } from "../../workspace/component.js";
|
|
2
|
+
import { Library } from "../../workspace/workspace.js";
|
|
2
3
|
import { BuildTarget } from "../build-target.js";
|
|
3
4
|
import { BuildTask } from "./task.js";
|
|
4
|
-
import MIME from
|
|
5
|
-
export class
|
|
5
|
+
import MIME from "mime";
|
|
6
|
+
export class BaseManifestTask extends BuildTask {
|
|
7
|
+
async write_manifest(manifest) {
|
|
8
|
+
const tx = this.target.edit();
|
|
9
|
+
const pubs = [];
|
|
10
|
+
for (const manif of this.target.components.values()) {
|
|
11
|
+
const pub = makeComponentPublication(manif);
|
|
12
|
+
pub.ref = await tx.commitContent(JSON.stringify(manif, null, 2), MIME.getType(".json"));
|
|
13
|
+
pubs.push(pub);
|
|
14
|
+
}
|
|
15
|
+
manifest.data.components = pubs;
|
|
16
|
+
await tx.commitFile(`bundle.manifest.json`, JSON.stringify(manifest, null, 2));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class BundleManifestTask extends BaseManifestTask {
|
|
6
20
|
target;
|
|
7
21
|
bundle;
|
|
8
22
|
constructor(target, bundle) {
|
|
@@ -11,19 +25,27 @@ export class BundleManifestTask extends BuildTask {
|
|
|
11
25
|
this.bundle = bundle;
|
|
12
26
|
}
|
|
13
27
|
async execute() {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const { bundle } = this;
|
|
29
|
+
await this.write_manifest(bundle.manifest);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class ApplicationManifestTask extends BaseManifestTask {
|
|
33
|
+
target;
|
|
34
|
+
app;
|
|
35
|
+
constructor(target, app) {
|
|
36
|
+
super(target);
|
|
37
|
+
this.target = target;
|
|
38
|
+
this.app = app;
|
|
39
|
+
}
|
|
40
|
+
async execute() {
|
|
41
|
+
const { target, app } = this;
|
|
42
|
+
await this.write_manifest({
|
|
43
|
+
$id: target.name,
|
|
44
|
+
name: app.name,
|
|
45
|
+
icon: app.icon,
|
|
46
|
+
title: app.title,
|
|
47
|
+
description: app.description,
|
|
48
|
+
data: {},
|
|
49
|
+
});
|
|
27
50
|
}
|
|
28
51
|
}
|
|
29
|
-
//# sourceMappingURL=emit-bundle-manifest.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Bundle } from "../../workspace/workspace.ts";
|
|
2
|
+
import { BuildTarget } from "../build-target.ts";
|
|
3
|
+
import { BuildTask } from "./task.ts";
|
|
4
|
+
export declare class ComponentsDtsTask extends BuildTask {
|
|
5
|
+
readonly target: BuildTarget;
|
|
6
|
+
readonly bundle: Bundle;
|
|
7
|
+
constructor(target: BuildTarget, bundle: Bundle);
|
|
8
|
+
execute(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -2,7 +2,7 @@ import { join } from "node:path";
|
|
|
2
2
|
import { makeComponentPublication } from "../../workspace/component.js";
|
|
3
3
|
import { BuildTarget } from "../build-target.js";
|
|
4
4
|
import { BuildTask } from "./task.js";
|
|
5
|
-
import MIME from
|
|
5
|
+
import MIME from "mime";
|
|
6
6
|
export class ComponentsDtsTask extends BuildTask {
|
|
7
7
|
target;
|
|
8
8
|
bundle;
|
|
@@ -63,4 +63,3 @@ const components_dts_generators = {
|
|
|
63
63
|
"view.react": generate_view_react,
|
|
64
64
|
"commands": generate_commands,
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=emit-components-dts.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as esbuild from "esbuild";
|
|
2
|
+
import type { Log } from "../../workspace/helpers/logger.ts";
|
|
3
|
+
import { Library, WorkspaceItem } from "../../workspace/workspace.ts";
|
|
4
|
+
import type { ResourceEntry } from "../../workspace/component.ts";
|
|
5
|
+
import type { IStorageTransaction } from "../../workspace/storage.ts";
|
|
6
|
+
import { BuildTask } from "./task.ts";
|
|
7
|
+
export declare function StyleSheetPlugin(task: ESModulesTask): esbuild.Plugin;
|
|
8
|
+
export declare function StoragePlugin(task: ESModulesTask, onReady?: () => void): esbuild.Plugin;
|
|
9
|
+
export interface ESModuleResolverOptions {
|
|
10
|
+
task: ESModulesTask;
|
|
11
|
+
routeds?: Record<string, string>;
|
|
12
|
+
replaceds?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Collects workspace libraries reachable from a root library (BFS).
|
|
16
|
+
* Index 0 = most dominant.
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectLibraryGraph(rootLib: Library): Library[];
|
|
19
|
+
/**
|
|
20
|
+
* Generic dependency deduplication plugin.
|
|
21
|
+
*
|
|
22
|
+
* For each npm package seen across multiple workspace libraries, forces resolution
|
|
23
|
+
* from the dominant library (first in BFS order) to guarantee a single version.
|
|
24
|
+
* Packages declaring `"singleton": true` in their package.json are always resolved
|
|
25
|
+
* from the root node_modules.
|
|
26
|
+
*/
|
|
27
|
+
export declare function DependencyDeduplicationPlugin(libraries: Library[], rootNodeModules: string, log: Log): esbuild.Plugin;
|
|
28
|
+
/**
|
|
29
|
+
* Parses tsconfig.json compilerOptions (paths + baseUrl) and exposes resolved alias patterns.
|
|
30
|
+
* Looks for tsconfig.json in libraryPath first, then workspacePath as fallback.
|
|
31
|
+
*/
|
|
32
|
+
export declare class TSConfig {
|
|
33
|
+
readonly baseUrl: string | null;
|
|
34
|
+
readonly patterns: [string, string][];
|
|
35
|
+
readonly configFile: string | null;
|
|
36
|
+
readonly configData: any;
|
|
37
|
+
constructor(libraryPath: string, workspacePath: string);
|
|
38
|
+
get hasAliases(): boolean;
|
|
39
|
+
/** Resolve an import path against tsconfig path aliases. Returns the resolved file path or null. */
|
|
40
|
+
resolve(importPath: string, resolveFilePath: (importPath: string, baseDir: string) => string | null): string | null;
|
|
41
|
+
}
|
|
42
|
+
export declare function ESModuleResolverPlugin(opts: ESModuleResolverOptions, tsconfigPaths?: TSConfig): esbuild.Plugin;
|
|
43
|
+
export declare class ESModulesTask extends BuildTask {
|
|
44
|
+
entries: {
|
|
45
|
+
[url: string]: string;
|
|
46
|
+
};
|
|
47
|
+
imports: {
|
|
48
|
+
[file: string]: string;
|
|
49
|
+
};
|
|
50
|
+
internals: Map<string, string>;
|
|
51
|
+
plugins: esbuild.Plugin[];
|
|
52
|
+
context: esbuild.BuildContext;
|
|
53
|
+
transaction: IStorageTransaction;
|
|
54
|
+
polyfilled: boolean;
|
|
55
|
+
rootPath: string;
|
|
56
|
+
set_root(path: string): void;
|
|
57
|
+
add_entry(name: string, path: string): void;
|
|
58
|
+
add_entry_typescript(code: string, name?: string): string;
|
|
59
|
+
add_resource_entry(resource: ResourceEntry, baseDir: string, origin: WorkspaceItem): ResourceEntry;
|
|
60
|
+
execute(): Promise<void>;
|
|
61
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Fs from "node:fs";
|
|
2
|
-
import Path from
|
|
2
|
+
import Path from "node:path";
|
|
3
3
|
import Url from "node:url";
|
|
4
|
-
import MIME from
|
|
5
|
-
import postcss from
|
|
6
|
-
import * as esbuild from
|
|
7
|
-
import { sassPlugin } from
|
|
4
|
+
import MIME from "mime";
|
|
5
|
+
import postcss from "postcss";
|
|
6
|
+
import * as esbuild from "esbuild";
|
|
7
|
+
import { sassPlugin } from "esbuild-sass-plugin";
|
|
8
8
|
import { PackageRootDir, resolve_normalized_suffixed_path } from "../../utils/file.js";
|
|
9
|
-
import { Library } from "../../workspace/workspace.js";
|
|
9
|
+
import { Library, WorkspaceItem } from "../../workspace/workspace.js";
|
|
10
10
|
import { computeNameHashID } from "../../utils/normalized-name.js";
|
|
11
11
|
import { BuildTask } from "./task.js";
|
|
12
12
|
const VirtualOutDir = process.platform === 'win32' ? 'X:\\' : '/_/';
|
|
@@ -22,7 +22,7 @@ function getEsbuildLogLevel(mode) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
async function create_esbuild_context(task, devmode, onReady) {
|
|
25
|
-
const
|
|
25
|
+
const { library } = task.target;
|
|
26
26
|
// Define modules mapping - using @jspm/core polyfills (same as Vite)
|
|
27
27
|
const jspmPolyfills = Path.resolve(PackageRootDir, "node_modules/@jspm/core/nodelibs/browser");
|
|
28
28
|
// Side effects script that provides Node.js globals (like Buffer) for browser environment
|
|
@@ -52,7 +52,7 @@ async function create_esbuild_context(task, devmode, onReady) {
|
|
|
52
52
|
}
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
55
|
-
const tsconfig = new TSConfig(task.rootPath,
|
|
55
|
+
const tsconfig = new TSConfig(task.rootPath, library.path);
|
|
56
56
|
const modules_mapping = {
|
|
57
57
|
task,
|
|
58
58
|
routeds: {
|
|
@@ -76,9 +76,9 @@ async function create_esbuild_context(task, devmode, onReady) {
|
|
|
76
76
|
} : {}
|
|
77
77
|
};
|
|
78
78
|
// Define constants
|
|
79
|
-
const
|
|
79
|
+
const constants = Object.keys(library.constants).reduce((prev, key) => {
|
|
80
80
|
const name = `constants.${key}`;
|
|
81
|
-
prev[name] = JSON.stringify(
|
|
81
|
+
prev[name] = JSON.stringify(library.constants[key]);
|
|
82
82
|
return prev;
|
|
83
83
|
}, {});
|
|
84
84
|
const options = {
|
|
@@ -94,7 +94,7 @@ async function create_esbuild_context(task, devmode, onReady) {
|
|
|
94
94
|
splitting: true,
|
|
95
95
|
treeShaking: true,
|
|
96
96
|
write: false,
|
|
97
|
-
logLevel: getEsbuildLogLevel(
|
|
97
|
+
logLevel: getEsbuildLogLevel(library.log.logger.mode),
|
|
98
98
|
chunkNames: "chunk.[hash]",
|
|
99
99
|
jsx: "automatic",
|
|
100
100
|
jsxImportSource: "react",
|
|
@@ -105,7 +105,7 @@ async function create_esbuild_context(task, devmode, onReady) {
|
|
|
105
105
|
'global': 'globalThis',
|
|
106
106
|
"process.browser": "true",
|
|
107
107
|
"process.env.NODE_ENV": JSON.stringify(devmode ? "development" : "production"),
|
|
108
|
-
...
|
|
108
|
+
...constants,
|
|
109
109
|
},
|
|
110
110
|
plugins: [
|
|
111
111
|
ESModuleResolverPlugin(modules_mapping, tsconfig),
|
|
@@ -205,8 +205,8 @@ function copyAssets(task) {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
export function StyleSheetPlugin(task) {
|
|
208
|
-
const
|
|
209
|
-
const useTailwind = hasTailwindConfig(
|
|
208
|
+
const rootPath = task.target.library.path;
|
|
209
|
+
const useTailwind = hasTailwindConfig(rootPath);
|
|
210
210
|
if (useTailwind) {
|
|
211
211
|
task.log.info(`+ 🎨 Tailwind CSS detected`);
|
|
212
212
|
}
|
|
@@ -216,7 +216,7 @@ export function StyleSheetPlugin(task) {
|
|
|
216
216
|
const plugins = [];
|
|
217
217
|
if (useTailwind) {
|
|
218
218
|
const tailwindcss = (await import('@tailwindcss/postcss')).default;
|
|
219
|
-
plugins.push(tailwindcss({ base:
|
|
219
|
+
plugins.push(tailwindcss({ base: rootPath }));
|
|
220
220
|
}
|
|
221
221
|
plugins.push(copyAssets(task));
|
|
222
222
|
const { css } = await postcss(plugins)
|
|
@@ -495,7 +495,7 @@ export function ESModuleResolverPlugin(opts, tsconfigPaths) {
|
|
|
495
495
|
name: 'esm-resolver',
|
|
496
496
|
setup(build) {
|
|
497
497
|
const { routeds = {}, replaceds = {}, task } = opts;
|
|
498
|
-
const
|
|
498
|
+
const rootPath = task.target.library.path;
|
|
499
499
|
build.onResolve({ filter: /.*/ }, async (args) => {
|
|
500
500
|
// 0. Check for internal modules
|
|
501
501
|
if (task.internals.has(args.path)) {
|
|
@@ -526,7 +526,7 @@ export function ESModuleResolverPlugin(opts, tsconfigPaths) {
|
|
|
526
526
|
}
|
|
527
527
|
// 3. Handle relative/absolute file paths (entry points and local imports)
|
|
528
528
|
if (args.path.startsWith(".") || args.path.startsWith("/") || Path.isAbsolute(args.path)) {
|
|
529
|
-
const baseDir = args.resolveDir ||
|
|
529
|
+
const baseDir = args.resolveDir || rootPath;
|
|
530
530
|
const resolved = resolve_normalized_suffixed_path(baseDir, args.path);
|
|
531
531
|
if (resolved) {
|
|
532
532
|
return { path: resolved, namespace: "file" };
|
|
@@ -550,7 +550,7 @@ export function ESModuleResolverPlugin(opts, tsconfigPaths) {
|
|
|
550
550
|
}
|
|
551
551
|
const ext = Path.extname(args.path) || ".ts";
|
|
552
552
|
const loader = internalLoaders[ext] ?? "ts";
|
|
553
|
-
return { contents, loader, resolveDir:
|
|
553
|
+
return { contents, loader, resolveDir: rootPath };
|
|
554
554
|
});
|
|
555
555
|
},
|
|
556
556
|
};
|
|
@@ -579,20 +579,20 @@ export class ESModulesTask extends BuildTask {
|
|
|
579
579
|
this.add_entry(name, id);
|
|
580
580
|
return name;
|
|
581
581
|
}
|
|
582
|
-
add_resource_entry(resource, baseDir,
|
|
582
|
+
add_resource_entry(resource, baseDir, origin) {
|
|
583
583
|
if (typeof resource === "string") {
|
|
584
584
|
const parts = resource.split("#");
|
|
585
|
-
const file =
|
|
585
|
+
const file = origin.resolve_entry_path(parts[0], baseDir);
|
|
586
586
|
if (file) {
|
|
587
587
|
let named = this.imports[file];
|
|
588
588
|
if (!named) {
|
|
589
|
-
named =
|
|
589
|
+
named = origin.make_file_id("lambda", file);
|
|
590
590
|
this.add_entry(named, file);
|
|
591
591
|
}
|
|
592
592
|
return `./${named}.js#${parts[1] || "default"}`;
|
|
593
593
|
}
|
|
594
594
|
else {
|
|
595
|
-
|
|
595
|
+
origin.log.error(`Cannot resolve build resource file at: ${parts[0]}`);
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
else {
|
|
@@ -619,4 +619,3 @@ export class ESModulesTask extends BuildTask {
|
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
//# sourceMappingURL=emit-esmodules.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuildTask } from "./task.ts";
|
|
2
|
+
import type { BuildTarget } from "../build-target.ts";
|
|
3
|
+
import type { Library } from "../../workspace/workspace.ts";
|
|
4
|
+
export declare class PackageManifestTask extends BuildTask {
|
|
5
|
+
readonly library: Library;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
constructor(target: BuildTarget, library: Library, version: string);
|
|
8
|
+
execute(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -11,9 +11,8 @@ export class PackageManifestTask extends BuildTask {
|
|
|
11
11
|
}
|
|
12
12
|
async execute() {
|
|
13
13
|
const { library, version } = this;
|
|
14
|
-
const pkg = create_package_manifest(library, library.
|
|
14
|
+
const pkg = create_package_manifest(library, library.master, version);
|
|
15
15
|
const tx = this.target.edit();
|
|
16
16
|
tx.commitFile("package.json", JSON.stringify(pkg, null, 2));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=emit-package-manifest.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AssetsEntry, Library } from "../../workspace/workspace.ts";
|
|
2
|
+
import { BuildTask } from "./task.ts";
|
|
3
|
+
export type AssetMapping = {
|
|
4
|
+
from: string;
|
|
5
|
+
to: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class AssetsTask extends BuildTask {
|
|
8
|
+
assets: AssetMapping[];
|
|
9
|
+
statics: Record<string, string>;
|
|
10
|
+
add_entry(entry: AssetsEntry, baseDir: string, library: Library): void;
|
|
11
|
+
add_static_text(name: string, data: string): void;
|
|
12
|
+
add_static_json(name: string, data: any): void;
|
|
13
|
+
execute(): Promise<any>;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Path from "node:path";
|
|
2
|
-
import MIME from
|
|
2
|
+
import MIME from "mime";
|
|
3
3
|
import { Library } from "../../workspace/workspace.js";
|
|
4
4
|
import { copyToStorageStream } from "../../workspace/storage.js";
|
|
5
5
|
import { BuildTask } from "./task.js";
|
|
@@ -44,4 +44,3 @@ export class AssetsTask extends BuildTask {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
//# sourceMappingURL=emit-static-assets.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Ts from "typescript";
|
|
2
|
+
import { BuildTask } from "./task.ts";
|
|
3
|
+
import { BuildTarget } from "../build-target.ts";
|
|
4
|
+
import { Library } from "../../workspace/workspace.ts";
|
|
5
|
+
import { type ExportEntries } from "../../workspace/helpers/create-manifests.ts";
|
|
6
|
+
declare class TypescriptProject {
|
|
7
|
+
readonly baseDir: string;
|
|
8
|
+
readonly compilerOptions: Ts.CompilerOptions;
|
|
9
|
+
readonly dtsDir: string;
|
|
10
|
+
constructor(baseDir: string, tsconfig: string, outDir?: string);
|
|
11
|
+
/** Run tsgo to emit .d.ts files into dtsDir. Returns stderr output. */
|
|
12
|
+
emitWithTsgo(): Promise<void>;
|
|
13
|
+
/** Recursively collect all .d.ts files emitted by tsgo */
|
|
14
|
+
getEmittedDtsFiles(): string[];
|
|
15
|
+
/** Clean up temp directory */
|
|
16
|
+
cleanup(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function createTypescriptProject(baseDir: string, tsconfig: string, outDir?: string): TypescriptProject;
|
|
19
|
+
export declare function generateTypescriptDefinition(options: {
|
|
20
|
+
project: TypescriptProject;
|
|
21
|
+
exclude: string[];
|
|
22
|
+
externs?: string[];
|
|
23
|
+
types?: string[];
|
|
24
|
+
exports: ExportEntries;
|
|
25
|
+
includes?: string[];
|
|
26
|
+
prefix: string;
|
|
27
|
+
}): {
|
|
28
|
+
dts: string;
|
|
29
|
+
};
|
|
30
|
+
export declare class TypescriptDefinitionTask extends BuildTask {
|
|
31
|
+
readonly library: Library;
|
|
32
|
+
constructor(target: BuildTarget, library: Library);
|
|
33
|
+
execute(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Fs from
|
|
2
|
-
import Os from
|
|
3
|
-
import Path from
|
|
4
|
-
import Ts from
|
|
5
|
-
import { execFile } from
|
|
6
|
-
import { promisify } from
|
|
1
|
+
import Fs from "node:fs";
|
|
2
|
+
import Os from "node:os";
|
|
3
|
+
import Path from "node:path";
|
|
4
|
+
import Ts from "typescript";
|
|
5
|
+
import { execFile } from "node:child_process";
|
|
6
|
+
import { promisify } from "node:util";
|
|
7
7
|
import { BuildTask } from "./task.js";
|
|
8
8
|
import { BuildTarget } from "../build-target.js";
|
|
9
9
|
import { Library } from "../../workspace/workspace.js";
|
|
@@ -278,7 +278,7 @@ export class TypescriptDefinitionTask extends BuildTask {
|
|
|
278
278
|
project,
|
|
279
279
|
prefix: lib.name + ":",
|
|
280
280
|
exclude: ["node_modules/**/*"],
|
|
281
|
-
exports: create_export_map(lib, lib.
|
|
281
|
+
exports: create_export_map(lib, lib.master),
|
|
282
282
|
});
|
|
283
283
|
file.write.text(storage.getBaseDirFS() + "/types.d.ts", dts);
|
|
284
284
|
project.cleanup();
|
|
@@ -288,4 +288,3 @@ export class TypescriptDefinitionTask extends BuildTask {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
//# sourceMappingURL=emit-typescript-definition.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PathNode<State> = Map<string, PathNode<State> | State>;
|
|
2
|
+
export declare class PathQualifier<State> {
|
|
3
|
+
root: PathNode<State>;
|
|
4
|
+
set(path: string, state: State): boolean;
|
|
5
|
+
check(path: string): State | undefined;
|
|
6
|
+
match(path: string, update: (state: State, segments: string[], index: number) => State): State;
|
|
7
|
+
traverse(callback: (segments: string[], state: State) => void, _node?: PathNode<State>, _segments?: any[]): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createPathPrefixMatcher(prefixes: string[]): RegExp;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BuildTarget } from "../build-target.ts";
|
|
2
|
+
export declare abstract class BuildTask {
|
|
3
|
+
readonly target: BuildTarget;
|
|
4
|
+
constructor(target: BuildTarget);
|
|
5
|
+
get log(): import("../../workspace/helpers/logger.ts").Log;
|
|
6
|
+
init(): Promise<void>;
|
|
7
|
+
abstract execute(): Promise<void>;
|
|
8
|
+
}
|
package/esm/cli.d.ts
ADDED
package/esm/cli.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import Process from "node:process";
|
|
3
3
|
import Yargs from "yargs";
|
|
4
|
-
import { hideBin } from
|
|
4
|
+
import { hideBin } from "yargs/helpers";
|
|
5
5
|
import { command_run } from "./commands/run.js";
|
|
6
6
|
import { command_init } from "./commands/init.js";
|
|
7
7
|
import { command_install } from "./commands/install.js";
|
|
8
8
|
import { command_make } from "./commands/make.js";
|
|
9
9
|
import { command_serve } from "./commands/serve.js";
|
|
10
|
-
import { command_publish } from "./commands/publish.js";
|
|
11
10
|
function command_fail() {
|
|
12
11
|
return {
|
|
13
12
|
command: '*',
|
|
@@ -21,10 +20,8 @@ Yargs(hideBin(Process.argv)).scriptName("jointhedots-gear")
|
|
|
21
20
|
.command(command_install())
|
|
22
21
|
.command(command_make())
|
|
23
22
|
.command(command_serve())
|
|
24
|
-
.command(command_publish())
|
|
25
23
|
.command(command_run())
|
|
26
24
|
.command(command_fail())
|
|
27
25
|
.showHelpOnFail(true)
|
|
28
26
|
.help()
|
|
29
27
|
.parse();
|
|
30
|
-
//# sourceMappingURL=cli.js.map
|