@nx/remix 16.0.0-beta.0

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.
Files changed (117) hide show
  1. package/README.md +120 -0
  2. package/generators.json +69 -0
  3. package/migrations.json +119 -0
  4. package/package.json +17 -0
  5. package/src/generators/action/action.impl.d.ts +3 -0
  6. package/src/generators/action/action.impl.js +41 -0
  7. package/src/generators/action/action.impl.js.map +1 -0
  8. package/src/generators/action/schema.d.ts +4 -0
  9. package/src/generators/action/schema.json +26 -0
  10. package/src/generators/application/application.impl.d.ts +3 -0
  11. package/src/generators/application/application.impl.js +94 -0
  12. package/src/generators/application/application.impl.js.map +1 -0
  13. package/src/generators/application/files/common/README.md__tmpl__ +54 -0
  14. package/src/generators/application/files/common/app/root.tsx__tmpl__ +32 -0
  15. package/src/generators/application/files/common/app/routes/index.tsx__tmpl__ +32 -0
  16. package/src/generators/application/files/common/public/favicon.ico +0 -0
  17. package/src/generators/application/files/common/remix.config.js__tmpl__ +11 -0
  18. package/src/generators/application/files/common/remix.env.d.ts__tmpl__ +2 -0
  19. package/src/generators/application/files/common/tsconfig.json__tmpl__ +18 -0
  20. package/src/generators/application/files/integrated/.gitignore__tmpl__ +4 -0
  21. package/src/generators/application/files/integrated/package.json__tmpl__ +32 -0
  22. package/src/generators/application/lib/normalize-options.d.ts +8 -0
  23. package/src/generators/application/lib/normalize-options.js +20 -0
  24. package/src/generators/application/lib/normalize-options.js.map +1 -0
  25. package/src/generators/application/schema.d.ts +6 -0
  26. package/src/generators/application/schema.json +32 -0
  27. package/src/generators/cypress/cypress.impl.d.ts +2 -0
  28. package/src/generators/cypress/cypress.impl.js +45 -0
  29. package/src/generators/cypress/cypress.impl.js.map +1 -0
  30. package/src/generators/cypress/schema.json +55 -0
  31. package/src/generators/library/library.impl.d.ts +3 -0
  32. package/src/generators/library/library.impl.js +57 -0
  33. package/src/generators/library/library.impl.js.map +1 -0
  34. package/src/generators/library/schema.d.ts +9 -0
  35. package/src/generators/library/schema.json +44 -0
  36. package/src/generators/loader/loader.impl.d.ts +3 -0
  37. package/src/generators/loader/loader.impl.js +41 -0
  38. package/src/generators/loader/loader.impl.js.map +1 -0
  39. package/src/generators/loader/schema.d.ts +4 -0
  40. package/src/generators/loader/schema.json +26 -0
  41. package/src/generators/meta/lib/normalize-options.d.ts +3 -0
  42. package/src/generators/meta/lib/normalize-options.js +15 -0
  43. package/src/generators/meta/lib/normalize-options.js.map +1 -0
  44. package/src/generators/meta/lib/v1.impl.d.ts +3 -0
  45. package/src/generators/meta/lib/v1.impl.js +30 -0
  46. package/src/generators/meta/lib/v1.impl.js.map +1 -0
  47. package/src/generators/meta/lib/v2.impl.d.ts +3 -0
  48. package/src/generators/meta/lib/v2.impl.js +30 -0
  49. package/src/generators/meta/lib/v2.impl.js.map +1 -0
  50. package/src/generators/meta/meta.impl.d.ts +3 -0
  51. package/src/generators/meta/meta.impl.js +22 -0
  52. package/src/generators/meta/meta.impl.js.map +1 -0
  53. package/src/generators/meta/schema.d.ts +5 -0
  54. package/src/generators/meta/schema.json +30 -0
  55. package/src/generators/preset/lib/normalize-options.d.ts +8 -0
  56. package/src/generators/preset/lib/normalize-options.js +18 -0
  57. package/src/generators/preset/lib/normalize-options.js.map +1 -0
  58. package/src/generators/preset/preset.impl.d.ts +3 -0
  59. package/src/generators/preset/preset.impl.js +29 -0
  60. package/src/generators/preset/preset.impl.js.map +1 -0
  61. package/src/generators/preset/schema.d.ts +4 -0
  62. package/src/generators/preset/schema.json +13 -0
  63. package/src/generators/resource-route/resource-route.impl.d.ts +3 -0
  64. package/src/generators/resource-route/resource-route.impl.js +35 -0
  65. package/src/generators/resource-route/resource-route.impl.js.map +1 -0
  66. package/src/generators/resource-route/schema.d.ts +7 -0
  67. package/src/generators/resource-route/schema.json +48 -0
  68. package/src/generators/route/route.impl.d.ts +3 -0
  69. package/src/generators/route/route.impl.js +65 -0
  70. package/src/generators/route/route.impl.js.map +1 -0
  71. package/src/generators/route/schema.d.ts +9 -0
  72. package/src/generators/route/schema.json +59 -0
  73. package/src/generators/setup/schema.json +13 -0
  74. package/src/generators/setup/setup.impl.d.ts +2 -0
  75. package/src/generators/setup/setup.impl.js +34 -0
  76. package/src/generators/setup/setup.impl.js.map +1 -0
  77. package/src/generators/style/schema.d.ts +4 -0
  78. package/src/generators/style/schema.json +33 -0
  79. package/src/generators/style/style.impl.d.ts +3 -0
  80. package/src/generators/style/style.impl.js +53 -0
  81. package/src/generators/style/style.impl.js.map +1 -0
  82. package/src/index.d.ts +0 -0
  83. package/src/index.js +1 -0
  84. package/src/index.js.map +1 -0
  85. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +6 -0
  86. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +45 -0
  87. package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +1 -0
  88. package/src/migrations/update-15-8-6/update-remix-env-d.d.ts +6 -0
  89. package/src/migrations/update-15-8-6/update-remix-env-d.js +27 -0
  90. package/src/migrations/update-15-8-6/update-remix-env-d.js.map +1 -0
  91. package/src/utils/get-default-export-name.d.ts +2 -0
  92. package/src/utils/get-default-export-name.js +10 -0
  93. package/src/utils/get-default-export-name.js.map +1 -0
  94. package/src/utils/get-default-export.d.ts +2 -0
  95. package/src/utils/get-default-export.js +16 -0
  96. package/src/utils/get-default-export.js.map +1 -0
  97. package/src/utils/get-remix-projects.d.ts +2 -0
  98. package/src/utils/get-remix-projects.js +15 -0
  99. package/src/utils/get-remix-projects.js.map +1 -0
  100. package/src/utils/insert-import.d.ts +4 -0
  101. package/src/utils/insert-import.js +55 -0
  102. package/src/utils/insert-import.js.map +1 -0
  103. package/src/utils/insert-statement-after-imports.d.ts +5 -0
  104. package/src/utils/insert-statement-after-imports.js +29 -0
  105. package/src/utils/insert-statement-after-imports.js.map +1 -0
  106. package/src/utils/insert-statement-in-default-function.d.ts +2 -0
  107. package/src/utils/insert-statement-in-default-function.js +24 -0
  108. package/src/utils/insert-statement-in-default-function.js.map +1 -0
  109. package/src/utils/remix-config.d.ts +5 -0
  110. package/src/utils/remix-config.js +22 -0
  111. package/src/utils/remix-config.js.map +1 -0
  112. package/src/utils/remix-route-utils.d.ts +13 -0
  113. package/src/utils/remix-route-utils.js +64 -0
  114. package/src/utils/remix-route-utils.js.map +1 -0
  115. package/src/utils/versions.d.ts +11 -0
  116. package/src/utils/versions.js +24 -0
  117. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function getDefaultExport(tree: Tree, path: string): import("typescript").FunctionDeclaration;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultExport = void 0;
4
+ const typescript_1 = require("typescript");
5
+ function getDefaultExport(tree, path) {
6
+ const contents = tree.read(path, 'utf-8');
7
+ const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
8
+ const functionDeclarations = sourceFile.statements.filter(typescript_1.isFunctionDeclaration);
9
+ return functionDeclarations.find((functionDeclaration) => {
10
+ const isDefault = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.DefaultKeyword);
11
+ const isExport = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.ExportKeyword);
12
+ return isDefault && isExport;
13
+ });
14
+ }
15
+ exports.getDefaultExport = getDefaultExport;
16
+ //# sourceMappingURL=get-default-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-default-export.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/get-default-export.ts"],"names":[],"mappings":";;;AACA,2CAKoB;AAEpB,SAAgB,gBAAgB,CAAC,IAAU,EAAE,IAAY;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,IAAA,6BAAgB,EAAC,IAAI,EAAE,QAAQ,EAAE,yBAAY,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,oBAAoB,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CACvD,kCAAqB,CACtB,CAAC;IAEF,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE;QACvD,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAClD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,uBAAU,CAAC,cAAc,CAChD,CAAC;QAEF,MAAM,QAAQ,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CACjD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,uBAAU,CAAC,aAAa,CAC/C,CAAC;QAEF,OAAO,SAAS,IAAI,QAAQ,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC;AApBD,4CAoBC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function getRemixProjects(tree: Tree): import("@nx/devkit").ProjectConfiguration[];
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemixProjects = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function getRemixProjects(tree) {
6
+ const projects = (0, devkit_1.getProjects)(tree);
7
+ const remixProjects = Array.from(projects.values()).filter((project) => {
8
+ const remixConfigPath = (0, devkit_1.joinPathFragments)(project.root, 'remix.config.js');
9
+ // if the project doesn't have a remix.config.js, it's not a Remix project so we can skip it
10
+ return tree.exists(remixConfigPath);
11
+ });
12
+ return remixProjects;
13
+ }
14
+ exports.getRemixProjects = getRemixProjects;
15
+ //# sourceMappingURL=get-remix-projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-remix-projects.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/get-remix-projects.ts"],"names":[],"mappings":";;;AAAA,uCAAkE;AAElE,SAAgB,gBAAgB,CAAC,IAAU;IACzC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEnC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;QACrE,MAAM,eAAe,GAAG,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QAC3E,4FAA4F;QAC5F,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC;AATD,4CASC"}
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function insertImport(tree: Tree, path: string, name: string, modulePath: string, options?: {
3
+ typeOnly: boolean;
4
+ }): void;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertImport = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const typescript_1 = require("typescript");
6
+ const insert_statement_after_imports_1 = require("./insert-statement-after-imports");
7
+ function insertImport(tree, path, name, modulePath, options = { typeOnly: false }) {
8
+ if (!tree.exists(path))
9
+ throw Error(`Could not insert import ${name} from ${modulePath} in ${path}: path not found`);
10
+ const contents = tree.read(path, 'utf-8');
11
+ const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
12
+ let importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
13
+ if (options.typeOnly) {
14
+ importStatements = importStatements.filter((node) => node.importClause.isTypeOnly);
15
+ }
16
+ else {
17
+ importStatements = importStatements.filter((node) => !node.importClause.isTypeOnly);
18
+ }
19
+ const existingImport = importStatements.find((statement) => (0, typescript_1.isStringLiteral)(statement.moduleSpecifier) &&
20
+ statement.moduleSpecifier
21
+ .getText(sourceFile)
22
+ .replace(/['"`]/g, '')
23
+ .trim() === modulePath &&
24
+ statement.importClause.namedBindings &&
25
+ (0, typescript_1.isNamedImports)(statement.importClause.namedBindings));
26
+ if (!existingImport) {
27
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, path, options.typeOnly
28
+ ? `import type { ${name} } from '${modulePath}';`
29
+ : `import { ${name} } from '${modulePath}';`);
30
+ return;
31
+ }
32
+ const namedImports = existingImport.importClause
33
+ .namedBindings;
34
+ const alreadyImported = namedImports.elements.find((element) => element.name.escapedText === name) !== undefined;
35
+ if (!alreadyImported) {
36
+ const index = namedImports.getEnd() - 1;
37
+ let text;
38
+ if (namedImports.elements.hasTrailingComma) {
39
+ text = `${name},`;
40
+ }
41
+ else {
42
+ text = `,${name}`;
43
+ }
44
+ const newContents = (0, devkit_1.applyChangesToString)(contents, [
45
+ {
46
+ type: devkit_1.ChangeType.Insert,
47
+ index,
48
+ text,
49
+ },
50
+ ]);
51
+ tree.write(path, newContents);
52
+ }
53
+ }
54
+ exports.insertImport = insertImport;
55
+ //# sourceMappingURL=insert-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-import.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/insert-import.ts"],"names":[],"mappings":";;;AAAA,uCAAoE;AACpE,2CAOoB;AACpB,qFAA+E;AAE/E,SAAgB,YAAY,CAC1B,IAAU,EACV,IAAY,EACZ,IAAY,EACZ,UAAkB,EAClB,UAAiC,EAAE,QAAQ,EAAE,KAAK,EAAE;IAEpD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QACpB,MAAM,KAAK,CACT,2BAA2B,IAAI,SAAS,UAAU,OAAO,IAAI,kBAAkB,CAChF,CAAC;IAEJ,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,IAAA,6BAAgB,EAAC,IAAI,EAAE,QAAQ,EAA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AAI,CAAC,eAAe,EAAE;QACpB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAExC,IAAI,IAAY,CAAC;QACjB,IAAI,YAAY,CAAC,QAAQ,CAAC,gBAAgB,EAAE;YAC1C,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC;SACnB;aAAM;YACL,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;SACnB;QAED,MAAM,WAAW,GAAG,IAAA,6BAAoB,EAAC,QAAQ,EAAE;YACjD;gBACE,IAAI,EAAE,mBAAU,CAAC,MAAM;gBACvB,KAAK;gBACL,IAAI;aACL;SACF,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KAC/B;AACH,CAAC;AA9ED,oCA8EC"}
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Insert a statement after the last import statement in a file
4
+ */
5
+ export declare function insertStatementAfterImports(tree: Tree, path: string, statement: string): void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertStatementAfterImports = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const typescript_1 = require("typescript");
6
+ /**
7
+ * Insert a statement after the last import statement in a file
8
+ */
9
+ function insertStatementAfterImports(tree, path, statement) {
10
+ const contents = tree.read(path, 'utf-8');
11
+ const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
12
+ const importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
13
+ const index = importStatements.length > 0
14
+ ? importStatements[importStatements.length - 1].getEnd()
15
+ : 0;
16
+ if (importStatements.length > 0) {
17
+ statement = `\n${statement}`;
18
+ }
19
+ const newContents = (0, devkit_1.applyChangesToString)(contents, [
20
+ {
21
+ type: devkit_1.ChangeType.Insert,
22
+ index,
23
+ text: statement,
24
+ },
25
+ ]);
26
+ tree.write(path, newContents);
27
+ }
28
+ exports.insertStatementAfterImports = insertStatementAfterImports;
29
+ //# sourceMappingURL=insert-statement-after-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-statement-after-imports.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/insert-statement-after-imports.ts"],"names":[],"mappings":";;;AAAA,uCAAoE;AACpE,2CAIoB;AAEpB;;GAEG;AACH,SAAgB,2BAA2B,CACzC,IAAU,EACV,IAAY,EACZ,SAAiB;IAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,IAAA,6BAAgB,EAAC,IAAI,EAAE,QAAQ,EAAE,yBAAY,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,gCAAmB,CAAC,CAAC;IAC3E,MAAM,KAAK,GACT,gBAAgB,CAAC,MAAM,GAAG,CAAC;QACzB,CAAC,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE;QACxD,CAAC,CAAC,CAAC,CAAC;IAER,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/B,SAAS,GAAG,KAAK,SAAS,EAAE,CAAC;KAC9B;IAED,MAAM,WAAW,GAAG,IAAA,6BAAoB,EAAC,QAAQ,EAAE;QACjD;YACE,IAAI,EAAE,mBAAU,CAAC,MAAM;YACvB,KAAK;YACL,IAAI,EAAE,SAAS;SAChB;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAChC,CAAC;AA5BD,kEA4BC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function insertStatementInDefaultFunction(tree: Tree, path: string, statement: any): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.insertStatementInDefaultFunction = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const get_default_export_1 = require("./get-default-export");
6
+ function insertStatementInDefaultFunction(tree, path, statement) {
7
+ const defaultExport = (0, get_default_export_1.getDefaultExport)(tree, path);
8
+ if (!defaultExport) {
9
+ throw Error('No default export found!');
10
+ }
11
+ const index = defaultExport.body.statements.length > 0
12
+ ? defaultExport.body.statements[0].pos
13
+ : 0;
14
+ const newContents = (0, devkit_1.applyChangesToString)(tree.read(path, 'utf-8'), [
15
+ {
16
+ type: devkit_1.ChangeType.Insert,
17
+ index,
18
+ text: statement,
19
+ },
20
+ ]);
21
+ tree.write(path, newContents);
22
+ }
23
+ exports.insertStatementInDefaultFunction = insertStatementInDefaultFunction;
24
+ //# sourceMappingURL=insert-statement-in-default-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert-statement-in-default-function.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/insert-statement-in-default-function.ts"],"names":[],"mappings":";;;AAAA,uCAAoE;AACpE,6DAAwD;AAExD,SAAgB,gCAAgC,CAC9C,IAAU,EACV,IAAY,EACZ,SAAS;IAET,MAAM,aAAa,GAAG,IAAA,qCAAgB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;KACzC;IAED,MAAM,KAAK,GACT,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QACtC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG;QACtC,CAAC,CAAC,CAAC,CAAC;IAER,MAAM,WAAW,GAAG,IAAA,6BAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;QACjE;YACE,IAAI,EAAE,mBAAU,CAAC,MAAM;YACvB,KAAK;YACL,IAAI,EAAE,SAAS;SAChB;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAChC,CAAC;AAzBD,4EAyBC"}
@@ -0,0 +1,5 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { AppConfig } from '@remix-run/dev';
3
+ export declare function getRemixConfigPath(tree: Tree, projectName: string): string;
4
+ export declare function getRemixConfigValues(tree: Tree, projectName: string): AppConfig;
5
+ export declare function getRemixFutureFlags(tree: Tree, projectName: string): AppConfig['future'];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRemixFutureFlags = exports.getRemixConfigValues = exports.getRemixConfigPath = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function getRemixConfigPath(tree, projectName) {
6
+ const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
7
+ if (!project)
8
+ throw new Error(`Project does not exist: ${projectName}`);
9
+ return (0, devkit_1.joinPathFragments)(project.root, 'remix.config.js');
10
+ }
11
+ exports.getRemixConfigPath = getRemixConfigPath;
12
+ function getRemixConfigValues(tree, projectName) {
13
+ const remixConfigPath = getRemixConfigPath(tree, projectName);
14
+ return eval(tree.read(remixConfigPath, 'utf-8'));
15
+ }
16
+ exports.getRemixConfigValues = getRemixConfigValues;
17
+ function getRemixFutureFlags(tree, projectName) {
18
+ const configValues = getRemixConfigValues(tree, projectName);
19
+ return configValues === null || configValues === void 0 ? void 0 : configValues.future;
20
+ }
21
+ exports.getRemixFutureFlags = getRemixFutureFlags;
22
+ //# sourceMappingURL=remix-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remix-config.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/remix-config.ts"],"names":[],"mappings":";;;AAAA,uCAA+E;AAG/E,SAAgB,kBAAkB,CAAC,IAAU,EAAE,WAAmB;IAChE,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAExE,OAAO,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAC5D,CAAC;AALD,gDAKC;AAED,SAAgB,oBAAoB,CAAC,IAAU,EAAE,WAAmB;IAClE,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAE9D,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAc,CAAC;AAChE,CAAC;AAJD,oDAIC;AAED,SAAgB,mBAAmB,CACjC,IAAU,EACV,WAAmB;IAEnB,MAAM,YAAY,GAAG,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAE7D,OAAO,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,CAAC;AAC9B,CAAC;AAPD,kDAOC"}
@@ -0,0 +1,13 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ *
4
+ * @param tree
5
+ * @param path to the route which could be fully specified or just "foo/bar"
6
+ * @param projectName the name of the project where the route should be added
7
+ * @param fileExtension the file extension to add to resolved route file
8
+ * @returns file path to the route
9
+ */
10
+ export declare function resolveRemixRouteFile(tree: Tree, path: string, projectName: string, fileExtension?: string): string;
11
+ export declare function normalizeRoutePath(path: string): string;
12
+ export declare function checkRoutePathForErrors(path: string): RegExpMatchArray;
13
+ export declare function resolveRemixAppDirectory(tree: Tree, projectName: string): string;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRemixAppDirectory = exports.checkRoutePathForErrors = exports.normalizeRoutePath = exports.resolveRemixRouteFile = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const remix_config_1 = require("./remix-config");
6
+ /**
7
+ *
8
+ * @param tree
9
+ * @param path to the route which could be fully specified or just "foo/bar"
10
+ * @param projectName the name of the project where the route should be added
11
+ * @param fileExtension the file extension to add to resolved route file
12
+ * @returns file path to the route
13
+ */
14
+ function resolveRemixRouteFile(tree, path, projectName, fileExtension) {
15
+ const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
16
+ if (!project)
17
+ throw new Error(`Project does not exist: ${projectName}`);
18
+ const { name: routePath } = (0, devkit_1.names)(path.replace(/^\//, '').replace(/\/$/, ''));
19
+ const normalizedRoutePath = normalizeRoutePath(routePath);
20
+ // if no file extension specified, let's try to find it
21
+ if (!fileExtension) {
22
+ // see if the path already has it
23
+ const extensionMatch = path.match(/(\.[^.]+)$/);
24
+ if (extensionMatch) {
25
+ fileExtension = extensionMatch[0];
26
+ }
27
+ else {
28
+ // look for either .ts or .tsx to exist in tree
29
+ if (tree.exists(`${normalizedRoutePath}.ts`)) {
30
+ fileExtension = '.ts';
31
+ }
32
+ else {
33
+ // default to .tsx if nothing else found
34
+ fileExtension = '.tsx';
35
+ }
36
+ }
37
+ }
38
+ const fileName = normalizedRoutePath.endsWith(fileExtension)
39
+ ? normalizedRoutePath
40
+ : `${normalizedRoutePath}${fileExtension}`;
41
+ return (0, devkit_1.joinPathFragments)(resolveRemixAppDirectory(tree, projectName), 'routes', fileName);
42
+ }
43
+ exports.resolveRemixRouteFile = resolveRemixRouteFile;
44
+ function normalizeRoutePath(path) {
45
+ return path.indexOf('/routes/') > -1
46
+ ? path.substring(path.indexOf('/routes/') + 8)
47
+ : path;
48
+ }
49
+ exports.normalizeRoutePath = normalizeRoutePath;
50
+ function checkRoutePathForErrors(path) {
51
+ return (path.match(/\w\.\.\w/) || // route.$withParams.tsx => route..tsx
52
+ path.match(/\w\/\/\w/) || // route/$withParams/index.tsx => route//index.tsx
53
+ path.match(/\w\/\.\w/) // route/$withParams.tsx => route/.tsx
54
+ );
55
+ }
56
+ exports.checkRoutePathForErrors = checkRoutePathForErrors;
57
+ function resolveRemixAppDirectory(tree, projectName) {
58
+ var _a;
59
+ const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
60
+ const remixConfig = (0, remix_config_1.getRemixConfigValues)(tree, projectName);
61
+ return (0, devkit_1.joinPathFragments)(project.root, (_a = remixConfig.appDirectory) !== null && _a !== void 0 ? _a : 'app');
62
+ }
63
+ exports.resolveRemixAppDirectory = resolveRemixAppDirectory;
64
+ //# sourceMappingURL=remix-route-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remix-route-utils.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/remix-route-utils.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,iDAAsD;AAEtD;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,IAAU,EACV,IAAY,EACZ,WAAmB,EACnB,aAAsB;IAEtB,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IACxE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAA,cAAK,EAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9E,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAE1D,uDAAuD;IACvD,IAAI,CAAC,aAAa,EAAE;QAClB,iCAAiC;QACjC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEhD,IAAI,cAAc,EAAE;YAClB,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;SACnC;aAAM;YACL,+CAA+C;YAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,mBAAmB,KAAK,CAAC,EAAE;gBAC5C,aAAa,GAAG,KAAK,CAAC;aACvB;iBAAM;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declare const remixVersion = "^1.15.0";
3
+ export declare const isbotVersion = "^3.6.5";
4
+ export declare const reactVersion = "^18.2.0";
5
+ export declare const reactDomVersion = "^18.2.0";
6
+ export declare const typesReactVersion = "^18.0.25";
7
+ export declare const typesReactDomVersion = "^18.0.8";
8
+ export declare const eslintVersion = "^8.27.0";
9
+ export declare const typescriptVersion = "^4.8.4";
10
+ export declare function getRemixVersion(tree: Tree): string;
11
+ export declare function getPackageVersion(tree: Tree, packageName: string): any;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackageVersion = exports.getRemixVersion = exports.typescriptVersion = exports.eslintVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactDomVersion = exports.reactVersion = exports.isbotVersion = exports.remixVersion = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ exports.remixVersion = '^1.15.0';
6
+ exports.isbotVersion = '^3.6.5';
7
+ exports.reactVersion = '^18.2.0';
8
+ exports.reactDomVersion = '^18.2.0';
9
+ exports.typesReactVersion = '^18.0.25';
10
+ exports.typesReactDomVersion = '^18.0.8';
11
+ exports.eslintVersion = '^8.27.0';
12
+ exports.typescriptVersion = '^4.8.4';
13
+ function getRemixVersion(tree) {
14
+ var _a;
15
+ return (_a = getPackageVersion(tree, '@remix-run/dev')) !== null && _a !== void 0 ? _a : exports.remixVersion;
16
+ }
17
+ exports.getRemixVersion = getRemixVersion;
18
+ function getPackageVersion(tree, packageName) {
19
+ var _a, _b, _c, _d;
20
+ const packageJsonContents = (0, devkit_1.readJson)(tree, 'package.json');
21
+ return ((_d = (_b = (_a = packageJsonContents === null || packageJsonContents === void 0 ? void 0 : packageJsonContents['devDependencies']) === null || _a === void 0 ? void 0 : _a[packageName]) !== null && _b !== void 0 ? _b : (_c = packageJsonContents === null || packageJsonContents === void 0 ? void 0 : packageJsonContents['dependencies']) === null || _c === void 0 ? void 0 : _c[packageName]) !== null && _d !== void 0 ? _d : null);
22
+ }
23
+ exports.getPackageVersion = getPackageVersion;
24
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/remix/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA,uCAA4C;AAE/B,QAAA,YAAY,GAAG,SAAS,CAAC;AACzB,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,YAAY,GAAG,SAAS,CAAC;AACzB,QAAA,eAAe,GAAG,SAAS,CAAC;AAC5B,QAAA,iBAAiB,GAAG,UAAU,CAAC;AAC/B,QAAA,oBAAoB,GAAG,SAAS,CAAC;AACjC,QAAA,aAAa,GAAG,SAAS,CAAC;AAC1B,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,SAAgB,eAAe,CAAC,IAAU;;IACxC,OAAO,MAAA,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,CAAC,mCAAI,oBAAY,CAAC;AACnE,CAAC;AAFD,0CAEC;AAED,SAAgB,iBAAiB,CAAC,IAAU,EAAE,WAAmB;;IAC/D,MAAM,mBAAmB,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CACL,MAAA,MAAA,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,iBAAiB,CAAC,0CAAG,WAAW,CAAC,mCACvD,MAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,cAAc,CAAC,0CAAG,WAAW,CAAC,mCACpD,IAAI,CACL,CAAC;AACJ,CAAC;AAPD,8CAOC"}