@vertesia/memory-commands 0.78.0-dev-9372725 → 0.78.0-dev.1
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/lib/cjs/build.js +77 -0
- package/lib/cjs/build.js.map +1 -0
- package/lib/cjs/index.js +51 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/ts-loader.js +124 -0
- package/lib/cjs/ts-loader.js.map +1 -0
- package/lib/esm/build.js +40 -0
- package/lib/esm/build.js.map +1 -0
- package/lib/esm/index.js +36 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/ts-loader.js +88 -0
- package/lib/esm/ts-loader.js.map +1 -0
- package/lib/types/build.d.ts +4 -0
- package/lib/types/build.d.ts.map +1 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/ts-loader.d.ts +2 -0
- package/lib/types/ts-loader.d.ts.map +1 -0
- package/package.json +37 -37
package/lib/cjs/build.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getBuilder = getBuilder;
|
|
37
|
+
exports.build = build;
|
|
38
|
+
const memory_1 = require("@vertesia/memory");
|
|
39
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
40
|
+
const path_1 = require("path");
|
|
41
|
+
const ts_loader_js_1 = require("./ts-loader.js");
|
|
42
|
+
const als = new node_async_hooks_1.AsyncLocalStorage();
|
|
43
|
+
function getBuilder() {
|
|
44
|
+
const builder = als.getStore();
|
|
45
|
+
if (!builder) {
|
|
46
|
+
throw new Error("No builder found in the current context.");
|
|
47
|
+
}
|
|
48
|
+
return builder;
|
|
49
|
+
}
|
|
50
|
+
function build(script, options = {}) {
|
|
51
|
+
const builder = new memory_1.Builder(options);
|
|
52
|
+
return als.run(builder, () => {
|
|
53
|
+
return _build(builder, script, options.transpileDir);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function _build(builder, script, transpileDir) {
|
|
57
|
+
const resolvedScript = (0, path_1.resolve)(script);
|
|
58
|
+
let module;
|
|
59
|
+
if (resolvedScript.endsWith('.ts')) {
|
|
60
|
+
try {
|
|
61
|
+
module = await (0, ts_loader_js_1.importTsFile)(resolvedScript, transpileDir);
|
|
62
|
+
}
|
|
63
|
+
catch (er) {
|
|
64
|
+
console.error(er);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
module = await Promise.resolve(`${resolvedScript}`).then(s => __importStar(require(s)));
|
|
70
|
+
}
|
|
71
|
+
const output = module?.default;
|
|
72
|
+
if (!output) {
|
|
73
|
+
throw new Error("No default export found in the script.");
|
|
74
|
+
}
|
|
75
|
+
await builder.build(output);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,gCAMC;AAED,sBAKC;AApBD,6CAAyD;AACzD,uDAAqD;AACrD,+BAA+B;AAC/B,iDAA8C;AAE9C,MAAM,GAAG,GAAG,IAAI,oCAAiB,EAAW,CAAC;AAE7C,SAAgB,UAAU;IACtB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAgB,KAAK,CAAC,MAAc,EAAE,UAAwB,EAAE;IAC5D,MAAM,OAAO,GAAG,IAAI,gBAAO,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE;QACzB,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,OAAgB,EAAE,MAAc,EAAE,YAAqB;IACzE,MAAM,cAAc,GAAG,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC;IACvC,IAAI,MAAW,CAAC;IAChB,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC;YACD,MAAM,GAAG,MAAM,IAAA,2BAAY,EAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,EAAO,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,yBAAa,cAAc,uCAAC,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBuilder = exports.build = void 0;
|
|
4
|
+
exports.content = content;
|
|
5
|
+
exports.copy = copy;
|
|
6
|
+
exports.copyText = copyText;
|
|
7
|
+
exports.docx = docx;
|
|
8
|
+
exports.exec = exec;
|
|
9
|
+
exports.from = from;
|
|
10
|
+
exports.json = json;
|
|
11
|
+
exports.media = media;
|
|
12
|
+
exports.pdf = pdf;
|
|
13
|
+
exports.tmpdir = tmpdir;
|
|
14
|
+
exports.vars = vars;
|
|
15
|
+
const build_js_1 = require("./build.js");
|
|
16
|
+
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_js_1.build; } });
|
|
17
|
+
Object.defineProperty(exports, "getBuilder", { enumerable: true, get: function () { return build_js_1.getBuilder; } });
|
|
18
|
+
function vars() {
|
|
19
|
+
return (0, build_js_1.getBuilder)().vars();
|
|
20
|
+
}
|
|
21
|
+
function tmpdir() {
|
|
22
|
+
return (0, build_js_1.getBuilder)().tmpdir();
|
|
23
|
+
}
|
|
24
|
+
function from(...args) {
|
|
25
|
+
return (0, build_js_1.getBuilder)().from(...args);
|
|
26
|
+
}
|
|
27
|
+
function exec(...args) {
|
|
28
|
+
return (0, build_js_1.getBuilder)().exec(...args);
|
|
29
|
+
}
|
|
30
|
+
function copy(...args) {
|
|
31
|
+
return (0, build_js_1.getBuilder)().copy(...args);
|
|
32
|
+
}
|
|
33
|
+
function copyText(...args) {
|
|
34
|
+
return (0, build_js_1.getBuilder)().copyText(...args);
|
|
35
|
+
}
|
|
36
|
+
function content(...args) {
|
|
37
|
+
return (0, build_js_1.getBuilder)().content(...args);
|
|
38
|
+
}
|
|
39
|
+
function json(...args) {
|
|
40
|
+
return (0, build_js_1.getBuilder)().json(...args);
|
|
41
|
+
}
|
|
42
|
+
function pdf(...args) {
|
|
43
|
+
return (0, build_js_1.getBuilder)().pdf(...args);
|
|
44
|
+
}
|
|
45
|
+
function docx(...args) {
|
|
46
|
+
return (0, build_js_1.getBuilder)().docx(...args);
|
|
47
|
+
}
|
|
48
|
+
function media(...args) {
|
|
49
|
+
return (0, build_js_1.getBuilder)().media(...args);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAiDW,0BAAO;AAAE,oBAAI;AAAE,4BAAQ;AAAE,oBAAI;AAAE,oBAAI;AAAE,oBAAI;AAAc,oBAAI;AAAE,sBAAK;AAAE,kBAAG;AAAE,wBAAM;AAAE,oBAAI;AAhDhG,yCAA+C;AAgD3C,sFAhDK,gBAAK,OAgDL;AAA6C,2FAhDtC,qBAAU,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AC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.importTsFile = importTsFile;
|
|
37
|
+
const fs_1 = require("fs");
|
|
38
|
+
const path_1 = require("path");
|
|
39
|
+
const ts = __importStar(require("typescript"));
|
|
40
|
+
function compile(fileNames, options) {
|
|
41
|
+
let program = ts.createProgram(fileNames, {
|
|
42
|
+
...options,
|
|
43
|
+
listEmittedFiles: true,
|
|
44
|
+
});
|
|
45
|
+
let emitResult = program.emit();
|
|
46
|
+
let allDiagnostics = ts
|
|
47
|
+
.getPreEmitDiagnostics(program)
|
|
48
|
+
.concat(emitResult.diagnostics);
|
|
49
|
+
let errors = 0;
|
|
50
|
+
allDiagnostics.forEach(diagnostic => {
|
|
51
|
+
let prefix = '';
|
|
52
|
+
const categories = new Set();
|
|
53
|
+
if (diagnostic.relatedInformation && diagnostic.relatedInformation.length > 0) {
|
|
54
|
+
for (const ri of diagnostic.relatedInformation) {
|
|
55
|
+
categories.add(ri.category);
|
|
56
|
+
}
|
|
57
|
+
if (categories.has(ts.DiagnosticCategory.Error)) {
|
|
58
|
+
prefix: 'Error: ';
|
|
59
|
+
errors++;
|
|
60
|
+
}
|
|
61
|
+
else if (categories.has(ts.DiagnosticCategory.Warning)) {
|
|
62
|
+
prefix: 'Warning: ';
|
|
63
|
+
}
|
|
64
|
+
else if (categories.has(ts.DiagnosticCategory.Suggestion)) {
|
|
65
|
+
prefix: 'Suggestion: ';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (diagnostic.file) {
|
|
69
|
+
let { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
70
|
+
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
71
|
+
console.log(`${prefix}${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.log(prefix + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
errors,
|
|
79
|
+
emittedFiles: emitResult.emittedFiles
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function transpileFile(source, target, options) {
|
|
83
|
+
const input = (0, fs_1.readFileSync)(source, "utf-8");
|
|
84
|
+
// now simply transpile the module to javascript
|
|
85
|
+
const output = ts.transpileModule(input, {
|
|
86
|
+
compilerOptions: options
|
|
87
|
+
});
|
|
88
|
+
(0, fs_1.writeFileSync)(target, output.outputText, "utf-8");
|
|
89
|
+
}
|
|
90
|
+
function tryDeleteFile(file) {
|
|
91
|
+
try {
|
|
92
|
+
(0, fs_1.rmSync)(file);
|
|
93
|
+
}
|
|
94
|
+
catch (_er) {
|
|
95
|
+
// ignore
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function importTsFile(file, outdir = '.') {
|
|
99
|
+
if (!file.endsWith('.ts')) {
|
|
100
|
+
throw new Error("Not a type script file: " + file);
|
|
101
|
+
}
|
|
102
|
+
file = (0, path_1.resolve)(file);
|
|
103
|
+
const baseOptions = {
|
|
104
|
+
skipLibCheck: true,
|
|
105
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
106
|
+
module: ts.ModuleKind.ESNext,
|
|
107
|
+
target: ts.ScriptTarget.ESNext,
|
|
108
|
+
};
|
|
109
|
+
// we nly use compile to find errors. To generate the code we use transpileModule
|
|
110
|
+
// since the compile will generate js files for all the dependencies.
|
|
111
|
+
const result = compile([file], {
|
|
112
|
+
...baseOptions,
|
|
113
|
+
noEmit: true
|
|
114
|
+
});
|
|
115
|
+
if (result.errors > 0) {
|
|
116
|
+
console.log(`Found ${result.errors} in typescript compilation. Aborting.`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
const fname = (0, path_1.basename)(file).slice(0, -3);
|
|
120
|
+
const emittedFile = (0, path_1.resolve)(outdir, `__${Date.now()}-${fname}.mjs`);
|
|
121
|
+
transpileFile(file, emittedFile, baseOptions);
|
|
122
|
+
return Promise.resolve(`${emittedFile}`).then(s => __importStar(require(s))).finally(() => tryDeleteFile(emittedFile));
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ts-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-loader.js","sourceRoot":"","sources":["../../src/ts-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,oCA0BC;AA3FD,2BAAyD;AACzD,+BAAyC;AACzC,+CAAiC;AAEjC,SAAS,OAAO,CAAC,SAAmB,EAAE,OAA2B;IAC7D,IAAI,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE;QACtC,GAAG,OAAO;QACV,gBAAgB,EAAE,IAAI;KACI,CAAC,CAAC;IAChC,IAAI,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAEhC,IAAI,cAAc,GAAG,EAAE;SAClB,qBAAqB,CAAC,OAAO,CAAC;SAC9B,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEpC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAChC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;QACpD,IAAI,UAAU,CAAC,kBAAkB,IAAI,UAAU,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5E,KAAK,MAAM,EAAE,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC;gBAC7C,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;YAChC,CAAC;YACD,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,MAAM,EAAE,SAAS,CAAC;gBAClB,MAAM,EAAE,CAAC;YACb,CAAC;iBAAM,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB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AAW,CAAC,CAAC;IAE9C,OAAO,mBAAO,WAAW,wCAAE,OAAO,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
package/lib/esm/build.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Builder } from "@vertesia/memory";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { importTsFile } from "./ts-loader.js";
|
|
5
|
+
const als = new AsyncLocalStorage();
|
|
6
|
+
export function getBuilder() {
|
|
7
|
+
const builder = als.getStore();
|
|
8
|
+
if (!builder) {
|
|
9
|
+
throw new Error("No builder found in the current context.");
|
|
10
|
+
}
|
|
11
|
+
return builder;
|
|
12
|
+
}
|
|
13
|
+
export function build(script, options = {}) {
|
|
14
|
+
const builder = new Builder(options);
|
|
15
|
+
return als.run(builder, () => {
|
|
16
|
+
return _build(builder, script, options.transpileDir);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async function _build(builder, script, transpileDir) {
|
|
20
|
+
const resolvedScript = resolve(script);
|
|
21
|
+
let module;
|
|
22
|
+
if (resolvedScript.endsWith('.ts')) {
|
|
23
|
+
try {
|
|
24
|
+
module = await importTsFile(resolvedScript, transpileDir);
|
|
25
|
+
}
|
|
26
|
+
catch (er) {
|
|
27
|
+
console.error(er);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
module = await import(resolvedScript);
|
|
33
|
+
}
|
|
34
|
+
const output = module?.default;
|
|
35
|
+
if (!output) {
|
|
36
|
+
throw new Error("No default export found in the script.");
|
|
37
|
+
}
|
|
38
|
+
await builder.build(output);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/build.ts"],"names":[],"mappings":"AAA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AAM,MAAM,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { build, getBuilder } from "./build.js";
|
|
2
|
+
function vars() {
|
|
3
|
+
return getBuilder().vars();
|
|
4
|
+
}
|
|
5
|
+
function tmpdir() {
|
|
6
|
+
return getBuilder().tmpdir();
|
|
7
|
+
}
|
|
8
|
+
function from(...args) {
|
|
9
|
+
return getBuilder().from(...args);
|
|
10
|
+
}
|
|
11
|
+
function exec(...args) {
|
|
12
|
+
return getBuilder().exec(...args);
|
|
13
|
+
}
|
|
14
|
+
function copy(...args) {
|
|
15
|
+
return getBuilder().copy(...args);
|
|
16
|
+
}
|
|
17
|
+
function copyText(...args) {
|
|
18
|
+
return getBuilder().copyText(...args);
|
|
19
|
+
}
|
|
20
|
+
function content(...args) {
|
|
21
|
+
return getBuilder().content(...args);
|
|
22
|
+
}
|
|
23
|
+
function json(...args) {
|
|
24
|
+
return getBuilder().json(...args);
|
|
25
|
+
}
|
|
26
|
+
function pdf(...args) {
|
|
27
|
+
return getBuilder().pdf(...args);
|
|
28
|
+
}
|
|
29
|
+
function docx(...args) {
|
|
30
|
+
return getBuilder().docx(...args);
|
|
31
|
+
}
|
|
32
|
+
function media(...args) {
|
|
33
|
+
return getBuilder().media(...args);
|
|
34
|
+
}
|
|
35
|
+
export { build, content, copy, copyText, docx, exec, from, getBuilder, json, media, pdf, tmpdir, vars };
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index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AAC,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,OAAO,EACH,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAC/F,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { readFileSync, rmSync, writeFileSync } from "fs";
|
|
2
|
+
import { basename, resolve } from "path";
|
|
3
|
+
import * as ts from "typescript";
|
|
4
|
+
function compile(fileNames, options) {
|
|
5
|
+
let program = ts.createProgram(fileNames, {
|
|
6
|
+
...options,
|
|
7
|
+
listEmittedFiles: true,
|
|
8
|
+
});
|
|
9
|
+
let emitResult = program.emit();
|
|
10
|
+
let allDiagnostics = ts
|
|
11
|
+
.getPreEmitDiagnostics(program)
|
|
12
|
+
.concat(emitResult.diagnostics);
|
|
13
|
+
let errors = 0;
|
|
14
|
+
allDiagnostics.forEach(diagnostic => {
|
|
15
|
+
let prefix = '';
|
|
16
|
+
const categories = new Set();
|
|
17
|
+
if (diagnostic.relatedInformation && diagnostic.relatedInformation.length > 0) {
|
|
18
|
+
for (const ri of diagnostic.relatedInformation) {
|
|
19
|
+
categories.add(ri.category);
|
|
20
|
+
}
|
|
21
|
+
if (categories.has(ts.DiagnosticCategory.Error)) {
|
|
22
|
+
prefix: 'Error: ';
|
|
23
|
+
errors++;
|
|
24
|
+
}
|
|
25
|
+
else if (categories.has(ts.DiagnosticCategory.Warning)) {
|
|
26
|
+
prefix: 'Warning: ';
|
|
27
|
+
}
|
|
28
|
+
else if (categories.has(ts.DiagnosticCategory.Suggestion)) {
|
|
29
|
+
prefix: 'Suggestion: ';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (diagnostic.file) {
|
|
33
|
+
let { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
34
|
+
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
35
|
+
console.log(`${prefix}${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(prefix + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
errors,
|
|
43
|
+
emittedFiles: emitResult.emittedFiles
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function transpileFile(source, target, options) {
|
|
47
|
+
const input = readFileSync(source, "utf-8");
|
|
48
|
+
// now simply transpile the module to javascript
|
|
49
|
+
const output = ts.transpileModule(input, {
|
|
50
|
+
compilerOptions: options
|
|
51
|
+
});
|
|
52
|
+
writeFileSync(target, output.outputText, "utf-8");
|
|
53
|
+
}
|
|
54
|
+
function tryDeleteFile(file) {
|
|
55
|
+
try {
|
|
56
|
+
rmSync(file);
|
|
57
|
+
}
|
|
58
|
+
catch (_er) {
|
|
59
|
+
// ignore
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export function importTsFile(file, outdir = '.') {
|
|
63
|
+
if (!file.endsWith('.ts')) {
|
|
64
|
+
throw new Error("Not a type script file: " + file);
|
|
65
|
+
}
|
|
66
|
+
file = resolve(file);
|
|
67
|
+
const baseOptions = {
|
|
68
|
+
skipLibCheck: true,
|
|
69
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
70
|
+
module: ts.ModuleKind.ESNext,
|
|
71
|
+
target: ts.ScriptTarget.ESNext,
|
|
72
|
+
};
|
|
73
|
+
// we nly use compile to find errors. To generate the code we use transpileModule
|
|
74
|
+
// since the compile will generate js files for all the dependencies.
|
|
75
|
+
const result = compile([file], {
|
|
76
|
+
...baseOptions,
|
|
77
|
+
noEmit: true
|
|
78
|
+
});
|
|
79
|
+
if (result.errors > 0) {
|
|
80
|
+
console.log(`Found ${result.errors} in typescript compilation. Aborting.`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
const fname = basename(file).slice(0, -3);
|
|
84
|
+
const emittedFile = resolve(outdir, `__${Date.now()}-${fname}.mjs`);
|
|
85
|
+
transpileFile(file, emittedFile, baseOptions);
|
|
86
|
+
return import(emittedFile).finally(() => tryDeleteFile(emittedFile));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=ts-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-loader.js","sourceRoot":"","sources":["../../src/ts-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,SAAS,OAAO,CAAC,SAAmB,EAAE,OAA2B;IAC7D,IAAI,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE;QACtC,GAAG,OAAO;QACV,gBAAgB,EAAE,IAAI;KACI,CAAC,CAAC;IAChC,IAAI,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAEhC,IAAI,cAAc,GAAG,EAAE;SAClB,qBAAqB,CAAC,OAAO,CAAC;SAC9B,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEpC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAChC,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAyB,CAAC;QACpD,IAAI,UAAU,CAAC,kBAAkB,IAAI,UAAU,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5E,KAAK,MAAM,EAAE,IAAI,UAAU,CAAC,kBAAkB,EAAE,CAAC;gBAC7C,UAAU,CAAC,GAAG,CAAC,EAAE,CAA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AC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC;IACpE,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAE9C,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOzD,wBAAgB,UAAU,YAMzB;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Commands } from "@vertesia/memory";
|
|
2
|
+
import { build, getBuilder } from "./build.js";
|
|
3
|
+
declare function vars(): ReturnType<Commands['vars']>;
|
|
4
|
+
declare function tmpdir(): ReturnType<Commands['tmpdir']>;
|
|
5
|
+
declare function from(...args: Parameters<Commands['from']>): ReturnType<Commands['from']>;
|
|
6
|
+
declare function exec(...args: Parameters<Commands['exec']>): ReturnType<Commands['exec']>;
|
|
7
|
+
declare function copy(...args: Parameters<Commands['copy']>): ReturnType<Commands['copy']>;
|
|
8
|
+
declare function copyText(...args: Parameters<Commands['copyText']>): ReturnType<Commands['copyText']>;
|
|
9
|
+
declare function content(...args: Parameters<Commands['content']>): ReturnType<Commands['content']>;
|
|
10
|
+
declare function json(...args: Parameters<Commands['json']>): ReturnType<Commands['json']>;
|
|
11
|
+
declare function pdf(...args: Parameters<Commands['pdf']>): ReturnType<Commands['pdf']>;
|
|
12
|
+
declare function docx(...args: Parameters<Commands['docx']>): ReturnType<Commands['docx']>;
|
|
13
|
+
declare function media(...args: Parameters<Commands['media']>): ReturnType<Commands['media']>;
|
|
14
|
+
export { build, content, copy, copyText, docx, exec, from, getBuilder, json, media, pdf, tmpdir, vars };
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/C,iBAAS,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAE5C;AAED,iBAAS,MAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAEhD;AAED,iBAAS,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAEjF;AAED,iBAAS,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAEjF;AAED,iBAAS,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAEjF;AAED,iBAAS,QAAQ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAE7F;AAED,iBAAS,OAAO,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAE1F;AAED,iBAAS,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAEjF;AAED,iBAAS,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAE9E;AAED,iBAAS,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAEjF;AAED,iBAAS,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAEpF;AAED,OAAO,EACH,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAC/F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-loader.d.ts","sourceRoot":"","sources":["../../src/ts-loader.ts"],"names":[],"mappings":"AAiEA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CA0B7E"}
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"name": "@vertesia/memory-commands",
|
|
3
|
+
"description": "Memory commands for memory recipe scripts",
|
|
4
|
+
"version": "0.78.0-dev.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./lib/types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^22.5.1",
|
|
14
|
+
"ts-dual-module": "^0.6.3",
|
|
15
|
+
"vitest": "^3.1.1"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"typescript": "^5.6.3",
|
|
19
|
+
"@vertesia/memory": "0.78.0-dev.1"
|
|
20
|
+
},
|
|
21
|
+
"ts_dual_module": {
|
|
22
|
+
"outDir": "lib"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
6
25
|
"types": "./lib/types/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@vertesia/memory": "workspace:*",
|
|
24
|
-
"typescript": "^5.6.3"
|
|
25
|
-
},
|
|
26
|
-
"ts_dual_module": {
|
|
27
|
-
"outDir": "lib"
|
|
28
|
-
},
|
|
29
|
-
"exports": {
|
|
30
|
-
"types": "./lib/types/index.d.ts",
|
|
31
|
-
"import": "./lib/esm/index.js",
|
|
32
|
-
"require": "./lib/cjs/index.js"
|
|
33
|
-
},
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "https://github.com/vertesia/composableai.git",
|
|
37
|
-
"directory": "packages/memory-commands"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
26
|
+
"import": "./lib/esm/index.js",
|
|
27
|
+
"require": "./lib/cjs/index.js"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/vertesia/composableai.git",
|
|
32
|
+
"directory": "packages/memory-commands"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"eslint": "eslint './src/**/*.{jsx,js,tsx,ts}'",
|
|
36
|
+
"build": "pnpm exec tsmod build",
|
|
37
|
+
"clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
|
|
38
|
+
}
|
|
39
|
+
}
|