ts-swc-transform 1.7.6 → 1.7.7

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  Object.defineProperty(exports, /**
6
- * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.
6
+ * @param {{path: string, tsconfig: Object}} tsconfig The path to the loaded TS tsconfig and typescript tsconfig.
7
7
  * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded
8
8
  */ "default", {
9
9
  enumerable: true,
@@ -19,17 +19,20 @@ function _interop_require_default(obj) {
19
19
  default: obj
20
20
  };
21
21
  }
22
- function createMatcher(config) {
23
- var configPath = _pathposix.default.dirname((0, _unixify.default)(config.path));
22
+ function createMatcher(tsconfig) {
23
+ if (tsconfig === undefined) throw new Error('createMatcher: missing tsconfig');
24
+ if (tsconfig.path === undefined) throw new Error('createMatcher: expecting tsconfig.path');
25
+ if (tsconfig.config === undefined) throw new Error('createMatcher: expecting tsconfig.config');
26
+ var tsconfigPath = _pathposix.default.dirname((0, _unixify.default)(tsconfig.path));
24
27
  function matchFn(condition) {
25
28
  var pattern = (0, _unixify.default)(condition);
26
- if (!_pathposix.default.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = _pathposix.default.join(configPath, pattern);
29
+ if (!_pathposix.default.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = _pathposix.default.join(tsconfigPath, pattern);
27
30
  return function match(filePath) {
28
31
  return filePath.startsWith(pattern) || (0, _minimatch.default)(filePath, pattern);
29
32
  };
30
33
  }
31
- var includes = (config.config.include || []).map(matchFn);
32
- var excludes = (config.config.exclude || []).map(matchFn);
34
+ var includes = (tsconfig.config.include || []).map(matchFn);
35
+ var excludes = (tsconfig.config.exclude || []).map(matchFn);
33
36
  return function matcher(filePath) {
34
37
  if (filePath.endsWith('.json')) return false;
35
38
  filePath = (0, _unixify.default)(filePath);
@@ -1 +1 @@
1
- {"version":3,"sources":["createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\n\n/**\n * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.\n * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded\n */\nexport default function createMatcher(config) {\n const configPath = path.dirname(unixify(config.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(configPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = (config.config.include || []).map(matchFn);\n const excludes = (config.config.exclude || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["createMatcher","config","configPath","path","dirname","unixify","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","minimatch","includes","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":";;;;+BAIA;;;CAGC,GACD;;;eAAwBA;;;gEARF;gEACL;8DACG;;;;;;AAML,SAASA,cAAcC,MAAM;IAC1C,IAAMC,aAAaC,kBAAI,CAACC,OAAO,CAACC,IAAAA,gBAAO,EAACJ,OAAOE,IAAI;IAEnD,SAASG,QAAQC,SAAS;QACxB,IAAIC,UAAUH,IAAAA,gBAAO,EAACE;QACtB,IAAI,CAACJ,kBAAI,CAACM,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUL,kBAAI,CAACQ,IAAI,CAACT,YAAYM;QAE3F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYM,IAAAA,kBAAS,EAACD,UAAUL;QAC7D;IACF;IAEA,IAAMO,WAAW,AAACd,CAAAA,OAAOA,MAAM,CAACe,OAAO,IAAI,EAAE,AAAD,EAAGC,GAAG,CAACX;IACnD,IAAMY,WAAW,AAACjB,CAAAA,OAAOA,MAAM,CAACkB,OAAO,IAAI,EAAE,AAAD,EAAGF,GAAG,CAACX;IAEnD,OAAO,SAASc,QAAQP,QAAQ;QAC9B,IAAIA,SAASQ,QAAQ,CAAC,UAAU,OAAO;QAEvCR,WAAWR,IAAAA,gBAAO,EAACQ;QACnB,IAAK,IAAIS,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACT,WAAW,OAAO;QACpC;QACA,IAAK,IAAIW,IAAI,GAAGA,IAAIT,SAASQ,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIT,QAAQ,CAACS,EAAE,CAACX,WAAW,OAAO;QACpC;QACA,OAAO,CAACE,SAASQ,MAAM;IACzB;AACF"}
1
+ {"version":3,"sources":["createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\n\n/**\n * @param {{path: string, tsconfig: Object}} tsconfig The path to the loaded TS tsconfig and typescript tsconfig.\n * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded\n */\nexport default function createMatcher(tsconfig) {\n if (tsconfig === undefined) throw new Error('createMatcher: missing tsconfig');\n if (tsconfig.path === undefined) throw new Error('createMatcher: expecting tsconfig.path');\n if (tsconfig.config === undefined) throw new Error('createMatcher: expecting tsconfig.config');\n\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = (tsconfig.config.include || []).map(matchFn);\n const excludes = (tsconfig.config.exclude || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["createMatcher","tsconfig","undefined","Error","path","config","tsconfigPath","dirname","unixify","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","minimatch","includes","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":";;;;+BAIA;;;CAGC,GACD;;;eAAwBA;;;gEARF;gEACL;8DACG;;;;;;AAML,SAASA,cAAcC,QAAQ;IAC5C,IAAIA,aAAaC,WAAW,MAAM,IAAIC,MAAM;IAC5C,IAAIF,SAASG,IAAI,KAAKF,WAAW,MAAM,IAAIC,MAAM;IACjD,IAAIF,SAASI,MAAM,KAAKH,WAAW,MAAM,IAAIC,MAAM;IAEnD,IAAMG,eAAeF,kBAAI,CAACG,OAAO,CAACC,IAAAA,gBAAO,EAACP,SAASG,IAAI;IAEvD,SAASK,QAAQC,SAAS;QACxB,IAAIC,UAAUH,IAAAA,gBAAO,EAACE;QACtB,IAAI,CAACN,kBAAI,CAACQ,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUP,kBAAI,CAACU,IAAI,CAACR,cAAcK;QAE7F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYM,IAAAA,kBAAS,EAACD,UAAUL;QAC7D;IACF;IAEA,IAAMO,WAAW,AAACjB,CAAAA,SAASI,MAAM,CAACc,OAAO,IAAI,EAAE,AAAD,EAAGC,GAAG,CAACX;IACrD,IAAMY,WAAW,AAACpB,CAAAA,SAASI,MAAM,CAACiB,OAAO,IAAI,EAAE,AAAD,EAAGF,GAAG,CAACX;IAErD,OAAO,SAASc,QAAQP,QAAQ;QAC9B,IAAIA,SAASQ,QAAQ,CAAC,UAAU,OAAO;QAEvCR,WAAWR,IAAAA,gBAAO,EAACQ;QACnB,IAAK,IAAIS,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACT,WAAW,OAAO;QACpC;QACA,IAAK,IAAIW,IAAI,GAAGA,IAAIT,SAASQ,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIT,QAAQ,CAACS,EAAE,CAACX,WAAW,OAAO;QACpC;QACA,OAAO,CAACE,SAASQ,MAAM;IACzB;AACF"}
@@ -2,19 +2,22 @@ import minimatch from 'minimatch';
2
2
  import path from 'path-posix';
3
3
  import unixify from 'unixify';
4
4
  /**
5
- * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.
5
+ * @param {{path: string, tsconfig: Object}} tsconfig The path to the loaded TS tsconfig and typescript tsconfig.
6
6
  * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded
7
- */ export default function createMatcher(config) {
8
- const configPath = path.dirname(unixify(config.path));
7
+ */ export default function createMatcher(tsconfig) {
8
+ if (tsconfig === undefined) throw new Error('createMatcher: missing tsconfig');
9
+ if (tsconfig.path === undefined) throw new Error('createMatcher: expecting tsconfig.path');
10
+ if (tsconfig.config === undefined) throw new Error('createMatcher: expecting tsconfig.config');
11
+ const tsconfigPath = path.dirname(unixify(tsconfig.path));
9
12
  function matchFn(condition) {
10
13
  let pattern = unixify(condition);
11
- if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(configPath, pattern);
14
+ if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);
12
15
  return function match(filePath) {
13
16
  return filePath.startsWith(pattern) || minimatch(filePath, pattern);
14
17
  };
15
18
  }
16
- const includes = (config.config.include || []).map(matchFn);
17
- const excludes = (config.config.exclude || []).map(matchFn);
19
+ const includes = (tsconfig.config.include || []).map(matchFn);
20
+ const excludes = (tsconfig.config.exclude || []).map(matchFn);
18
21
  return function matcher(filePath) {
19
22
  if (filePath.endsWith('.json')) return false;
20
23
  filePath = unixify(filePath);
@@ -1 +1 @@
1
- {"version":3,"sources":["createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\n\n/**\n * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.\n * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded\n */\nexport default function createMatcher(config) {\n const configPath = path.dirname(unixify(config.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(configPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = (config.config.include || []).map(matchFn);\n const excludes = (config.config.exclude || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["minimatch","path","unixify","createMatcher","config","configPath","dirname","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","includes","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":"AAAA,OAAOA,eAAe,YAAY;AAClC,OAAOC,UAAU,aAAa;AAC9B,OAAOC,aAAa,UAAU;AAE9B;;;CAGC,GACD,eAAe,SAASC,cAAcC,MAAM;IAC1C,MAAMC,aAAaJ,KAAKK,OAAO,CAACJ,QAAQE,OAAOH,IAAI;IAEnD,SAASM,QAAQC,SAAS;QACxB,IAAIC,UAAUP,QAAQM;QACtB,IAAI,CAACP,KAAKS,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUR,KAAKW,IAAI,CAACP,YAAYI;QAE3F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYT,UAAUc,UAAUL;QAC7D;IACF;IAEA,MAAMM,WAAW,AAACX,CAAAA,OAAOA,MAAM,CAACY,OAAO,IAAI,EAAE,AAAD,EAAGC,GAAG,CAACV;IACnD,MAAMW,WAAW,AAACd,CAAAA,OAAOA,MAAM,CAACe,OAAO,IAAI,EAAE,AAAD,EAAGF,GAAG,CAACV;IAEnD,OAAO,SAASa,QAAQN,QAAQ;QAC9B,IAAIA,SAASO,QAAQ,CAAC,UAAU,OAAO;QAEvCP,WAAWZ,QAAQY;QACnB,IAAK,IAAIQ,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACR,WAAW,OAAO;QACpC;QACA,IAAK,IAAIU,IAAI,GAAGA,IAAIT,SAASQ,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIT,QAAQ,CAACS,EAAE,CAACV,WAAW,OAAO;QACpC;QACA,OAAO,CAACC,SAASQ,MAAM;IACzB;AACF"}
1
+ {"version":3,"sources":["createMatcher.ts"],"sourcesContent":["import minimatch from 'minimatch';\nimport path from 'path-posix';\nimport unixify from 'unixify';\n\n/**\n * @param {{path: string, tsconfig: Object}} tsconfig The path to the loaded TS tsconfig and typescript tsconfig.\n * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded\n */\nexport default function createMatcher(tsconfig) {\n if (tsconfig === undefined) throw new Error('createMatcher: missing tsconfig');\n if (tsconfig.path === undefined) throw new Error('createMatcher: expecting tsconfig.path');\n if (tsconfig.config === undefined) throw new Error('createMatcher: expecting tsconfig.config');\n\n const tsconfigPath = path.dirname(unixify(tsconfig.path));\n\n function matchFn(condition) {\n let pattern = unixify(condition);\n if (!path.isAbsolute(pattern) && !pattern.startsWith('*')) pattern = path.join(tsconfigPath, pattern);\n\n return function match(filePath) {\n return filePath.startsWith(pattern) || minimatch(filePath, pattern);\n };\n }\n\n const includes = (tsconfig.config.include || []).map(matchFn);\n const excludes = (tsconfig.config.exclude || []).map(matchFn);\n\n return function matcher(filePath) {\n if (filePath.endsWith('.json')) return false;\n\n filePath = unixify(filePath);\n for (let i = 0; i < excludes.length; ++i) {\n if (excludes[i](filePath)) return false;\n }\n for (let j = 0; j < includes.length; ++j) {\n if (includes[j](filePath)) return true;\n }\n return !includes.length;\n };\n}\n"],"names":["minimatch","path","unixify","createMatcher","tsconfig","undefined","Error","config","tsconfigPath","dirname","matchFn","condition","pattern","isAbsolute","startsWith","join","match","filePath","includes","include","map","excludes","exclude","matcher","endsWith","i","length","j"],"mappings":"AAAA,OAAOA,eAAe,YAAY;AAClC,OAAOC,UAAU,aAAa;AAC9B,OAAOC,aAAa,UAAU;AAE9B;;;CAGC,GACD,eAAe,SAASC,cAAcC,QAAQ;IAC5C,IAAIA,aAAaC,WAAW,MAAM,IAAIC,MAAM;IAC5C,IAAIF,SAASH,IAAI,KAAKI,WAAW,MAAM,IAAIC,MAAM;IACjD,IAAIF,SAASG,MAAM,KAAKF,WAAW,MAAM,IAAIC,MAAM;IAEnD,MAAME,eAAeP,KAAKQ,OAAO,CAACP,QAAQE,SAASH,IAAI;IAEvD,SAASS,QAAQC,SAAS;QACxB,IAAIC,UAAUV,QAAQS;QACtB,IAAI,CAACV,KAAKY,UAAU,CAACD,YAAY,CAACA,QAAQE,UAAU,CAAC,MAAMF,UAAUX,KAAKc,IAAI,CAACP,cAAcI;QAE7F,OAAO,SAASI,MAAMC,QAAQ;YAC5B,OAAOA,SAASH,UAAU,CAACF,YAAYZ,UAAUiB,UAAUL;QAC7D;IACF;IAEA,MAAMM,WAAW,AAACd,CAAAA,SAASG,MAAM,CAACY,OAAO,IAAI,EAAE,AAAD,EAAGC,GAAG,CAACV;IACrD,MAAMW,WAAW,AAACjB,CAAAA,SAASG,MAAM,CAACe,OAAO,IAAI,EAAE,AAAD,EAAGF,GAAG,CAACV;IAErD,OAAO,SAASa,QAAQN,QAAQ;QAC9B,IAAIA,SAASO,QAAQ,CAAC,UAAU,OAAO;QAEvCP,WAAWf,QAAQe;QACnB,IAAK,IAAIQ,IAAI,GAAGA,IAAIJ,SAASK,MAAM,EAAE,EAAED,EAAG;YACxC,IAAIJ,QAAQ,CAACI,EAAE,CAACR,WAAW,OAAO;QACpC;QACA,IAAK,IAAIU,IAAI,GAAGA,IAAIT,SAASQ,MAAM,EAAE,EAAEC,EAAG;YACxC,IAAIT,QAAQ,CAACS,EAAE,CAACV,WAAW,OAAO;QACpC;QACA,OAAO,CAACC,SAASQ,MAAM;IACzB;AACF"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {{path: string, config: Object}} config The path to the loaded TS config and typescript config.
2
+ * @param {{path: string, tsconfig: Object}} tsconfig The path to the loaded TS tsconfig and typescript tsconfig.
3
3
  * @returns {(filePath:string) => boolean} The function to test for typescript files being included or excluded
4
4
  */
5
- export default function createMatcher(config: any): (filePath: any) => boolean;
5
+ export default function createMatcher(tsconfig: any): (filePath: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -74,10 +74,12 @@
74
74
  "@swc/core": "^1.9.3",
75
75
  "@types/mocha": "^10.0.10",
76
76
  "@types/node": "^22.10.2",
77
- "core-js": "^3.39.0",
78
77
  "cr": "^0.1.0",
78
+ "es6-map": "^0.1.5",
79
+ "es6-symbol": "^3.1.4",
80
+ "object-assign": "^4.1.1",
79
81
  "react": "^19.0.0",
80
- "ts-dev-stack": "^1.5.1",
82
+ "ts-dev-stack": "^1.5.2",
81
83
  "ts-node": "^10.8.2",
82
84
  "typescript": "^5.7.2"
83
85
  },