@esportsplus/typescript 0.17.3 → 0.17.4

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/build/cli/tsc.js CHANGED
@@ -4,6 +4,7 @@ import { pathToFileURL } from 'url';
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
6
  import ts from 'typescript';
7
+ const BACKSLASH_REGEX = /\\/g;
7
8
  let require = createRequire(import.meta.url), skipFlags = ['--help', '--init', '--noEmit', '--showConfig', '--version', '-h', '-noEmit', '-v'];
8
9
  async function build(tsconfig, plugins) {
9
10
  let { config, error } = ts.readConfigFile(tsconfig, ts.sys.readFile), root = path.dirname(path.resolve(tsconfig));
@@ -35,14 +36,14 @@ async function build(tsconfig, plugins) {
35
36
  if (transformedFiles.size > 0) {
36
37
  let customHost = ts.createCompilerHost(parsed.options), originalGetSourceFile = customHost.getSourceFile.bind(customHost), originalReadFile = customHost.readFile.bind(customHost);
37
38
  customHost.readFile = (fileName) => {
38
- let transformed = transformedFiles.get(path.resolve(fileName));
39
+ let transformed = transformedFiles.get(path.resolve(fileName).replace(BACKSLASH_REGEX, '/'));
39
40
  if (transformed) {
40
41
  return transformed;
41
42
  }
42
43
  return originalReadFile(fileName);
43
44
  };
44
45
  customHost.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
45
- let resolved = path.resolve(fileName), transformed = transformedFiles.get(resolved);
46
+ let transformed = transformedFiles.get(path.resolve(fileName).replace(BACKSLASH_REGEX, '/'));
46
47
  if (transformed) {
47
48
  return ts.createSourceFile(fileName, transformed, languageVersion, true);
48
49
  }
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "type": "module",
36
36
  "types": "build/index.d.ts",
37
- "version": "0.17.3",
37
+ "version": "0.17.4",
38
38
  "scripts": {
39
39
  "build": "tsc && tsc-alias",
40
40
  "-": "-"
package/src/cli/tsc.ts CHANGED
@@ -18,6 +18,9 @@ type PluginConfig = {
18
18
  type TransformerCreator = (program: ts.Program) => ts.TransformerFactory<ts.SourceFile>;
19
19
 
20
20
 
21
+ const BACKSLASH_REGEX = /\\/g;
22
+
23
+
21
24
  let require = createRequire(import.meta.url),
22
25
  skipFlags = ['--help', '--init', '--noEmit', '--showConfig', '--version', '-h', '-noEmit', '-v'];
23
26
 
@@ -72,7 +75,9 @@ async function build(tsconfig: string, plugins: PluginConfig[]): Promise<void> {
72
75
  originalReadFile = customHost.readFile.bind(customHost);
73
76
 
74
77
  customHost.readFile = (fileName: string): string | undefined => {
75
- let transformed = transformedFiles.get(path.resolve(fileName));
78
+ let transformed = transformedFiles.get(
79
+ path.resolve(fileName).replace(BACKSLASH_REGEX, '/')
80
+ );
76
81
 
77
82
  if (transformed) {
78
83
  return transformed;
@@ -87,8 +92,9 @@ async function build(tsconfig: string, plugins: PluginConfig[]): Promise<void> {
87
92
  onError?: (message: string) => void,
88
93
  shouldCreateNewSourceFile?: boolean
89
94
  ): ts.SourceFile | undefined => {
90
- let resolved = path.resolve(fileName),
91
- transformed = transformedFiles.get(resolved);
95
+ let transformed = transformedFiles.get(
96
+ path.resolve(fileName).replace(BACKSLASH_REGEX, '/')
97
+ );
92
98
 
93
99
  if (transformed) {
94
100
  return ts.createSourceFile(fileName, transformed, languageVersion, true);