karma-requirejs-esm-preprocessor 2.0.0 → 2.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/README.md +6 -0
- package/index.js +8 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -46,6 +46,12 @@ sourceMap: boolean
|
|
|
46
46
|
|
|
47
47
|
Enables an inline source map in the preprocessed output to support debugging in the browser. The default is `true`.
|
|
48
48
|
|
|
49
|
+
```ts
|
|
50
|
+
onBeforeTransform, onAfterTransform, onBeforeUpdate, onAfterUpdate
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
ESM transformation and AMD update callbacks.
|
|
54
|
+
|
|
49
55
|
## Contributing
|
|
50
56
|
|
|
51
57
|
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.
|
package/index.js
CHANGED
|
@@ -3,7 +3,10 @@ const { preprocess } = require('requirejs-esm-preprocessor')
|
|
|
3
3
|
function createPreprocessor(args, config, helper) {
|
|
4
4
|
const { basePath, logLevel, LOG_DEBUG, LOG_DISABLE, requirejsEsmPreprocessor } = config
|
|
5
5
|
const defaults = { useStrict: true, sourceMap: true }
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
isScript, useStrict, sourceMap,
|
|
8
|
+
onBeforeTransform, onAfterTransform, onBeforeUpdate, onAfterUpdate
|
|
9
|
+
} = helper.merge(defaults, args, requirejsEsmPreprocessor || {})
|
|
7
10
|
const verbose = logLevel === LOG_DEBUG
|
|
8
11
|
const silent = logLevel === LOG_DISABLE
|
|
9
12
|
const { length: basePathLen } = basePath
|
|
@@ -12,7 +15,10 @@ function createPreprocessor(args, config, helper) {
|
|
|
12
15
|
let { originalPath: path } = file
|
|
13
16
|
if (path.startsWith(basePath)) path = path.substring(basePathLen)
|
|
14
17
|
if (!isScript || isScript(path)) {
|
|
15
|
-
contents = preprocess({
|
|
18
|
+
contents = preprocess({
|
|
19
|
+
path, contents, isScript, useStrict, sourceMap, verbose, silent,
|
|
20
|
+
onBeforeTransform, onAfterTransform, onBeforeUpdate, onAfterUpdate
|
|
21
|
+
})
|
|
16
22
|
}
|
|
17
23
|
done(null, contents)
|
|
18
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "karma-requirejs-esm-preprocessor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Karma preprocessor for converting ES modules to AMD in RequireJS projects.",
|
|
5
5
|
"author": "Ferdinand Prantl <prantlf@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"reporter": []
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"requirejs-esm-preprocessor": "^3.
|
|
40
|
+
"requirejs-esm-preprocessor": "^3.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/js": "^9.39.1",
|
|
44
44
|
"c8": "^10.1.3",
|
|
45
45
|
"eslint": "^9.39.1",
|
|
46
46
|
"globals": "^16.5.0",
|
|
47
|
-
"jasmine-core": "^5.
|
|
47
|
+
"jasmine-core": "^5.13.0",
|
|
48
48
|
"karma": "^6.4.4",
|
|
49
49
|
"karma-brief-reporter": "^0.2.2",
|
|
50
50
|
"karma-chrome-launcher": "^3.2.0",
|
|
51
51
|
"karma-jasmine": "^5.1.0",
|
|
52
|
-
"requirejs-esm-preprocessor": "^3.
|
|
52
|
+
"requirejs-esm-preprocessor": "^3.2.0"
|
|
53
53
|
},
|
|
54
54
|
"keywords": [
|
|
55
55
|
"karma-preprocessor",
|