@webiny/build-tools 0.0.0-unstable.e2758ee1cf → 0.0.0-unstable.e6f0dc8ca7

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.
@@ -1,4 +1,3 @@
1
- import { createRsbuild } from "@rsbuild/core";
2
1
  import { createRsbuildConfig } from "./createRsbuildConfig.js";
3
2
  import { printBuildStats } from "../printBuildStats.js";
4
3
 
@@ -7,6 +6,10 @@ export const createBuildAdmin =
7
6
  async ({ cwd }) => {
8
7
  process.env.NODE_ENV = "production";
9
8
 
9
+ // Lazy import: @rsbuild/core transitively loads @rspack/core, which uses
10
+ // import.meta.dirname at module top level. tsx's CJS transformer (used by
11
+ // .babelrc.js files) can't handle that, so we defer the import until here.
12
+ const { createRsbuild } = await import("@rsbuild/core");
10
13
  const rsbuildConfig = createRsbuildConfig({ cwd });
11
14
 
12
15
  const rsbuild = await createRsbuild({ rsbuildConfig });
@@ -33,14 +33,25 @@ export const createRsbuildConfig = ({ cwd }) => {
33
33
  },
34
34
  tools: {
35
35
  postcss: (_, { addPlugins }) => {
36
- addPlugins(
36
+ addPlugins([
37
+ createInjectTailwindSourcePlugin(
38
+ path.join(paths.projectRootFolder, "extensions")
39
+ ),
37
40
  tailwindcss({
38
41
  base: getTailwindBasePath(paths.projectRootFolder)
39
- })
40
- );
42
+ }),
43
+ createStripTailwindSourceLeftoverPlugin()
44
+ ]);
45
+ },
46
+ rspack: {
47
+ watchOptions: {
48
+ // Wait for dependency builds to finish before triggering a recompilation.
49
+ aggregateTimeout: 500,
50
+ ignored: ["**/node_modules/**", "**/.git/**"]
51
+ }
41
52
  }
42
53
  },
43
- server: { port: 3001 },
54
+ server: { port: process.env.PORT || 3001, host: "0.0.0.0" },
44
55
  html: {
45
56
  template: paths.projectRootFolder + "/public/index.html"
46
57
  },
@@ -104,6 +115,31 @@ const getTailwindBasePath = projectRootFolderPath => {
104
115
  return path.join(projectRootFolderPath, "node_modules", "@webiny");
105
116
  };
106
117
 
118
+ /*
119
+ Injects an `@source` directive into the Tailwind CSS AST at build time, pointing to the
120
+ given absolute path. https://tailwindcss.com/docs/functions-and-directives#source-directive
121
+ */
122
+ const createInjectTailwindSourcePlugin = sourcePath => ({
123
+ postcssPlugin: "inject-tailwind-source",
124
+ Once(root) {
125
+ root.prepend(`@source "${sourcePath}";`);
126
+ }
127
+ });
128
+
129
+ /*
130
+ Removes any leftover `@source` at-rule from the output. Tailwind v4 strips the
131
+ directive from files it processes, but `@tailwindcss/postcss` only processes
132
+ files containing one of its trigger at-rules; for other files (e.g., pre-bundled
133
+ component CSS imported through JS), the injected directive would otherwise
134
+ survive into the production bundle, exposing the absolute build-machine path.
135
+ */
136
+ const createStripTailwindSourceLeftoverPlugin = () => ({
137
+ postcssPlugin: "strip-tailwind-source-leftover",
138
+ Once(root) {
139
+ root.walkAtRules("source", node => node.remove());
140
+ }
141
+ });
142
+
107
143
  const getEnvVars = () => {
108
144
  const raw = Object.keys(process.env)
109
145
  .filter(key => {
@@ -1,4 +1,3 @@
1
- import { createRsbuild } from "@rsbuild/core";
2
1
  import { createRsbuildConfig } from "./createRsbuildConfig.js";
3
2
 
4
3
  export const createWatchAdmin =
@@ -6,6 +5,10 @@ export const createWatchAdmin =
6
5
  async ({ cwd }) => {
7
6
  process.env.NODE_ENV = "development";
8
7
 
8
+ // Lazy import: @rsbuild/core transitively loads @rspack/core, which uses
9
+ // import.meta.dirname at module top level. tsx's CJS transformer (used by
10
+ // .babelrc.js files) can't handle that, so we defer the import until here.
11
+ const { createRsbuild } = await import("@rsbuild/core");
9
12
  const rsbuildConfig = createRsbuildConfig({ cwd });
10
13
 
11
14
  const rsbuild = await createRsbuild({ rsbuildConfig });
@@ -1,4 +1,3 @@
1
- import { createRsbuild } from "@rsbuild/core";
2
1
  import { createRsbuildConfig } from "./createRsbuildConfig.js";
3
2
  import { printBuildStats } from "../printBuildStats.js";
4
3
 
@@ -7,7 +6,11 @@ export const createBuildFunction =
7
6
  async ({ cwd }) => {
8
7
  process.env.NODE_ENV = "production";
9
8
 
10
- const rsbuildConfig = createRsbuildConfig({ cwd });
9
+ // Lazy import: @rsbuild/core transitively loads @rspack/core, which uses
10
+ // import.meta.dirname at module top level. tsx's CJS transformer (used by
11
+ // .babelrc.js files) can't handle that, so we defer the import until here.
12
+ const { createRsbuild } = await import("@rsbuild/core");
13
+ const rsbuildConfig = await createRsbuildConfig({ cwd });
11
14
 
12
15
  const rsbuild = await createRsbuild({ rsbuildConfig });
13
16
 
@@ -1,9 +1,11 @@
1
1
  import path from "path";
2
- import rspack from "@rspack/core";
3
2
  import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
4
3
  import { createImportValidatorPlugin } from "../importValidatorPlugin.js";
5
4
 
6
- export const createRsbuildConfig = ({ cwd }) => {
5
+ export const createRsbuildConfig = async ({ cwd }) => {
6
+ // Lazy import: @rspack/core uses import.meta.dirname at module top level, which
7
+ // tsx's CJS transformer can't handle. Deferring keeps the module safe to require().
8
+ const { default: rspack } = await import("@rspack/core");
7
9
  const paths = getPaths(cwd);
8
10
  const mode = getMode();
9
11
 
@@ -30,7 +32,7 @@ export const createRsbuildConfig = ({ cwd }) => {
30
32
  },
31
33
  tools: {
32
34
  rspack: {
33
- externals: [/^@aws-sdk/, /^sharp$/],
35
+ externals: [/^@aws-sdk/, /^aws-sdk$/, /^sharp$/],
34
36
  plugins: [
35
37
  // This is necessary to enable JSDOM usage in Lambda.
36
38
  // https://rspack.dev/plugins/webpack/ignore-plugin
@@ -1,4 +1,3 @@
1
- import { createRsbuild } from "@rsbuild/core";
2
1
  import { createRsbuildConfig } from "./createRsbuildConfig.js";
3
2
 
4
3
  export const createWatchFunction =
@@ -6,7 +5,11 @@ export const createWatchFunction =
6
5
  async ({ cwd }) => {
7
6
  process.env.NODE_ENV = "development";
8
7
 
9
- const rsbuildConfig = createRsbuildConfig({ cwd });
8
+ // Lazy import: @rsbuild/core transitively loads @rspack/core, which uses
9
+ // import.meta.dirname at module top level. tsx's CJS transformer (used by
10
+ // .babelrc.js files) can't handle that, so we defer the import until here.
11
+ const { createRsbuild } = await import("@rsbuild/core");
12
+ const rsbuildConfig = await createRsbuildConfig({ cwd });
10
13
 
11
14
  const rsbuild = await createRsbuild({ rsbuildConfig });
12
15
 
@@ -4,7 +4,9 @@ import chalk from "chalk";
4
4
  export const printBuildStats =
5
5
  ({ cwd, label = "build", extensions = [".js", ".mjs", ".css"] }) =>
6
6
  ({ stats }) => {
7
- if (!stats) return;
7
+ if (!stats) {
8
+ return;
9
+ }
8
10
 
9
11
  const statsJson = stats.toJson({ assets: true, children: false });
10
12
  const assets = statsJson.assets || [];
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/build-tools",
3
- "version": "0.0.0-unstable.e2758ee1cf",
3
+ "version": "0.0.0-unstable.e6f0dc8ca7",
4
4
  "type": "module",
5
- "main": "index.js",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
6
9
  "description": "A collection of utilities for Webiny project.",
7
10
  "repository": {
8
11
  "type": "git",
@@ -15,42 +18,40 @@
15
18
  ],
16
19
  "dependencies": {
17
20
  "@babel/core": "7.29.0",
18
- "@babel/preset-env": "7.29.0",
21
+ "@babel/preset-env": "7.29.5",
19
22
  "@babel/preset-react": "7.28.5",
20
23
  "@babel/preset-typescript": "7.28.5",
21
- "@babel/runtime": "7.28.6",
22
- "@rsbuild/core": "1.7.3",
23
- "@rsbuild/plugin-react": "1.4.5",
24
- "@rsbuild/plugin-sass": "1.5.0",
25
- "@rsbuild/plugin-svgr": "1.3.0",
24
+ "@babel/runtime": "7.29.2",
25
+ "@rsbuild/core": "2.0.5",
26
+ "@rsbuild/plugin-react": "2.0.0",
27
+ "@rsbuild/plugin-sass": "1.5.2",
28
+ "@rsbuild/plugin-svgr": "2.0.2",
26
29
  "@rsbuild/plugin-type-check": "1.3.4",
27
- "@rspack/core": "1.7.6",
28
- "@svgr/webpack": "6.5.1",
29
- "@swc/plugin-emotion": "11.5.0",
30
- "@tailwindcss/postcss": "4.2.1",
30
+ "@rspack/core": "2.0.2",
31
+ "@svgr/webpack": "8.1.0",
32
+ "@swc/plugin-emotion": "14.9.0",
33
+ "@tailwindcss/postcss": "4.3.0",
31
34
  "@types/webpack-env": "1.18.8",
32
- "chalk": "4.1.2",
33
- "chokidar": "4.0.3",
35
+ "chalk": "5.6.2",
36
+ "chokidar": "5.0.0",
34
37
  "css-loader": "7.1.4",
35
- "eslint": "10.0.2",
36
38
  "fast-glob": "3.3.3",
37
- "find-up": "5.0.0",
38
- "fs-extra": "11.3.3",
39
+ "find-up": "8.0.0",
40
+ "fs-extra": "11.3.5",
39
41
  "get-yarn-workspaces": "1.0.2",
40
- "lodash": "4.17.23",
42
+ "load-json-file": "7.0.1",
43
+ "lodash": "4.18.1",
41
44
  "postcss-loader": "8.2.1",
42
- "process": "0.11.10",
43
45
  "raw-loader": "4.0.2",
44
- "react-dom": "18.2.0",
45
- "react-refresh": "0.11.0",
46
- "read-json-sync": "2.0.1",
46
+ "react-dom": "18.3.1",
47
+ "react-refresh": "0.18.0",
47
48
  "rimraf": "6.1.3",
48
- "sass": "1.97.3",
49
- "sass-loader": "16.0.7",
50
- "style-loader": "3.3.4",
51
- "ts-morph": "27.0.2",
49
+ "sass": "1.99.0",
50
+ "sass-loader": "16.0.8",
51
+ "style-loader": "4.0.0",
52
+ "ts-morph": "28.0.0",
52
53
  "tsx": "4.21.0",
53
- "typescript": "5.9.3",
54
+ "typescript": "6.0.3",
54
55
  "url-loader": "4.1.1",
55
56
  "utf-8-validate": "6.0.6"
56
57
  },
@@ -74,8 +75,6 @@
74
75
  "react-refresh",
75
76
  "style-loader",
76
77
  "typescript",
77
- "eslint",
78
- "process",
79
78
  "sass-loader",
80
79
  "sass",
81
80
  "bufferutil",
@@ -89,5 +88,5 @@
89
88
  "access": "public",
90
89
  "directory": "."
91
90
  },
92
- "gitHead": "e2758ee1cfa3b9a7152e9bb995a90ccabd33266f"
91
+ "gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
93
92
  }
@@ -1,5 +1,5 @@
1
1
  import fs from "fs";
2
- import { dirname, extname, join, parse, relative } from "path";
2
+ import { dirname, join, parse, relative } from "path";
3
3
  import * as babel from "@babel/core";
4
4
  import glob from "fast-glob";
5
5
 
@@ -1,25 +1,38 @@
1
- import { dirname, relative } from "path";
1
+ import { dirname, join, relative, resolve } 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,
8
15
  absolute: true
9
16
  });
10
17
 
18
+ // Build a map of absolute src paths → package names, by scanning sibling packages.
19
+ // This is used to rewrite cross-package src paths (e.g. "../../api/src") back to
20
+ // proper package names (e.g. "@webiny/api") in generated .d.ts files.
21
+ const srcToPackageName = buildSrcToPackageNameMap(cwd);
22
+
11
23
  for (const dtsFile of dtsFiles) {
12
- let content = fs.readFileSync(dtsFile, "utf8");
24
+ let content = fs.readFileSync(dtsFile, "utf8").toString();
13
25
  let modified = false;
14
26
 
15
27
  // Replace all imports/exports with ~/ alias
16
28
  content = content.replace(
17
29
  /(from\s+["'])~\/([^"']+)(["'])/g,
18
- (match, prefix, importPath, suffix) => {
30
+ (_, prefix, importPath, suffix) => {
19
31
  modified = true;
20
32
  // Calculate relative path from current file to dist root
21
- const fileDir = dirname(dtsFile);
22
- const relativePath = relative(fileDir, distDir);
33
+ const fileDir = dirname(dtsFile).replace(/\\/g, "/");
34
+ const normalizedDistDir = distDir.replace(/\\/g, "/");
35
+ const relativePath = relative(fileDir, normalizedDistDir).replace(/\\/g, "/");
23
36
  const finalPath = relativePath
24
37
  ? `${relativePath}/${importPath}`
25
38
  : `./${importPath}`;
@@ -29,11 +42,84 @@ export const replaceTscAliases = async ({ distDir, cwd, debug = false }) => {
29
42
  }
30
43
  );
31
44
 
45
+ // Replace cross-package src paths (e.g. "../../api/src/types") with proper package
46
+ // names (e.g. "@webiny/api/types"). TypeScript inlines these relative paths when
47
+ // project references are used and dependencies have paths pointing to src/.
48
+ if (srcToPackageName.size > 0) {
49
+ content = content.replace(
50
+ /["'](\.\.[^"']*\/src(?:\/[^"']*)?)['"]/g,
51
+ (match, relPath) => {
52
+ const quote = match[0];
53
+ const absPath = resolve(dirname(dtsFile), relPath);
54
+ const packageName = resolveToPackageName(absPath, srcToPackageName);
55
+ if (packageName) {
56
+ modified = true;
57
+ return `${quote}${packageName}${quote}`;
58
+ }
59
+ return match;
60
+ }
61
+ );
62
+ }
63
+
32
64
  if (modified) {
33
65
  fs.writeFileSync(dtsFile, content, "utf8");
34
66
  if (debug) {
35
- console.log(`Resolved ~ aliases in: ${relative(cwd, dtsFile)}`);
67
+ console.log(`Resolved aliases in: ${relative(cwd, dtsFile)}`);
36
68
  }
37
69
  }
38
70
  }
39
71
  };
72
+
73
+ /**
74
+ * Scans sibling packages to build a map of absolute src directory paths → package names.
75
+ * @param {string} cwd - The current package directory.
76
+ * @returns {Map<string, string>}
77
+ */
78
+ function buildSrcToPackageNameMap(cwd) {
79
+ const map = new Map();
80
+ // Go up to the packages/ directory (cwd is packages/xxx, parent is packages/)
81
+ const packagesDir = resolve(cwd, "..");
82
+ if (!fs.existsSync(packagesDir)) {
83
+ return map;
84
+ }
85
+ let entries;
86
+ try {
87
+ entries = fs.readdirSync(packagesDir);
88
+ } catch {
89
+ return map;
90
+ }
91
+ for (const entry of entries) {
92
+ const pkgDir = join(packagesDir, entry);
93
+ const pkgJsonPath = join(pkgDir, "package.json");
94
+ if (!fs.existsSync(pkgJsonPath)) {
95
+ continue;
96
+ }
97
+ try {
98
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
99
+ if (pkgJson.name) {
100
+ const srcDir = join(pkgDir, "src");
101
+ map.set(srcDir, pkgJson.name);
102
+ }
103
+ } catch {
104
+ // ignore
105
+ }
106
+ }
107
+ return map;
108
+ }
109
+
110
+ /**
111
+ * Given an absolute path that points into a package's src directory, returns the
112
+ * corresponding package name + sub-path (e.g. "@webiny/api/types").
113
+ * @param {string} absPath - Absolute path resolved from the relative import.
114
+ * @param {Map<string, string>} srcToPackageName
115
+ * @returns {string|null}
116
+ */
117
+ function resolveToPackageName(absPath, srcToPackageName) {
118
+ for (const [srcDir, packageName] of srcToPackageName) {
119
+ if (absPath === srcDir || absPath.startsWith(srcDir + "/")) {
120
+ const subPath = absPath.slice(srcDir.length).replace(/^\//, "");
121
+ return subPath ? `${packageName}/${subPath}` : packageName;
122
+ }
123
+ }
124
+ return null;
125
+ }
@@ -3,8 +3,11 @@ import ts from "typescript";
3
3
  import merge from "lodash/merge.js";
4
4
  import { replaceTscAliases } from "./tsAliasReplacer.js";
5
5
 
6
- export const tsCompile = async ({ cwd = "", overrides, debug }) => {
7
- const tsConfigPath = join(cwd, "tsconfig.build.json");
6
+ export const tsCompile = async ({ cwd = "", overrides, debug, checkOnly = false }) => {
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,13 +23,16 @@ 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
 
32
+ if (checkOnly) {
33
+ options.noEmit = true;
34
+ }
35
+
30
36
  const program = ts.createProgram({
31
37
  projectReferences,
32
38
  options,
@@ -34,12 +40,31 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
34
40
  configFileParsingDiagnostics: errors
35
41
  });
36
42
 
43
+ if (checkOnly) {
44
+ const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(errors);
45
+
46
+ if (allDiagnostics.length) {
47
+ const formatHost = {
48
+ getCanonicalFileName: path => path,
49
+ getCurrentDirectory: () => normalizedCwd,
50
+ getNewLine: () => ts.sys.newLine
51
+ };
52
+ const message = ts.formatDiagnostics(allDiagnostics, formatHost);
53
+ if (message) {
54
+ throw { message };
55
+ }
56
+ }
57
+ return;
58
+ }
59
+
37
60
  const { diagnostics, emitSkipped } = program.emit(
38
61
  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("../")) {
62
+ (fileName, data, writeByteOrderMark) => {
63
+ // Only emit files within the current package directory.
64
+ // Normalize path separators to handle Windows backslashes vs forward slashes.
65
+ const normalizedFileName = fileName.replace(/\\/g, "/");
66
+ const relativePath = normalizedFileName.replace(normalizedCwd, "");
67
+ if (normalizedFileName.startsWith(normalizedCwd) && !relativePath.includes("../")) {
43
68
  ts.sys.writeFile(fileName, data, writeByteOrderMark);
44
69
  }
45
70
  }
@@ -50,7 +75,7 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
50
75
  if (allDiagnostics.length) {
51
76
  const formatHost = {
52
77
  getCanonicalFileName: path => path,
53
- getCurrentDirectory: () => cwd,
78
+ getCurrentDirectory: () => normalizedCwd,
54
79
  getNewLine: () => ts.sys.newLine
55
80
  };
56
81
  const message = ts.formatDiagnostics(allDiagnostics, formatHost);
@@ -64,6 +89,6 @@ export const tsCompile = async ({ cwd = "", overrides, debug }) => {
64
89
  }
65
90
 
66
91
  // Resolve ~ path aliases in .d.ts files
67
- const distDir = options.outDir || join(cwd, "dist");
68
- await replaceTscAliases({ distDir, cwd, debug });
92
+ const distDir = options.outDir || join(normalizedCwd, "dist");
93
+ await replaceTscAliases({ distDir, cwd: normalizedCwd, debug });
69
94
  };
@@ -1,5 +1,6 @@
1
1
  import * as rimraf from "rimraf";
2
2
  import { join } from "path";
3
+ import fs from "node:fs";
3
4
  import { babelCompile } from "./buildPackage/babelCompile.js";
4
5
  import { tsCompile } from "./buildPackage/tsCompile.js";
5
6
  import { copyToDist } from "./buildPackage/copyToDist.js";
@@ -12,8 +13,7 @@ export default async options => {
12
13
  options.cwd = "";
13
14
  }
14
15
  const { cwd = "" } = options;
15
- options.logs !== false && console.log("Deleting existing build files...");
16
- rimraf.sync(join(cwd, "./dist"));
16
+
17
17
  rimraf.sync(join(cwd, "*.tsbuildinfo"), { glob: true });
18
18
 
19
19
  options.logs !== false && console.log("Building...");
@@ -26,6 +26,16 @@ export default async options => {
26
26
  // Validate ESM imports before compiling
27
27
  await validateEsmImports({ cwd, logs: options.logs });
28
28
 
29
+ // Clear dist/ contents without removing the directory itself.
30
+ // node_modules/@webiny/<pkg> symlinks directly to dist/, so deleting
31
+ // the directory would leave a dangling symlink and break Rspack resolution.
32
+ const distDir = join(cwd, "dist");
33
+ if (fs.existsSync(distDir)) {
34
+ for (const entry of fs.readdirSync(distDir)) {
35
+ fs.rmSync(join(distDir, entry), { recursive: true, force: true });
36
+ }
37
+ }
38
+
29
39
  await babelCompile(options);
30
40
  await tsCompile(options);
31
41
 
@@ -1,4 +1,4 @@
1
- import readJsonSync from "read-json-sync";
1
+ import { loadJsonFileSync } from "load-json-file";
2
2
 
3
3
  export default ({ path, esm }) => {
4
4
  return {
@@ -7,14 +7,14 @@ export default ({ path, esm }) => {
7
7
  "@babel/preset-env",
8
8
  {
9
9
  targets: {
10
- node: "18"
10
+ // nodejs - to easily find this with search. there is a lot of "node" in the code
11
+ node: 24
11
12
  },
12
13
  modules: esm ? false : "auto",
13
14
  exclude: [
14
15
  "transform-typeof-symbol",
15
16
  "@babel/plugin-proposal-optional-chaining",
16
17
  "@babel/plugin-proposal-nullish-coalescing-operator",
17
- "@babel/plugin-proposal-class-properties",
18
18
  "@babel/plugin-transform-async-to-generator",
19
19
  "@babel/plugin-transform-regenerator",
20
20
  "@babel/plugin-proposal-dynamic-import"
@@ -28,7 +28,8 @@ export default ({ path, esm }) => {
28
28
  "@babel/plugin-transform-runtime",
29
29
  {
30
30
  useESModules: !!esm,
31
- version: readJsonSync(require.resolve("@babel/runtime/package.json")).version
31
+ version: loadJsonFileSync(require.resolve("@babel/runtime/package.json"))
32
+ .version
32
33
  }
33
34
  ],
34
35
  [
@@ -1,14 +1,13 @@
1
1
  // We'll use this class once the package is converted to TS!
2
-
3
- import readJson from "read-json-sync";
4
- import findUp from "find-up";
2
+ import { loadJsonFileSync } from "load-json-file";
3
+ import { findUp } from "find-up";
5
4
 
6
5
  export class PackageJson {
7
6
  private readonly filePath: string;
8
7
  private readonly json: Record<string, any>;
9
8
 
10
9
  static fromFile(filePath: string) {
11
- return new PackageJson(filePath, readJson(filePath));
10
+ return new PackageJson(filePath, loadJsonFileSync(filePath));
12
11
  }
13
12
 
14
13
  static async findClosest(fromPath: string) {
@@ -1,12 +1,12 @@
1
- import readJson from "read-json-sync";
2
- import findUp from "find-up";
1
+ import { loadJsonFileSync } from "load-json-file";
2
+ import { findUp } from "find-up";
3
3
 
4
4
  export class PackageJson {
5
5
  filePath;
6
6
  json;
7
7
 
8
8
  static fromFile(filePath) {
9
- return new PackageJson(filePath, readJson(filePath));
9
+ return new PackageJson(filePath, loadJsonFileSync(filePath));
10
10
  }
11
11
 
12
12
  static async findClosest(fromPath) {
@@ -11,7 +11,7 @@ import path from "path";
11
11
  import get from "lodash/get.js";
12
12
  import fs from "fs-extra";
13
13
  import * as rimraf from "rimraf";
14
- import readJsonSync from "read-json-sync";
14
+ import { loadJsonFileSync } from "load-json-file";
15
15
 
16
16
  async function symlink(src, dest) {
17
17
  if (process.platform !== "win32") {
@@ -53,13 +53,11 @@ const defaults = {
53
53
 
54
54
  export const linkWorkspaces = async ({ whitelist, blacklist } = defaults) => {
55
55
  console.log(`Linking project workspaces...`);
56
- //eslint-disable-next-line import/dynamic-import-chunkname
57
56
  const { PackageJson } = await import("../utils/PackageJson.js");
58
57
 
59
58
  whitelist = (whitelist || []).map(p => path.resolve(p));
60
59
  blacklist = (blacklist || []).map(p => path.resolve(p));
61
60
  // Filter packages to only those in the whitelisted folders
62
- //eslint-disable-next-line import/dynamic-import-chunkname
63
61
  const getYarnWorkspaces = await import("get-yarn-workspaces").then(m => m.default ?? m);
64
62
  const packages = getYarnWorkspaces(process.cwd())
65
63
  .map(pkg => pkg.replace(/\//g, path.sep))
@@ -74,7 +72,7 @@ export const linkWorkspaces = async ({ whitelist, blacklist } = defaults) => {
74
72
  });
75
73
 
76
74
  const lernaJson = path.resolve("lerna.json");
77
- const lerna = fs.existsSync(lernaJson) ? readJsonSync(lernaJson) : null;
75
+ const lerna = fs.existsSync(lernaJson) ? loadJsonFileSync(lernaJson) : null;
78
76
 
79
77
  for (let i = 0; i < packages.length; i++) {
80
78
  const packageJson = path.resolve(packages[i], "package.json");
package/.eslintrc.cjs DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ["../../.eslintrc.cjs"],
3
- rules: {
4
- "import/dynamic-import-chunkname": 0
5
- }
6
- };