@contrast/esm-hooks 1.1.5 → 1.1.6
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/index.mjs +3 -3
- package/package.json +2 -2
package/lib/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export default function (core = initCore()) {
|
|
|
33
33
|
const filename = fileURLToPath(context.url);
|
|
34
34
|
core.logger.trace('transformSource %s', filename);
|
|
35
35
|
try {
|
|
36
|
-
result = core.rewriter.rewrite(source.toString(), { filename, sourceType: 'module' });
|
|
36
|
+
result = core.rewriter.rewrite(source.toString(), { filename, sourceType: 'module', inject: true, wrap: true });
|
|
37
37
|
return { source: result.code };
|
|
38
38
|
} catch (err) {
|
|
39
39
|
core.logger.error(
|
|
@@ -45,7 +45,7 @@ export default function (core = initCore()) {
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
async
|
|
48
|
+
async load(url, context, defaultLoad) {
|
|
49
49
|
const type = getType(url);
|
|
50
50
|
|
|
51
51
|
if (type === 'builtin' || type === 'unknown') {
|
|
@@ -63,7 +63,7 @@ export default function (core = initCore()) {
|
|
|
63
63
|
let result;
|
|
64
64
|
try {
|
|
65
65
|
const source = await fs.readFile(filename, 'utf8');
|
|
66
|
-
result = core.rewriter.rewrite(source, { filename, sourceType: type === 'commonjs' ? 'script' : 'module' });
|
|
66
|
+
result = core.rewriter.rewrite(source, { filename, sourceType: type === 'commonjs' ? 'script' : 'module', inject: true, wrap: true });
|
|
67
67
|
return { format: type, source: result.code, shortCircuit: true };
|
|
68
68
|
} catch (err) {
|
|
69
69
|
core.logger.error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/esm-hooks",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Support for loading and instrumenting ECMAScript modules",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test": "../scripts/test.sh"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@contrast/core": "^1.
|
|
17
|
+
"@contrast/core": "^1.5.0",
|
|
18
18
|
"parent-package-json": "^2.0.1"
|
|
19
19
|
}
|
|
20
20
|
}
|