karma-requirejs-esm-preprocessor 2.0.0 → 2.2.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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.js +8 -2
  3. package/package.json +9 -11
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 { isScript, useStrict, sourceMap } = helper.merge(defaults, args, requirejsEsmPreprocessor || {})
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({ path, contents, isScript, useStrict, sourceMap, verbose, silent })
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.0.0",
3
+ "version": "2.2.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",
@@ -25,8 +25,8 @@
25
25
  "index.js"
26
26
  ],
27
27
  "scripts": {
28
- "lint": "eslint *.js",
29
- "fix": "eslint *.js src test",
28
+ "lint": "biome lint *.js",
29
+ "fix": "biome lint --fix *.js",
30
30
  "check1": "karma start test/karma.conf1.js",
31
31
  "check2": "karma start test/karma.conf2.js",
32
32
  "check": "npm run check1 && npm run check2",
@@ -37,19 +37,17 @@
37
37
  "reporter": []
38
38
  },
39
39
  "peerDependencies": {
40
- "requirejs-esm-preprocessor": "^3.0.0"
40
+ "requirejs-esm-preprocessor": "^3.3.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@eslint/js": "^9.39.1",
44
- "c8": "^10.1.3",
45
- "eslint": "^9.39.1",
46
- "globals": "^16.5.0",
47
- "jasmine-core": "^5.12.1",
43
+ "@biomejs/biome": "^2.4.14",
44
+ "c8": "^11.0.0",
45
+ "jasmine-core": "^6.2.0",
48
46
  "karma": "^6.4.4",
49
- "karma-brief-reporter": "^0.2.2",
47
+ "karma-brief-reporter": "^0.3.0",
50
48
  "karma-chrome-launcher": "^3.2.0",
51
49
  "karma-jasmine": "^5.1.0",
52
- "requirejs-esm-preprocessor": "^3.0.0"
50
+ "requirejs-esm-preprocessor": "^3.3.0"
53
51
  },
54
52
  "keywords": [
55
53
  "karma-preprocessor",