@toa.io/definitions 1.0.0-alpha.294 → 1.0.0-alpha.295
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/definitions",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.295",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "What Toa packages declare, read without running them",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@toa.io/generic": "1.0.0-alpha.292",
|
|
34
34
|
"@toa.io/pointer": "1.0.0-alpha.293",
|
|
35
|
-
"@toa.io/schemas": "1.0.0-alpha.293"
|
|
35
|
+
"@toa.io/schemas": "1.0.0-alpha.293",
|
|
36
|
+
"oxc-parser": "0.149.0"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"transpile": "tsc",
|
|
@@ -45,16 +46,7 @@
|
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@toa.io/core": "1.0.0-alpha.293",
|
|
48
|
-
"openspan": "1.0.0-alpha.293"
|
|
49
|
-
"oxc-parser": "0.149.0"
|
|
50
|
-
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"oxc-parser": "0.149.0"
|
|
53
|
-
},
|
|
54
|
-
"peerDependenciesMeta": {
|
|
55
|
-
"oxc-parser": {
|
|
56
|
-
"optional": true
|
|
57
|
-
}
|
|
49
|
+
"openspan": "1.0.0-alpha.293"
|
|
58
50
|
},
|
|
59
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "4053b28216cf83889258d3a891b9c7f43137234a"
|
|
60
52
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a module exports, read from its source: the name, and what the value is declared as.
|
|
3
3
|
* Nothing is imported, so what a module depends on need not be installed to read it.
|
|
4
|
+
*
|
|
5
|
+
* The parser is a dependency and not an optional peer, though a composition carries the
|
|
6
|
+
* manifest its build normalised and reads no source: what an extension ships is normalised
|
|
7
|
+
* where it runs — in a service's own image, and in a composition that hosts one — and nothing
|
|
8
|
+
* bakes those. Make it optional again only once they read the digest instead.
|
|
4
9
|
*/
|
|
5
10
|
export declare function exports(path: string, text: string): Exports;
|
|
6
11
|
export type Exports = Map<string, Binding>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseSync } from 'oxc-parser';
|
|
2
2
|
/**
|
|
3
3
|
* What a module exports, read from its source: the name, and what the value is declared as.
|
|
4
4
|
* Nothing is imported, so what a module depends on need not be installed to read it.
|
|
5
|
+
*
|
|
6
|
+
* The parser is a dependency and not an optional peer, though a composition carries the
|
|
7
|
+
* manifest its build normalised and reads no source: what an extension ships is normalised
|
|
8
|
+
* where it runs — in a service's own image, and in a composition that hosts one — and nothing
|
|
9
|
+
* bakes those. Make it optional again only once they read the digest instead.
|
|
5
10
|
*/
|
|
6
11
|
export function exports(path, text) {
|
|
7
|
-
const { program, errors } =
|
|
12
|
+
const { program, errors } = parseSync(path, text);
|
|
8
13
|
if (errors.length > 0)
|
|
9
14
|
throw new Error(`${path}: ${errors[0].message}`);
|
|
10
15
|
const locals = declarations(program.body);
|
|
@@ -32,29 +37,6 @@ function named(node, locals, exported) {
|
|
|
32
37
|
exported.set(name(specifier.exported), binding(specifier.local, locals));
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
/**
|
|
36
|
-
* The parser, loaded when a module is read and not before.
|
|
37
|
-
*
|
|
38
|
-
* It is an optional peer of this package rather than a dependency: a composition reads the
|
|
39
|
-
* manifest its build normalised and reads no source at all, so an image carries three and a half
|
|
40
|
-
* megabytes of parser for nothing. What normalises — a workspace and a deploy — has it through
|
|
41
|
-
* `@toa.io/operations`.
|
|
42
|
-
*/
|
|
43
|
-
function parser() {
|
|
44
|
-
if (parse !== undefined)
|
|
45
|
-
return parse;
|
|
46
|
-
try {
|
|
47
|
-
parse = require('oxc-parser').parseSync;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
throw new Error('Reading what a module declares needs `oxc-parser`, which is not installed: it comes ' +
|
|
51
|
-
'with `@toa.io/operations`, which a workspace that composes or deploys has.', { cause: error });
|
|
52
|
-
}
|
|
53
|
-
return parse;
|
|
54
|
-
}
|
|
55
|
-
// what `find` returns is a package directory, and the parser is a module of this machine's
|
|
56
|
-
const require = createRequire(import.meta.url);
|
|
57
|
-
let parse;
|
|
58
40
|
/** `module.exports = { … }`, `module.exports.x = …` and `exports.x = …` */
|
|
59
41
|
function assigned(expression, locals, exported) {
|
|
60
42
|
if (expression.type !== 'AssignmentExpression' || expression.operator !== '=')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../source/bridges.node/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../source/bridges.node/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEtC;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,IAAY;IAChD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAEjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;IAEvE,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,MAAM,QAAQ,GAAY,IAAI,GAAG,EAAE,CAAA;IAEnC,KAAK,MAAM,IAAI,IAAI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