@endo/module-source 1.3.3 → 1.4.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/package.json +31 -25
- package/shim.js +0 -2
- package/src/module-source.d.ts +8 -8
- package/src/module-source.d.ts.map +1 -1
- package/src/module-source.js +27 -8
- package/src/transform-analyze.js +1 -1
- package/src/transform-source.d.ts +1 -1
- package/src/transform-source.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endo/module-source",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Ponyfill for the SES ModuleSource and module-to-program transformer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ses",
|
|
@@ -31,35 +31,32 @@
|
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "exit 0",
|
|
34
|
-
"prepack": "tsc --build tsconfig.build.json",
|
|
35
|
-
"postpack": "git clean -fX
|
|
36
|
-
"cover": "c8 ava",
|
|
34
|
+
"prepack": "git clean -fX -e node_modules/ && tsc --build tsconfig.build.json",
|
|
35
|
+
"postpack": "git clean -fX -e node_modules/",
|
|
36
|
+
"cover": "c8 ava --config test/_ava-ses.config.js",
|
|
37
37
|
"lint": "yarn lint:types && yarn lint:eslint",
|
|
38
38
|
"lint:types": "tsc",
|
|
39
39
|
"lint:eslint": "eslint .",
|
|
40
40
|
"lint-fix": "eslint --fix .",
|
|
41
|
-
"test": "ava",
|
|
41
|
+
"test": "yarn run -T ses-ava",
|
|
42
|
+
"test:c8": "c8 ${C8_OPTIONS:-} yarn run -T ses-ava",
|
|
42
43
|
"test:xs": "node scripts/generate-test-xs.js && xst tmp/test-xs.js"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@babel/generator": "^7.
|
|
46
|
-
"@babel/parser": "~7.
|
|
47
|
-
"@babel/traverse": "~7.
|
|
48
|
-
"@babel/types": "~7.
|
|
49
|
-
"ses": "^
|
|
46
|
+
"@babel/generator": "^7.28.3",
|
|
47
|
+
"@babel/parser": "~7.28.3",
|
|
48
|
+
"@babel/traverse": "~7.28.3",
|
|
49
|
+
"@babel/types": "~7.28.2",
|
|
50
|
+
"ses": "^2.0.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"ava": "^
|
|
53
|
+
"@endo/ses-ava": "^1.4.1",
|
|
54
|
+
"ava": "catalog:dev",
|
|
53
55
|
"babel-eslint": "^10.1.0",
|
|
54
56
|
"benchmark": "^2.1.4",
|
|
55
|
-
"c8": "
|
|
56
|
-
"eslint": "
|
|
57
|
-
"
|
|
58
|
-
"eslint-config-prettier": "^9.1.0",
|
|
59
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
60
|
-
"eslint-plugin-import": "^2.31.0",
|
|
61
|
-
"prettier": "^3.5.3",
|
|
62
|
-
"typescript": "~5.8.3"
|
|
57
|
+
"c8": "catalog:dev",
|
|
58
|
+
"eslint": "catalog:dev",
|
|
59
|
+
"typescript": "catalog:dev"
|
|
63
60
|
},
|
|
64
61
|
"files": [
|
|
65
62
|
"./*.d.ts",
|
|
@@ -79,18 +76,27 @@
|
|
|
79
76
|
"extends": [
|
|
80
77
|
"plugin:@endo/internal"
|
|
81
78
|
],
|
|
79
|
+
"rules": {
|
|
80
|
+
"import/no-unresolved": [
|
|
81
|
+
"error",
|
|
82
|
+
{
|
|
83
|
+
"ignore": [
|
|
84
|
+
"^@endo/module-source(?:/.*)?$"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
82
89
|
"ignorePatterns": [
|
|
83
90
|
"test/fixtures/"
|
|
84
91
|
]
|
|
85
92
|
},
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"timeout": "2m"
|
|
93
|
+
"sesAvaConfigs": {
|
|
94
|
+
"lockdown": "../../ava-endo-lockdown.config.mjs",
|
|
95
|
+
"unsafe": "../../ava-endo-lockdown-unsafe.config.mjs",
|
|
96
|
+
"ses": "../../ava-ses-shims-only.config.mjs"
|
|
91
97
|
},
|
|
92
98
|
"typeCoverage": {
|
|
93
99
|
"atLeast": 40.33
|
|
94
100
|
},
|
|
95
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "e74ed050e9d1122d692b00ee14971299c6afbf30"
|
|
96
102
|
}
|
package/shim.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
// We are using a reflexive import to make sure we pass through the conditional
|
|
4
4
|
// export in package.json.
|
|
5
|
-
// Eslint does not yet seem to have a carve-out for package-reflexive imports.
|
|
6
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
5
|
import { ModuleSource } from '@endo/module-source';
|
|
8
6
|
|
|
9
7
|
Object.defineProperty(globalThis, 'ModuleSource', {
|
package/src/module-source.d.ts
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
14
|
* @typedef {object} Options
|
|
15
|
-
* @property {string} [sourceUrl]
|
|
16
|
-
* @property {string} [sourceMap]
|
|
17
|
-
* @property {string} [sourceMapUrl]
|
|
18
|
-
* @property {SourceMapHook} [sourceMapHook]
|
|
15
|
+
* @property {string | undefined} [sourceUrl]
|
|
16
|
+
* @property {string | undefined} [sourceMap]
|
|
17
|
+
* @property {string | undefined} [sourceMapUrl]
|
|
18
|
+
* @property {SourceMapHook | undefined} [sourceMapHook]
|
|
19
19
|
*/
|
|
20
20
|
/**
|
|
21
21
|
* ModuleSource captures the effort of parsing and analyzing module text
|
|
@@ -41,10 +41,10 @@ export class ModuleSource {
|
|
|
41
41
|
*/
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {object} Options
|
|
44
|
-
* @property {string} [sourceUrl]
|
|
45
|
-
* @property {string} [sourceMap]
|
|
46
|
-
* @property {string} [sourceMapUrl]
|
|
47
|
-
* @property {SourceMapHook} [sourceMapHook]
|
|
44
|
+
* @property {string | undefined} [sourceUrl]
|
|
45
|
+
* @property {string | undefined} [sourceMap]
|
|
46
|
+
* @property {string | undefined} [sourceMapUrl]
|
|
47
|
+
* @property {SourceMapHook | undefined} [sourceMapHook]
|
|
48
48
|
*/
|
|
49
49
|
/**
|
|
50
50
|
* ModuleSource captures the effort of parsing and analyzing module text
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-source.d.ts","sourceRoot":"","sources":["module-source.js"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAKH;;;;;;;GAOG;AACH,qCAHW,MAAM,SACN,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"module-source.d.ts","sourceRoot":"","sources":["module-source.js"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAKH;;;;;;;GAOG;AACH,qCAHW,MAAM,SACN,MAAM,GAAG,OAAO,QAmD1B;;IAlFD;;;;;;OAMG;IAEH;;;;OAIG;IAEH;;;;;;OAMG;IAKH;;;;;;;OAOG;IACH,oBAHW,MAAM,SACN,MAAM,GAAG,OAAO,EAmD1B;IA9BC,kBAAyC;IACzC,eAQC;IACD,mBAA+C;IAC/C,8BAA0C;IAa1C,uBAA8C;IAC9C,qBAA0C;IAC1C,wBAAgD;IAChD,yBAAkC;IAClC,6BAA0C;;;iBA9E9B,MAAM;YACN,MAAM;cACN,MAAM;YACN,MAAM;;wCAKT,MAAM,WACN,oBAAoB;;gBAKjB,MAAM,GAAG,SAAS;gBAClB,MAAM,GAAG,SAAS;mBAClB,MAAM,GAAG,SAAS;oBAClB,aAAa,GAAG,SAAS"}
|
package/src/module-source.js
CHANGED
|
@@ -49,10 +49,10 @@ const analyzeModule = makeModuleAnalyzer();
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @typedef {object} Options
|
|
52
|
-
* @property {string} [sourceUrl]
|
|
53
|
-
* @property {string} [sourceMap]
|
|
54
|
-
* @property {string} [sourceMapUrl]
|
|
55
|
-
* @property {SourceMapHook} [sourceMapHook]
|
|
52
|
+
* @property {string | undefined} [sourceUrl]
|
|
53
|
+
* @property {string | undefined} [sourceMap]
|
|
54
|
+
* @property {string | undefined} [sourceMapUrl]
|
|
55
|
+
* @property {SourceMapHook | undefined} [sourceMapHook]
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
58
|
// XXX implements import('ses').PrecompiledModuleSource but adding
|
|
@@ -90,14 +90,28 @@ export function ModuleSource(source, opts = {}) {
|
|
|
90
90
|
[
|
|
91
91
|
...keys(liveExportMap),
|
|
92
92
|
...keys(fixedExportMap),
|
|
93
|
-
...values(reexportMap)
|
|
93
|
+
...values(reexportMap)
|
|
94
|
+
.flat()
|
|
95
|
+
.map(([_, exportName]) => exportName),
|
|
94
96
|
].sort(),
|
|
95
97
|
);
|
|
96
98
|
this.reexports = freeze([...exportAlls].sort());
|
|
97
99
|
this.__syncModuleProgram__ = functorSource;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
for (const entry of values(liveExportMap)) {
|
|
101
|
+
freeze(entry);
|
|
102
|
+
}
|
|
103
|
+
for (const entry of values(fixedExportMap)) {
|
|
104
|
+
freeze(entry);
|
|
105
|
+
}
|
|
106
|
+
for (const reexports of values(reexportMap)) {
|
|
107
|
+
for (const pair of reexports) {
|
|
108
|
+
freeze(pair);
|
|
109
|
+
}
|
|
110
|
+
freeze(reexports);
|
|
111
|
+
}
|
|
112
|
+
this.__liveExportMap__ = freeze(liveExportMap);
|
|
113
|
+
this.__reexportMap__ = freeze(reexportMap);
|
|
114
|
+
this.__fixedExportMap__ = freeze(fixedExportMap);
|
|
101
115
|
this.__needsImport__ = needsImport;
|
|
102
116
|
this.__needsImportMeta__ = needsImportMeta;
|
|
103
117
|
freeze(this);
|
|
@@ -131,3 +145,8 @@ function AbstractModuleSource() {
|
|
|
131
145
|
|
|
132
146
|
Object.setPrototypeOf(ModuleSource, AbstractModuleSource);
|
|
133
147
|
Object.setPrototypeOf(ModuleSource.prototype, AbstractModuleSource.prototype);
|
|
148
|
+
|
|
149
|
+
freeze(AbstractModuleSource);
|
|
150
|
+
freeze(AbstractModuleSource.prototype);
|
|
151
|
+
freeze(ModuleSource.prototype);
|
|
152
|
+
freeze(ModuleSource);
|
package/src/transform-analyze.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function makeTransformSource(makeModulePlugins: any, babel?: null): (source: any, sourceOptions?: {}) =>
|
|
1
|
+
export function makeTransformSource(makeModulePlugins: any, babel?: null): (source: any, sourceOptions?: {}) => any;
|
|
2
2
|
//# sourceMappingURL=transform-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-source.d.ts","sourceRoot":"","sources":["transform-source.js"],"names":[],"mappings":"AAeO,
|
|
1
|
+
{"version":3,"file":"transform-source.d.ts","sourceRoot":"","sources":["transform-source.js"],"names":[],"mappings":"AAeO,oHAmDN"}
|