@webiny/build-tools 0.0.0-unstable.ac6ebf63c6 → 0.0.0-unstable.c27f4d8a31

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.
@@ -5,7 +5,7 @@ const cyan = "\x1b[36m";
5
5
  const reset = "\x1b[0m";
6
6
  const bold = "\x1b[1m";
7
7
 
8
- const whitelist = ["@webiny/cognito", "@webiny/auth0", "@webiny/okta"];
8
+ const whitelist = ["@webiny/cognito", "@webiny/auth0", "@webiny/okta", "@webiny/plugins"];
9
9
 
10
10
  export const createImportValidatorPlugin = () => {
11
11
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/build-tools",
3
- "version": "0.0.0-unstable.ac6ebf63c6",
3
+ "version": "0.0.0-unstable.c27f4d8a31",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "description": "A collection of utilities for Webiny project.",
@@ -23,26 +23,26 @@
23
23
  "@rsbuild/plugin-react": "1.4.5",
24
24
  "@rsbuild/plugin-sass": "1.5.0",
25
25
  "@rsbuild/plugin-svgr": "1.3.0",
26
- "@rsbuild/plugin-type-check": "1.3.3",
27
- "@rspack/core": "1.7.6",
26
+ "@rsbuild/plugin-type-check": "1.3.4",
27
+ "@rspack/core": "1.7.8",
28
28
  "@svgr/webpack": "6.5.1",
29
29
  "@swc/plugin-emotion": "11.5.0",
30
- "@tailwindcss/postcss": "4.1.18",
30
+ "@tailwindcss/postcss": "4.2.1",
31
31
  "@types/webpack-env": "1.18.8",
32
32
  "chalk": "4.1.2",
33
33
  "chokidar": "4.0.3",
34
- "css-loader": "7.1.3",
35
- "eslint": "9.39.2",
34
+ "css-loader": "7.1.4",
35
+ "eslint": "10.0.3",
36
36
  "fast-glob": "3.3.3",
37
37
  "find-up": "5.0.0",
38
- "fs-extra": "11.3.3",
38
+ "fs-extra": "11.3.4",
39
39
  "get-yarn-workspaces": "1.0.2",
40
40
  "lodash": "4.17.23",
41
41
  "postcss-loader": "8.2.1",
42
42
  "process": "0.11.10",
43
43
  "raw-loader": "4.0.2",
44
- "react-dom": "18.2.0",
45
- "react-refresh": "0.11.0",
44
+ "react-dom": "18.3.1",
45
+ "react-refresh": "0.18.0",
46
46
  "read-json-sync": "2.0.1",
47
47
  "rimraf": "6.1.3",
48
48
  "sass": "1.97.3",
@@ -89,5 +89,5 @@
89
89
  "access": "public",
90
90
  "directory": "."
91
91
  },
92
- "gitHead": "ac6ebf63c6de308703d41f2c1b375e03cd96b813"
92
+ "gitHead": "c27f4d8a31c3af1570817797441855292b6c1f20"
93
93
  }
@@ -1,7 +1,14 @@
1
- import { dirname, relative } from "path";
1
+ import { dirname, relative } from "node:path";
2
2
  import fg from "fast-glob";
3
- import fs from "fs";
3
+ import fs from "node:fs";
4
4
 
5
+ /**
6
+ *
7
+ * @param distDir {String}
8
+ * @param cwd {String}
9
+ * @param debug {Boolean}
10
+ * @returns {Promise<void>}
11
+ */
5
12
  export const replaceTscAliases = async ({ distDir, cwd, debug = false }) => {
6
13
  const dtsFiles = await fg("**/*.d.ts", {
7
14
  cwd: distDir,
@@ -9,17 +16,18 @@ export const replaceTscAliases = async ({ distDir, cwd, debug = false }) => {
9
16
  });
10
17
 
11
18
  for (const dtsFile of dtsFiles) {
12
- let content = fs.readFileSync(dtsFile, "utf8");
19
+ let content = fs.readFileSync(dtsFile, "utf8").toString();
13
20
  let modified = false;
14
21
 
15
22
  // Replace all imports/exports with ~/ alias
16
23
  content = content.replace(
17
24
  /(from\s+["'])~\/([^"']+)(["'])/g,
18
- (match, prefix, importPath, suffix) => {
25
+ (_, prefix, importPath, suffix) => {
19
26
  modified = true;
20
27
  // Calculate relative path from current file to dist root
21
- const fileDir = dirname(dtsFile);
22
- const relativePath = relative(fileDir, distDir);
28
+ const fileDir = dirname(dtsFile).replace(/\\/g, "/");
29
+ const normalizedDistDir = distDir.replace(/\\/g, "/");
30
+ const relativePath = relative(fileDir, normalizedDistDir).replace(/\\/g, "/");
23
31
  const finalPath = relativePath
24
32
  ? `${relativePath}/${importPath}`
25
33
  : `./${importPath}`;
@@ -4,7 +4,10 @@ import merge from "lodash/merge.js";
4
4
  import { replaceTscAliases } from "./tsAliasReplacer.js";
5
5
 
6
6
  export const tsCompile = async ({ cwd = "", overrides, debug }) => {
7
- const tsConfigPath = join(cwd, "tsconfig.build.json");
7
+ // Normalize path separators to forward slashes for consistent behavior on Windows.
8
+ const normalizedCwd = cwd.replace(/\\/g, "/");
9
+
10
+ const tsConfigPath = join(normalizedCwd, "tsconfig.build.json");
8
11
 
9
12
  let { config: readTsConfig } = ts.readConfigFile(tsConfigPath, ts.sys.readFile);
10
13
 
@@ -20,11 +23,10 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
20
23
  console.log(readTsConfig);
21
24
  }
22
25
  }
23
- const parsedJsonConfigFile = ts.parseJsonConfigFileContent(readTsConfig, ts.sys, cwd);
26
+ const parsedJsonConfigFile = ts.parseJsonConfigFileContent(readTsConfig, ts.sys, normalizedCwd);
24
27
 
25
28
  const { projectReferences, options, fileNames, errors } = parsedJsonConfigFile;
26
29
 
27
- // Exclude .d.ts files from TypeScript compilation
28
30
  const filteredFileNames = fileNames.filter(fileName => !fileName.endsWith(".d.ts"));
29
31
 
30
32
  const program = ts.createProgram({
@@ -36,10 +38,12 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
36
38
 
37
39
  const { diagnostics, emitSkipped } = program.emit(
38
40
  undefined, // targetSourceFile
39
- (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
40
- // Only emit files within the current package directory
41
- const relativePath = fileName.replace(cwd, "");
42
- if (fileName.startsWith(cwd) && !relativePath.includes("../")) {
41
+ (fileName, data, writeByteOrderMark) => {
42
+ // Only emit files within the current package directory.
43
+ // Normalize path separators to handle Windows backslashes vs forward slashes.
44
+ const normalizedFileName = fileName.replace(/\\/g, "/");
45
+ const relativePath = normalizedFileName.replace(normalizedCwd, "");
46
+ if (normalizedFileName.startsWith(normalizedCwd) && !relativePath.includes("../")) {
43
47
  ts.sys.writeFile(fileName, data, writeByteOrderMark);
44
48
  }
45
49
  }
@@ -50,7 +54,7 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
50
54
  if (allDiagnostics.length) {
51
55
  const formatHost = {
52
56
  getCanonicalFileName: path => path,
53
- getCurrentDirectory: () => cwd,
57
+ getCurrentDirectory: () => normalizedCwd,
54
58
  getNewLine: () => ts.sys.newLine
55
59
  };
56
60
  const message = ts.formatDiagnostics(allDiagnostics, formatHost);
@@ -64,6 +68,6 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
64
68
  }
65
69
 
66
70
  // Resolve ~ path aliases in .d.ts files
67
- const distDir = options.outDir || join(cwd, "dist");
68
- await replaceTscAliases({ distDir, cwd, debug });
71
+ const distDir = options.outDir || join(normalizedCwd, "dist");
72
+ await replaceTscAliases({ distDir, cwd: normalizedCwd, debug });
69
73
  };