@nx/remix 23.0.0-beta.17 → 23.0.0-beta.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "23.0.0-beta.17",
3
+ "version": "23.0.0-beta.19",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,16 +30,16 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nx/devkit": "23.0.0-beta.17",
34
- "@nx/js": "23.0.0-beta.17",
35
- "@nx/react": "23.0.0-beta.17",
33
+ "@nx/devkit": "23.0.0-beta.19",
34
+ "@nx/js": "23.0.0-beta.19",
35
+ "@nx/react": "23.0.0-beta.19",
36
36
  "tslib": "^2.3.0",
37
37
  "@phenomnomnominal/tsquery": "~6.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@nx/eslint": "23.0.0-beta.17",
41
- "nx": "23.0.0-beta.17",
42
- "@nx/vitest": "23.0.0-beta.17"
40
+ "@nx/eslint": "23.0.0-beta.19",
41
+ "nx": "23.0.0-beta.19",
42
+ "@nx/vitest": "23.0.0-beta.19"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@remix-run/dev": "^2.17.3"
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/remix/src/plugins/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,kBAAkB,EAGvB,aAAa,EAOd,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,kBAAkB,CA6BzD,CAAC;AAEF,eAAO,MAAM,aAAa,mCAAc,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/remix/src/plugins/plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,kBAAkB,EAIvB,aAAa,EAOd,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,kBAAkB,CA+DzD,CAAC;AAEF,eAAO,MAAM,aAAa,mCAAc,CAAC"}
@@ -27,8 +27,30 @@ exports.createNodes = [
27
27
  const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
28
28
  const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
29
29
  const lockFileName = (0, js_1.getLockFileName)(packageManager);
30
+ const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
31
+ const normalizedOptions = normalizeOptions(options);
30
32
  try {
31
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, (0, internal_2.isUsingTsSolutionSetup)(), pmc, lockFileName), configFilePaths, options, context);
33
+ const { entries, preErrors } = await filterRemixConfigs(configFilePaths, context);
34
+ const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), { ...normalizedOptions, isUsingTsSolutionSetup }, context, entries.map(() => [lockFileName]));
35
+ let results = [];
36
+ let nodeErrors = [];
37
+ try {
38
+ results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isUsingTsSolutionSetup, pmc, entries[idx].siblingFiles, entries[idx].remixCompiler, projectHashes[idx] + configFile), entries.map((e) => e.configFile), options, context);
39
+ }
40
+ catch (e) {
41
+ if (e instanceof devkit_1.AggregateCreateNodesError) {
42
+ results = e.partialResults ?? [];
43
+ nodeErrors = e.errors;
44
+ }
45
+ else {
46
+ throw e;
47
+ }
48
+ }
49
+ const allErrors = [...preErrors, ...nodeErrors];
50
+ if (allErrors.length > 0) {
51
+ throw new devkit_1.AggregateCreateNodesError(allErrors, results);
52
+ }
53
+ return results;
32
54
  }
33
55
  finally {
34
56
  targetsCache.writeToDisk();
@@ -36,21 +58,8 @@ exports.createNodes = [
36
58
  },
37
59
  ];
38
60
  exports.createNodesV2 = exports.createNodes;
39
- async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc, lockFileName) {
61
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc, siblingFiles, remixCompiler, hash) {
40
62
  const projectRoot = (0, path_1.dirname)(configFilePath);
41
- const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
42
- // Do not create a project if package.json and project.json isn't there
43
- const siblingFiles = (0, fs_1.readdirSync)(fullyQualifiedProjectRoot);
44
- if (!siblingFiles.includes('package.json') &&
45
- !siblingFiles.includes('project.json')) {
46
- return {};
47
- }
48
- options = normalizeOptions(options);
49
- const remixCompiler = determineIsRemixVite(configFilePath, context.workspaceRoot);
50
- if (remixCompiler === RemixCompiler.IsNotRemix) {
51
- return {};
52
- }
53
- const hash = (await (0, internal_1.calculateHashForCreateNodes)(projectRoot, { ...options, isUsingTsSolutionSetup }, context, [lockFileName])) + configFilePath;
54
63
  if (!targetsCache.has(hash)) {
55
64
  targetsCache.set(hash, await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup, pmc));
56
65
  }
@@ -245,3 +254,29 @@ var RemixCompiler;
245
254
  RemixCompiler[RemixCompiler["IsVte"] = 2] = "IsVte";
246
255
  RemixCompiler[RemixCompiler["IsNotRemix"] = 3] = "IsNotRemix";
247
256
  })(RemixCompiler || (RemixCompiler = {}));
257
+ async function filterRemixConfigs(configFilePaths, context) {
258
+ const preErrors = [];
259
+ const candidates = await Promise.all(configFilePaths.map(async (configFile) => {
260
+ try {
261
+ const projectRoot = (0, path_1.dirname)(configFile);
262
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
263
+ if (!siblingFiles.includes('package.json') &&
264
+ !siblingFiles.includes('project.json')) {
265
+ return null;
266
+ }
267
+ const remixCompiler = determineIsRemixVite(configFile, context.workspaceRoot);
268
+ if (remixCompiler === RemixCompiler.IsNotRemix) {
269
+ return null;
270
+ }
271
+ return { configFile, projectRoot, siblingFiles, remixCompiler };
272
+ }
273
+ catch (e) {
274
+ preErrors.push([configFile, e]);
275
+ return null;
276
+ }
277
+ }));
278
+ return {
279
+ entries: candidates.filter((c) => c !== null),
280
+ preErrors,
281
+ };
282
+ }