@voxgig/model 2.3.0 → 3.0.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.
- package/dist/lib/build.d.ts +9 -32
- package/dist/lib/build.js +35 -11
- package/dist/lib/build.js.map +1 -1
- package/dist/lib/builder/local.d.ts +1 -1
- package/dist/lib/builder/local.js +62 -32
- package/dist/lib/builder/local.js.map +1 -1
- package/dist/lib/builder/model.d.ts +1 -1
- package/dist/lib/builder/model.js +5 -4
- package/dist/lib/builder/model.js.map +1 -1
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/config.js +1 -6
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/types.d.ts +48 -0
- package/dist/lib/types.js +3 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/watch.d.ts +3 -2
- package/dist/lib/watch.js +21 -16
- package/dist/lib/watch.js.map +1 -1
- package/dist/model.d.ts +2 -2
- package/dist/model.js +40 -40
- package/dist/model.js.map +1 -1
- package/lib/build.ts +60 -50
- package/lib/builder/local.ts +73 -35
- package/lib/builder/model.ts +8 -6
- package/lib/config.ts +2 -13
- package/lib/types.ts +67 -0
- package/lib/watch.ts +33 -21
- package/model.ts +50 -52
- package/package.json +3 -3
package/dist/lib/build.d.ts
CHANGED
|
@@ -1,43 +1,20 @@
|
|
|
1
1
|
import { Val } from 'aontu';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
path?: string;
|
|
6
|
-
build?: Build;
|
|
7
|
-
builders?: BuildResult[];
|
|
8
|
-
err?: any[];
|
|
9
|
-
}
|
|
10
|
-
interface BuildAction {
|
|
11
|
-
path: string;
|
|
12
|
-
build: Builder;
|
|
13
|
-
}
|
|
14
|
-
type Builder = (build: Build) => Promise<BuildResult>;
|
|
15
|
-
interface Spec {
|
|
16
|
-
src: string;
|
|
17
|
-
path?: string;
|
|
18
|
-
base?: string;
|
|
19
|
-
res?: BuildAction[];
|
|
20
|
-
require?: any;
|
|
21
|
-
use?: {
|
|
22
|
-
[name: string]: any;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
declare class Build {
|
|
2
|
+
import type { Build, BuildResult, BuildAction, BuildContext, Spec } from './types';
|
|
3
|
+
declare class BuildImpl implements Build {
|
|
4
|
+
id: string;
|
|
26
5
|
src: string;
|
|
27
6
|
base: string;
|
|
28
7
|
path: string;
|
|
29
|
-
root:
|
|
30
|
-
opts:
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
};
|
|
8
|
+
root: any;
|
|
9
|
+
opts: any;
|
|
33
10
|
res: BuildAction[];
|
|
34
11
|
spec: Spec;
|
|
35
12
|
model: any;
|
|
36
|
-
use: {
|
|
37
|
-
[name: string]: any;
|
|
38
|
-
};
|
|
13
|
+
use: {};
|
|
39
14
|
err: any[];
|
|
15
|
+
ctx: BuildContext;
|
|
40
16
|
constructor(spec: Spec);
|
|
41
17
|
run(): Promise<BuildResult>;
|
|
42
18
|
}
|
|
43
|
-
|
|
19
|
+
declare function makeBuild(spec: Spec): BuildImpl;
|
|
20
|
+
export { makeBuild, Spec, Val };
|
package/dist/lib/build.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Copyright © 2021-2023 Voxgig Ltd, MIT License. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.makeBuild = makeBuild;
|
|
5
5
|
const aontu_1 = require("aontu");
|
|
6
|
-
class
|
|
6
|
+
class BuildImpl {
|
|
7
7
|
constructor(spec) {
|
|
8
8
|
this.root = aontu_1.Nil.make();
|
|
9
9
|
this.use = {};
|
|
10
10
|
this.err = [];
|
|
11
|
+
this.id = String(Math.random()).substring(3, 15);
|
|
11
12
|
this.spec = spec;
|
|
12
13
|
this.src = spec.src;
|
|
13
14
|
this.base = null == spec.base ? '' : spec.base;
|
|
14
15
|
this.path = null == spec.path ? '' : spec.path;
|
|
15
16
|
this.opts = {};
|
|
17
|
+
this.ctx = { step: 'pre', state: {} };
|
|
16
18
|
if (null != spec.base) {
|
|
17
19
|
this.opts.base = spec.base;
|
|
18
20
|
this.opts.path = spec.path;
|
|
@@ -24,14 +26,30 @@ class Build {
|
|
|
24
26
|
Object.assign(this.use, spec.use || {});
|
|
25
27
|
}
|
|
26
28
|
async run() {
|
|
27
|
-
// console.log('BUILD RUN', this.path)
|
|
28
29
|
let hasErr = false;
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
this.ctx.step = 'pre';
|
|
31
|
+
const brlog = [];
|
|
32
|
+
for (let builder of this.res) {
|
|
33
|
+
try {
|
|
34
|
+
let br = await builder.build(this, this.ctx);
|
|
35
|
+
br.step = this.ctx.step;
|
|
36
|
+
br.path = builder.path;
|
|
37
|
+
br.builder = builder.build.name;
|
|
38
|
+
brlog.push(br);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
this.err.push(e);
|
|
42
|
+
hasErr = true;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!hasErr) {
|
|
47
|
+
this.root = (0, aontu_1.Aontu)(this.src, this.opts);
|
|
48
|
+
hasErr = this.root.err && 0 < this.root.err.length;
|
|
49
|
+
if (hasErr) {
|
|
50
|
+
this.err.push(...this.root.err);
|
|
51
|
+
}
|
|
33
52
|
}
|
|
34
|
-
let brlog = [];
|
|
35
53
|
if (!hasErr) {
|
|
36
54
|
let genctx = new aontu_1.Context({ root: this.root });
|
|
37
55
|
this.model = this.root.gen(genctx);
|
|
@@ -41,21 +59,27 @@ class Build {
|
|
|
41
59
|
}
|
|
42
60
|
else {
|
|
43
61
|
// TODO: only call if path value has changed
|
|
62
|
+
this.ctx.step = 'post';
|
|
44
63
|
for (let builder of this.res) {
|
|
45
64
|
try {
|
|
46
|
-
let br = await builder.build(this);
|
|
65
|
+
let br = await builder.build(this, this.ctx);
|
|
66
|
+
br.step = this.ctx.step;
|
|
47
67
|
br.path = builder.path;
|
|
48
68
|
br.builder = builder.build.name;
|
|
49
69
|
brlog.push(br);
|
|
50
70
|
}
|
|
51
71
|
catch (e) {
|
|
52
72
|
this.err.push(e);
|
|
73
|
+
break;
|
|
53
74
|
}
|
|
54
75
|
}
|
|
55
76
|
}
|
|
56
77
|
}
|
|
57
|
-
|
|
78
|
+
const br = { ok: !hasErr, build: this, builders: brlog, err: this.err };
|
|
79
|
+
return br;
|
|
58
80
|
}
|
|
59
81
|
}
|
|
60
|
-
|
|
82
|
+
function makeBuild(spec) {
|
|
83
|
+
return new BuildImpl(spec);
|
|
84
|
+
}
|
|
61
85
|
//# sourceMappingURL=build.js.map
|
package/dist/lib/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../lib/build.ts"],"names":[],"mappings":";AAAA,oDAAoD
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../lib/build.ts"],"names":[],"mappings":";AAAA,oDAAoD;;AAmIlD,8BAAS;AAhIX,iCAAgD;AAehD,MAAM,SAAS;IAeb,YAAY,IAAU;QAVtB,SAAI,GAAQ,WAAG,CAAC,IAAI,EAAE,CAAA;QAKtB,QAAG,GAAG,EAAE,CAAA;QACR,QAAG,GAAU,EAAE,CAAA;QAKb,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEhD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CA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O,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;wBAC5C,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAA;wBACvB,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;wBACtB,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA;wBAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;oBAChB,CAAC;oBACD,OAAO,CAAM,EAAE,CAAC;wBACd,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;wBAChB,MAAK;oBACP,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAA;QAEvE,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAGD,SAAS,SAAS,CAAC,IAAU;IAC3B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC"}
|
|
@@ -6,47 +6,78 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.local_builder = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
// Runs any builders local to the repo.
|
|
9
|
-
const local_builder = async (build) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
const local_builder = async (build, ctx) => {
|
|
10
|
+
ctx.state.local = (ctx.state.local || {});
|
|
11
|
+
let actionDefs = ctx.state.local.actionDefs;
|
|
12
|
+
if (null == actionDefs) {
|
|
13
|
+
try {
|
|
14
|
+
actionDefs = ctx.state.local.actionDefs = [];
|
|
15
|
+
// TODO: need to provide project root via build
|
|
16
|
+
let root = path_1.default.resolve(build.path, '..', '..');
|
|
17
|
+
// TODO: build should do this
|
|
18
|
+
let configbuild = build.use.config;
|
|
19
|
+
let config = configbuild.watch.last.build.model;
|
|
20
|
+
let builders = config.sys.model.builders;
|
|
21
|
+
// TODO: order by comma sep string
|
|
22
|
+
// Load builders
|
|
23
|
+
for (let name in builders) {
|
|
24
|
+
let builder = builders[name];
|
|
25
|
+
let action_path = path_1.default.join(root, builder.load);
|
|
26
|
+
clear(action_path);
|
|
27
|
+
let action = require(action_path);
|
|
28
|
+
if (action instanceof Promise) {
|
|
29
|
+
action = await action;
|
|
30
|
+
}
|
|
31
|
+
const step = action.step || 'post';
|
|
32
|
+
actionDefs.push({ name, builder, action, step });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
throw e;
|
|
34
37
|
}
|
|
35
|
-
return { ok: ok, brlog };
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
if ('pre' === ctx.step) {
|
|
40
|
+
try {
|
|
41
|
+
let ok = true;
|
|
42
|
+
let brlog = [];
|
|
43
|
+
for (let actionDef of actionDefs) {
|
|
44
|
+
if ('pre' === actionDef.step || 'all' === actionDef.step) {
|
|
45
|
+
let br = await actionDef.action(build.model, build);
|
|
46
|
+
ok = ok && null != br && br.ok;
|
|
47
|
+
brlog.push(br);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { ok: true, step: ctx.step, active: true };
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if ('post' === ctx.step) {
|
|
57
|
+
try {
|
|
58
|
+
let ok = true;
|
|
59
|
+
let brlog = [];
|
|
60
|
+
for (let actionDef of actionDefs) {
|
|
61
|
+
if ('post' === actionDef.step || 'all' === actionDef.step) {
|
|
62
|
+
let br = await actionDef.action(build.model, build);
|
|
63
|
+
ok = ok && null != br && br.ok;
|
|
64
|
+
brlog.push(br);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { ok: true, step: ctx.step, active: true };
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
40
72
|
}
|
|
73
|
+
return { ok: false, why: 'bad-step', step: ctx.step, active: false };
|
|
41
74
|
};
|
|
42
75
|
exports.local_builder = local_builder;
|
|
43
76
|
// Adapted from https://github.com/sindresorhus/import-fresh - Thanks!
|
|
44
77
|
function clear(path) {
|
|
45
78
|
let filePath = require.resolve(path);
|
|
46
|
-
// console.log('CM fp', filePath)
|
|
47
79
|
if (require.cache[filePath]) {
|
|
48
80
|
const children = require.cache[filePath].children.map(child => child.id);
|
|
49
|
-
// console.log('CM-B', filePath, children)
|
|
50
81
|
// Delete module from cache
|
|
51
82
|
delete require.cache[filePath];
|
|
52
83
|
for (const id of children) {
|
|
@@ -55,7 +86,6 @@ function clear(path) {
|
|
|
55
86
|
}
|
|
56
87
|
if (require.cache[filePath] && require.cache[filePath].parent) {
|
|
57
88
|
let i = require.cache[filePath].parent.children.length;
|
|
58
|
-
// console.log('CM-A', filePath, require.cache[filePath].parent.children)
|
|
59
89
|
while (i--) {
|
|
60
90
|
if (require.cache[filePath].parent.children[i].id === filePath) {
|
|
61
91
|
require.cache[filePath].parent.children.splice(i, 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../../lib/builder/local.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAKvB,uCAAuC;AACvC,MAAM,aAAa,GAAY,KAAK,EAAE,KAAY,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Q,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;QAC9D,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA;QAEtD,OAAO,CAAC,EAAE,EAAE,CAAC;YACX,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;gBAC/D,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YACtD,CAAC;QACH,CAAC;IACH,CAAC;AAEH,CAAC"}
|
|
@@ -7,7 +7,10 @@ exports.model_builder = void 0;
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const promises_1 = require("fs/promises");
|
|
9
9
|
// Builds the main model file, after unification.
|
|
10
|
-
const model_builder = async (build) => {
|
|
10
|
+
const model_builder = async (build, ctx) => {
|
|
11
|
+
if ('post' !== ctx.step) {
|
|
12
|
+
return { ok: true, step: ctx.step, active: false };
|
|
13
|
+
}
|
|
11
14
|
try {
|
|
12
15
|
let json = JSON.stringify(build.root.gen(), null, 2);
|
|
13
16
|
let filename = path_1.default.basename(build.path);
|
|
@@ -16,12 +19,10 @@ const model_builder = async (build) => {
|
|
|
16
19
|
filename = filenameparts[1];
|
|
17
20
|
}
|
|
18
21
|
let file = build.opts.base + '/' + filename + '.json';
|
|
19
|
-
// console.log('MODEL BUILDER', file)
|
|
20
22
|
await (0, promises_1.writeFile)(file, json);
|
|
21
|
-
return { ok: true };
|
|
23
|
+
return { ok: true, step: ctx.step, active: true };
|
|
22
24
|
}
|
|
23
25
|
catch (e) {
|
|
24
|
-
console.log('MODEL BUILD model', e);
|
|
25
26
|
throw e;
|
|
26
27
|
}
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../lib/builder/model.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAEvB,0CAAuC;AAKvC,iDAAiD;AACjD,MAAM,aAAa,GAAY,KAAK,EAAE,KAAY,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../lib/builder/model.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AAEvB,0CAAuC;AAKvC,iDAAiD;AACjD,MAAM,aAAa,GAAY,KAAK,EAAE,KAAY,EAAE,GAAiB,EAAE,EAAE;IACvE,IAAI,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;QACxB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;IACpD,CAAC;IAED,IAAI,CAAC;QACH,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAEpD,IAAI,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACxC,IAAI,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACnD,IAAI,aAAa,EAAE,CAAC;YAClB,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;QAC7B,CAAC;QAED,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAA;QAErD,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAE3B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;IACnD,CAAC;IACD,OAAO,CAAM,EAAE,CAAC;QACd,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC,CAAA;AAGC,sCAAa"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BuildResult, Spec } from './
|
|
1
|
+
import type { BuildResult, Spec } from './types';
|
|
2
2
|
import { Watch } from './watch';
|
|
3
3
|
declare class Config {
|
|
4
4
|
build: any;
|
|
5
5
|
watch: Watch;
|
|
6
6
|
constructor(spec: Spec);
|
|
7
7
|
run(): Promise<BuildResult>;
|
|
8
|
-
start(): Promise<
|
|
8
|
+
start(): Promise<BuildResult>;
|
|
9
9
|
stop(): Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
export { Config, Spec };
|
package/dist/lib/config.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* Copyright © 2021-
|
|
2
|
+
/* Copyright © 2021-2024 Voxgig Ltd, MIT License. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Config = void 0;
|
|
5
5
|
const watch_1 = require("./watch");
|
|
6
|
-
const model_1 = require("./builder/model");
|
|
7
6
|
class Config {
|
|
8
7
|
constructor(spec) {
|
|
9
8
|
this.build = {
|
|
@@ -11,10 +10,6 @@ class Config {
|
|
|
11
10
|
path: spec.path,
|
|
12
11
|
base: spec.base,
|
|
13
12
|
res: [
|
|
14
|
-
{
|
|
15
|
-
path: '/',
|
|
16
|
-
build: model_1.model_builder
|
|
17
|
-
},
|
|
18
13
|
...(spec.res || [])
|
|
19
14
|
],
|
|
20
15
|
require: spec.require
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAKpD,mCAA+B;AAS/B,MAAM,MAAM;IAIV,YAAY,IAAU;QACpB,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE;gBACH,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;aACpB;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC3B,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC1B,CAAC;CACF;AAGQ,wBAAM"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
interface Build {
|
|
2
|
+
id: string;
|
|
3
|
+
src: string;
|
|
4
|
+
base: string;
|
|
5
|
+
path: string;
|
|
6
|
+
root: any;
|
|
7
|
+
opts: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
res: BuildAction[];
|
|
11
|
+
spec: Spec;
|
|
12
|
+
model: any;
|
|
13
|
+
use: {
|
|
14
|
+
[name: string]: any;
|
|
15
|
+
};
|
|
16
|
+
err: any[];
|
|
17
|
+
ctx: BuildContext;
|
|
18
|
+
run: () => Promise<BuildResult>;
|
|
19
|
+
}
|
|
20
|
+
interface BuildResult {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
builder?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
build?: Build;
|
|
25
|
+
builders?: BuildResult[];
|
|
26
|
+
step?: string;
|
|
27
|
+
err?: any[];
|
|
28
|
+
}
|
|
29
|
+
interface BuildAction {
|
|
30
|
+
path: string;
|
|
31
|
+
build: Builder;
|
|
32
|
+
}
|
|
33
|
+
interface BuildContext {
|
|
34
|
+
step: 'pre' | 'post';
|
|
35
|
+
state: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
type Builder = (build: Build, ctx: BuildContext) => Promise<BuildResult>;
|
|
38
|
+
interface Spec {
|
|
39
|
+
src: string;
|
|
40
|
+
path?: string;
|
|
41
|
+
base?: string;
|
|
42
|
+
res?: BuildAction[];
|
|
43
|
+
require?: any;
|
|
44
|
+
use?: {
|
|
45
|
+
[name: string]: any;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export type { Build, BuildResult, BuildAction, Builder, BuildContext, Spec, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":""}
|
package/dist/lib/watch.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { BuildResult } from './
|
|
1
|
+
import type { Build, BuildResult } from './types';
|
|
2
2
|
import { FSWatcher } from 'chokidar';
|
|
3
3
|
declare class Watch {
|
|
4
4
|
fsw: FSWatcher;
|
|
5
5
|
spec: any;
|
|
6
6
|
last?: BuildResult;
|
|
7
7
|
last_change_time: number;
|
|
8
|
+
build: Build | undefined;
|
|
8
9
|
constructor(spec: any);
|
|
9
10
|
add(file: string): void;
|
|
10
11
|
update(br: BuildResult): void;
|
|
11
|
-
start(): Promise<
|
|
12
|
+
start(): Promise<BuildResult>;
|
|
12
13
|
run(once?: boolean): Promise<BuildResult>;
|
|
13
14
|
stop(): Promise<void>;
|
|
14
15
|
handleErrors(br: BuildResult): void;
|
package/dist/lib/watch.js
CHANGED
|
@@ -9,6 +9,8 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const build_1 = require("./build");
|
|
10
10
|
const chokidar_1 = require("chokidar");
|
|
11
11
|
const promises_1 = require("fs/promises");
|
|
12
|
+
const print = console.log;
|
|
13
|
+
const warn = console.warn;
|
|
12
14
|
class Watch {
|
|
13
15
|
constructor(spec) {
|
|
14
16
|
this.spec = spec;
|
|
@@ -16,8 +18,10 @@ class Watch {
|
|
|
16
18
|
this.last_change_time = 0;
|
|
17
19
|
const run = this.run.bind(this);
|
|
18
20
|
this.fsw.on('change', () => {
|
|
21
|
+
// TODO: needs a much more robust queue that checks for dups,
|
|
22
|
+
// otherwise BuildContext state will have concurrency corruptions
|
|
19
23
|
// Avoid rebuilding when, for example, TS rewrites all files in dist
|
|
20
|
-
if (
|
|
24
|
+
if (1 < Date.now() - this.last_change_time) {
|
|
21
25
|
run();
|
|
22
26
|
}
|
|
23
27
|
});
|
|
@@ -26,11 +30,9 @@ class Watch {
|
|
|
26
30
|
if (!node_path_1.default.isAbsolute(file)) {
|
|
27
31
|
file = node_path_1.default.join(this.spec.require, file);
|
|
28
32
|
}
|
|
29
|
-
// console.log('WATCH ADD', file)
|
|
30
33
|
this.fsw.add(file);
|
|
31
34
|
}
|
|
32
35
|
update(br) {
|
|
33
|
-
// console.log('BUILD RESULT', br)
|
|
34
36
|
let build = br.build;
|
|
35
37
|
let files = Object.keys(build.root.deps).reduce((files, target) => {
|
|
36
38
|
files = files.concat(Object.keys(build.root.deps[target]));
|
|
@@ -44,32 +46,32 @@ class Watch {
|
|
|
44
46
|
this.fsw.add(file);
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
|
-
// setTimeout(() => {
|
|
48
|
-
// console.log('WATCH', this.fsw.getWatched())
|
|
49
|
-
// }, 100)
|
|
50
49
|
}
|
|
50
|
+
// Returns first BuildResult
|
|
51
51
|
async start() {
|
|
52
|
-
await this.run(false);
|
|
52
|
+
return await this.run(false);
|
|
53
53
|
}
|
|
54
54
|
async run(once) {
|
|
55
55
|
var _a, _b;
|
|
56
56
|
this.last_change_time = Date.now();
|
|
57
|
-
|
|
57
|
+
print('\n@voxgig/model', new Date(this.last_change_time));
|
|
58
58
|
// TODO: build spec should not have src!
|
|
59
59
|
let src = (await (0, promises_1.readFile)(this.spec.path)).toString();
|
|
60
60
|
this.spec.src = src;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
this.build = this.build || (0, build_1.makeBuild)(this.spec);
|
|
62
|
+
// TODO: better way to do this?
|
|
63
|
+
this.build.src = src;
|
|
64
|
+
let br = await this.build.run();
|
|
65
|
+
print('\nFILES:\n' + this.descDeps(br.build.root.deps) + '\n');
|
|
64
66
|
if (br.ok) {
|
|
65
|
-
|
|
67
|
+
print('TOP:', Object.keys((_a = br === null || br === void 0 ? void 0 : br.build) === null || _a === void 0 ? void 0 : _a.model).join(', '), '\n');
|
|
66
68
|
if (!once) {
|
|
67
69
|
// There may be new files.
|
|
68
70
|
this.update(br);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
else {
|
|
72
|
-
|
|
74
|
+
warn('MODEL ERRORS: ' + ((_b = br.err) === null || _b === void 0 ? void 0 : _b.length));
|
|
73
75
|
this.handleErrors(br);
|
|
74
76
|
}
|
|
75
77
|
this.last = br;
|
|
@@ -82,18 +84,21 @@ class Watch {
|
|
|
82
84
|
if (br.err) {
|
|
83
85
|
for (let be of br.err) {
|
|
84
86
|
if (be.msg) {
|
|
85
|
-
|
|
87
|
+
warn(be.msg);
|
|
86
88
|
}
|
|
87
89
|
else if (be.message) {
|
|
88
|
-
|
|
90
|
+
warn(be.message);
|
|
89
91
|
}
|
|
90
92
|
else {
|
|
91
|
-
|
|
93
|
+
warn(be);
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
descDeps(deps) {
|
|
99
|
+
if (null == deps) {
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
97
102
|
let desc = [];
|
|
98
103
|
for (let entryPath of Object.keys(deps)) {
|
|
99
104
|
desc.push(' ' + entryPath);
|
package/dist/lib/watch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../lib/watch.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,0DAA4B;
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../lib/watch.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;;;;AAEpD,0DAA4B;AAK5B,mCAAmC;AACnC,uCAAoC;AAEpC,0CAAsC;AAGtC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAA;AACzB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAGzB,MAAM,KAAK;IAOT,YAAY,IAAS;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,GAAG,GAAG,IAAI,oBAAS,EAAE,CAAA;QAC1B,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAA;QAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAE/B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAEzB,6DAA6D;YAC7D,iEAAiE;YACjE,oEAAoE;YACpE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC3C,GAAG,EAAE,CAAA;YACP,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAGD,GAAG,CAAC,IAAY;QACd,IAAI,CAAC,mBAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,IAAI,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;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I,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;gBACd,CAAC;qBACI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;oBACpB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;gBAClB,CAAC;qBACI,CAAC;oBACJ,IAAI,CAAC,EAAE,CAAC,CAAA;gBACV,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,IAAqD;QAC5D,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,OAAO,EAAE,CAAA;QACX,CAAC;QAED,IAAI,IAAI,GAAG,EAAE,CAAA;QACb,KAAK,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;YAC3B,KAAK,IAAI,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;gBACjD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxB,CAAC;CACF;AAIC,sBAAK"}
|
package/dist/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { BuildResult, Spec } from './lib/types';
|
|
1
2
|
import { Config } from './lib/config';
|
|
2
|
-
import { BuildResult, Spec } from './lib/build';
|
|
3
3
|
import { Watch } from './lib/watch';
|
|
4
4
|
declare class Model {
|
|
5
5
|
config: Config;
|
|
@@ -8,7 +8,7 @@ declare class Model {
|
|
|
8
8
|
trigger_model: boolean;
|
|
9
9
|
constructor(spec: Spec);
|
|
10
10
|
run(): Promise<BuildResult>;
|
|
11
|
-
start(): Promise<
|
|
11
|
+
start(): Promise<BuildResult>;
|
|
12
12
|
stop(): Promise<void>;
|
|
13
13
|
}
|
|
14
14
|
export { Model, Spec, };
|