karma-requirejs-esm-preprocessor 1.0.2 → 1.0.5

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 (2) hide show
  1. package/index.js +4 -2
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -1,14 +1,16 @@
1
1
  const { preprocess } = require('requirejs-esm-preprocessor')
2
2
 
3
3
  function createPreprocessor(args, config, helper) {
4
- const { logLevel, LOG_DEBUG, LOG_DISABLE, requirejsEsmPreprocessor } = config
4
+ const { basePath, logLevel, LOG_DEBUG, LOG_DISABLE, requirejsEsmPreprocessor } = config
5
5
  const defaults = { sourceMap: true }
6
6
  const { isScript, sourceMap } = helper.merge(defaults, args, requirejsEsmPreprocessor || {})
7
7
  const verbose = logLevel === LOG_DEBUG
8
8
  const silent = logLevel === LOG_DISABLE
9
+ const { length: basePathLen } = basePath
9
10
 
10
11
  return (contents, file, done) => {
11
- const { originalPath: path } = file
12
+ let { originalPath: path } = file
13
+ if (path.startsWith(basePath)) path = path.substring(basePathLen)
12
14
  if (!isScript || isScript(path)) {
13
15
  contents = preprocess({ path, contents, isScript, sourceMap, verbose, silent })
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karma-requirejs-esm-preprocessor",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
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",
@@ -52,19 +52,19 @@
52
52
  ]
53
53
  },
54
54
  "peerDependencies": {
55
- "requirejs-esm-preprocessor": "^1.0.1"
55
+ "requirejs-esm-preprocessor": "^1.2.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@semantic-release/changelog": "^6.0.1",
59
59
  "@semantic-release/git": "^10.0.1",
60
60
  "c8": "^7.11.0",
61
- "eslint": "^8.12.0",
61
+ "eslint": "^8.13.0",
62
62
  "jasmine-core": "^4.0.1",
63
63
  "karma": "^6.3.17",
64
64
  "karma-brief-reporter": "^0.2.1",
65
65
  "karma-chrome-launcher": "^3.1.1",
66
66
  "karma-jasmine": "^4.0.2",
67
- "requirejs-esm-preprocessor": "^1.0.1"
67
+ "requirejs-esm-preprocessor": "^1.2.0"
68
68
  },
69
69
  "keywords": [
70
70
  "karma-preprocessor",