@endo/module-source 1.0.2 → 1.1.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/index.d.ts.map +1 -0
- package/package.json +12 -8
- package/shim.d.ts +2 -0
- package/shim.d.ts.map +1 -0
- package/shim.js +10 -0
- package/src/hidden.d.ts +9 -9
- package/src/hidden.js +2 -2
- package/src/module-source.js +29 -0
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endo/module-source",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Ponyfill for the SES ModuleSource and module-to-program transformer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ses",
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
"main": "./index.js",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": "./index.js",
|
|
26
|
+
"./shim.js": "./shim.js",
|
|
26
27
|
"./package.json": "./package.json"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "exit 0",
|
|
30
31
|
"prepack": "tsc --build tsconfig.build.json",
|
|
31
|
-
"postpack": "git clean -f '*.d.ts*'",
|
|
32
|
+
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
|
|
32
33
|
"cover": "c8 ava",
|
|
33
34
|
"lint": "yarn lint:types && yarn lint:eslint",
|
|
34
35
|
"lint:types": "tsc",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"@babel/parser": "^7.23.6",
|
|
42
43
|
"@babel/traverse": "^7.23.6",
|
|
43
44
|
"@babel/types": "^7.24.0",
|
|
44
|
-
"ses": "^1.
|
|
45
|
+
"ses": "^1.9.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"ava": "^6.1.3",
|
|
@@ -54,14 +55,18 @@
|
|
|
54
55
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
55
56
|
"eslint-plugin-import": "^2.29.1",
|
|
56
57
|
"prettier": "^3.2.5",
|
|
57
|
-
"typescript": "~5.6.
|
|
58
|
+
"typescript": "~5.6.2"
|
|
58
59
|
},
|
|
59
60
|
"files": [
|
|
61
|
+
"./*.d.ts",
|
|
62
|
+
"./*.js",
|
|
63
|
+
"./*.map",
|
|
60
64
|
"LICENSE*",
|
|
61
65
|
"SECURITY*",
|
|
66
|
+
"dist",
|
|
67
|
+
"lib",
|
|
62
68
|
"src",
|
|
63
|
-
"
|
|
64
|
-
"*.ts"
|
|
69
|
+
"tools"
|
|
65
70
|
],
|
|
66
71
|
"publishConfig": {
|
|
67
72
|
"access": "public"
|
|
@@ -73,7 +78,6 @@
|
|
|
73
78
|
},
|
|
74
79
|
"ava": {
|
|
75
80
|
"files": [
|
|
76
|
-
"test/**/test-*.*",
|
|
77
81
|
"test/**/*.test.*"
|
|
78
82
|
],
|
|
79
83
|
"timeout": "2m"
|
|
@@ -81,5 +85,5 @@
|
|
|
81
85
|
"typeCoverage": {
|
|
82
86
|
"atLeast": 40.33
|
|
83
87
|
},
|
|
84
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "bbf20fae6726f7d26456714b8852572787d34e05"
|
|
85
89
|
}
|
package/shim.d.ts
ADDED
package/shim.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["shim.js"],"names":[],"mappings":""}
|
package/shim.js
ADDED
package/src/hidden.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const HIDDEN_PREFIX: "$h
|
|
2
|
-
export const HIDDEN_CONST_VAR_PREFIX: "$c
|
|
3
|
-
export const HIDDEN_A: "$h
|
|
4
|
-
export const HIDDEN_IMPORT: "$h
|
|
5
|
-
export const HIDDEN_IMPORT_SELF: "$h
|
|
6
|
-
export const HIDDEN_IMPORTS: "$h
|
|
7
|
-
export const HIDDEN_ONCE: "$h
|
|
8
|
-
export const HIDDEN_META: "$h
|
|
9
|
-
export const HIDDEN_LIVE: "$h
|
|
1
|
+
export const HIDDEN_PREFIX: "$h͏_";
|
|
2
|
+
export const HIDDEN_CONST_VAR_PREFIX: "$c͏_";
|
|
3
|
+
export const HIDDEN_A: "$h͏_a";
|
|
4
|
+
export const HIDDEN_IMPORT: "$h͏_import";
|
|
5
|
+
export const HIDDEN_IMPORT_SELF: "$h͏_importSelf";
|
|
6
|
+
export const HIDDEN_IMPORTS: "$h͏_imports";
|
|
7
|
+
export const HIDDEN_ONCE: "$h͏_once";
|
|
8
|
+
export const HIDDEN_META: "$h͏____meta";
|
|
9
|
+
export const HIDDEN_LIVE: "$h͏_live";
|
|
10
10
|
export const HIDDEN_IDENTIFIERS: string[];
|
|
11
11
|
//# sourceMappingURL=hidden.d.ts.map
|
package/src/hidden.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const HIDDEN_PREFIX = '$h\
|
|
2
|
-
export const HIDDEN_CONST_VAR_PREFIX = '$c\
|
|
1
|
+
export const HIDDEN_PREFIX = '$h\u034f_';
|
|
2
|
+
export const HIDDEN_CONST_VAR_PREFIX = '$c\u034f_';
|
|
3
3
|
export const HIDDEN_A = `${HIDDEN_PREFIX}a`;
|
|
4
4
|
export const HIDDEN_IMPORT = `${HIDDEN_PREFIX}import`;
|
|
5
5
|
export const HIDDEN_IMPORT_SELF = `${HIDDEN_PREFIX}importSelf`;
|
package/src/module-source.js
CHANGED
|
@@ -100,3 +100,32 @@ export function ModuleSource(source, opts = {}) {
|
|
|
100
100
|
this.__needsImportMeta__ = needsImportMeta;
|
|
101
101
|
freeze(this);
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
// AbstractModuleSource
|
|
105
|
+
// https://github.com/tc39/proposal-source-phase-imports?tab=readme-ov-file#js-module-source
|
|
106
|
+
//
|
|
107
|
+
// We are attempting to ensure that a JavaScript shim (particularly ses) is
|
|
108
|
+
// forward-compatible as the engine evolves beneath it, with or without this
|
|
109
|
+
// ModuleSource shim, and with our without a native AbstractModuleSource which
|
|
110
|
+
// remains undecided.
|
|
111
|
+
// Lockdown does not gracefully handle the presence of an unexpected prototype,
|
|
112
|
+
// but can tolerate the absence of an expected prototype.
|
|
113
|
+
// So, we are providing AbstractModuleSource since we can better tolerate the
|
|
114
|
+
// various uncertain futures.
|
|
115
|
+
//
|
|
116
|
+
// WebAssembly and ModuleSource are both in motion.
|
|
117
|
+
// The Source Phase Imports proposal implies an additional AbstractModuleSource
|
|
118
|
+
// layer above the existing WebAssembly.Module that would be shared by
|
|
119
|
+
// the JavaScript ModuleSource prototype chains.
|
|
120
|
+
// At time of writing, no version of WebAssembly provides the shared base
|
|
121
|
+
// class, and the ModuleSource *shim* gains nothing from sharing one when that
|
|
122
|
+
// prototype when it comes into being.
|
|
123
|
+
// So, we do not attempt to entangle our AbstractModuleSource with
|
|
124
|
+
// WebAssembly.Module.
|
|
125
|
+
|
|
126
|
+
function AbstractModuleSource() {
|
|
127
|
+
// no-op, safe to super()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
Object.setPrototypeOf(ModuleSource, AbstractModuleSource);
|
|
131
|
+
Object.setPrototypeOf(ModuleSource.prototype, AbstractModuleSource.prototype);
|