one 1.2.16 → 1.2.18

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 (148) hide show
  1. package/dist/cjs/cli/generateRoutes.cjs +20 -5
  2. package/dist/cjs/cli/generateRoutes.js +18 -3
  3. package/dist/cjs/cli/generateRoutes.js.map +1 -1
  4. package/dist/cjs/cli/generateRoutes.native.js +30 -5
  5. package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
  6. package/dist/cjs/cli.cjs +4 -0
  7. package/dist/cjs/cli.js +4 -0
  8. package/dist/cjs/cli.js.map +1 -1
  9. package/dist/cjs/cli.native.js +4 -0
  10. package/dist/cjs/cli.native.js.map +1 -1
  11. package/dist/cjs/getDevServer.cjs +29 -0
  12. package/dist/cjs/getDevServer.js +24 -0
  13. package/dist/cjs/getDevServer.js.map +6 -0
  14. package/dist/cjs/getDevServer.native.js +40 -0
  15. package/dist/cjs/getDevServer.native.js.map +1 -0
  16. package/dist/cjs/getURL.native.js +8 -18
  17. package/dist/cjs/getURL.native.js.map +1 -1
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/index.native.js.map +1 -1
  20. package/dist/cjs/router/createRoute.cjs +12 -1
  21. package/dist/cjs/router/createRoute.js +12 -1
  22. package/dist/cjs/router/createRoute.js.map +1 -1
  23. package/dist/cjs/router/createRoute.native.js +13 -2
  24. package/dist/cjs/router/createRoute.native.js.map +1 -1
  25. package/dist/cjs/typed-routes/generateRouteTypes.cjs +14 -3
  26. package/dist/cjs/typed-routes/generateRouteTypes.js +12 -3
  27. package/dist/cjs/typed-routes/generateRouteTypes.js.map +1 -1
  28. package/dist/cjs/typed-routes/generateRouteTypes.native.js +29 -3
  29. package/dist/cjs/typed-routes/generateRouteTypes.native.js.map +1 -1
  30. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.cjs +39 -2
  31. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js +38 -2
  32. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
  33. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js +40 -2
  34. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
  35. package/dist/cjs/typed-routes/injectRouteHelpers.cjs +136 -0
  36. package/dist/cjs/typed-routes/injectRouteHelpers.js +104 -0
  37. package/dist/cjs/typed-routes/injectRouteHelpers.js.map +6 -0
  38. package/dist/cjs/typed-routes/injectRouteHelpers.native.js +146 -0
  39. package/dist/cjs/typed-routes/injectRouteHelpers.native.js.map +1 -0
  40. package/dist/cjs/vite/loadConfig.cjs +18 -12
  41. package/dist/cjs/vite/loadConfig.js +20 -13
  42. package/dist/cjs/vite/loadConfig.js.map +1 -1
  43. package/dist/cjs/vite/loadConfig.native.js +18 -11
  44. package/dist/cjs/vite/loadConfig.native.js.map +1 -1
  45. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +3 -2
  46. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +13 -3
  47. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  48. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +9 -6
  49. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  50. package/dist/esm/cli/generateRoutes.js +19 -2
  51. package/dist/esm/cli/generateRoutes.js.map +1 -1
  52. package/dist/esm/cli/generateRoutes.mjs +19 -4
  53. package/dist/esm/cli/generateRoutes.mjs.map +1 -1
  54. package/dist/esm/cli/generateRoutes.native.js +29 -4
  55. package/dist/esm/cli/generateRoutes.native.js.map +1 -1
  56. package/dist/esm/cli.js +4 -0
  57. package/dist/esm/cli.js.map +1 -1
  58. package/dist/esm/cli.mjs +4 -0
  59. package/dist/esm/cli.mjs.map +1 -1
  60. package/dist/esm/cli.native.js +4 -0
  61. package/dist/esm/cli.native.js.map +1 -1
  62. package/dist/esm/getDevServer.js +8 -0
  63. package/dist/esm/getDevServer.js.map +6 -0
  64. package/dist/esm/getDevServer.mjs +6 -0
  65. package/dist/esm/getDevServer.mjs.map +1 -0
  66. package/dist/esm/getDevServer.native.js +3 -0
  67. package/dist/esm/getDevServer.native.js.map +1 -0
  68. package/dist/esm/getURL.native.js +3 -2
  69. package/dist/esm/getURL.native.js.map +1 -1
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/index.mjs.map +1 -1
  72. package/dist/esm/index.native.js.map +1 -1
  73. package/dist/esm/router/createRoute.js +12 -1
  74. package/dist/esm/router/createRoute.js.map +1 -1
  75. package/dist/esm/router/createRoute.mjs +12 -1
  76. package/dist/esm/router/createRoute.mjs.map +1 -1
  77. package/dist/esm/router/createRoute.native.js +13 -2
  78. package/dist/esm/router/createRoute.native.js.map +1 -1
  79. package/dist/esm/typed-routes/generateRouteTypes.js +14 -3
  80. package/dist/esm/typed-routes/generateRouteTypes.js.map +1 -1
  81. package/dist/esm/typed-routes/generateRouteTypes.mjs +14 -3
  82. package/dist/esm/typed-routes/generateRouteTypes.mjs.map +1 -1
  83. package/dist/esm/typed-routes/generateRouteTypes.native.js +29 -3
  84. package/dist/esm/typed-routes/generateRouteTypes.native.js.map +1 -1
  85. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js +38 -2
  86. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
  87. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.mjs +39 -2
  88. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.mjs.map +1 -1
  89. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js +40 -2
  90. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
  91. package/dist/esm/typed-routes/injectRouteHelpers.js +89 -0
  92. package/dist/esm/typed-routes/injectRouteHelpers.js.map +6 -0
  93. package/dist/esm/typed-routes/injectRouteHelpers.mjs +113 -0
  94. package/dist/esm/typed-routes/injectRouteHelpers.mjs.map +1 -0
  95. package/dist/esm/typed-routes/injectRouteHelpers.native.js +120 -0
  96. package/dist/esm/typed-routes/injectRouteHelpers.native.js.map +1 -0
  97. package/dist/esm/vite/loadConfig.js +20 -13
  98. package/dist/esm/vite/loadConfig.js.map +1 -1
  99. package/dist/esm/vite/loadConfig.mjs +18 -12
  100. package/dist/esm/vite/loadConfig.mjs.map +1 -1
  101. package/dist/esm/vite/loadConfig.native.js +18 -11
  102. package/dist/esm/vite/loadConfig.native.js.map +1 -1
  103. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +13 -3
  104. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  105. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +3 -2
  106. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
  107. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +9 -6
  108. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  109. package/package.json +10 -10
  110. package/src/cli/generateRoutes.ts +52 -4
  111. package/src/cli.ts +5 -0
  112. package/src/getDevServer.native.ts +5 -0
  113. package/src/getDevServer.ts +5 -0
  114. package/src/getURL.native.ts +10 -5
  115. package/src/index.ts +13 -0
  116. package/src/interfaces/router.ts +19 -0
  117. package/src/router/createRoute.ts +16 -3
  118. package/src/typed-routes/generateRouteTypes.ts +46 -2
  119. package/src/typed-routes/getTypedRoutesDeclarationFile.ts +70 -0
  120. package/src/typed-routes/injectRouteHelpers.ts +186 -0
  121. package/src/vite/loadConfig.ts +29 -17
  122. package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +14 -3
  123. package/src/vite/types.ts +26 -0
  124. package/types/cli/generateRoutes.d.ts +1 -0
  125. package/types/cli/generateRoutes.d.ts.map +1 -1
  126. package/types/getDevServer.d.ts +5 -0
  127. package/types/getDevServer.d.ts.map +1 -0
  128. package/types/getDevServer.native.d.ts +2 -0
  129. package/types/getDevServer.native.d.ts.map +1 -0
  130. package/types/getURL.native.d.ts.map +1 -1
  131. package/types/index.d.ts +13 -3
  132. package/types/index.d.ts.map +1 -1
  133. package/types/interfaces/router.d.ts +16 -0
  134. package/types/interfaces/router.d.ts.map +1 -1
  135. package/types/router/createRoute.d.ts +28 -13
  136. package/types/router/createRoute.d.ts.map +1 -1
  137. package/types/typed-routes/generateRouteTypes.d.ts +1 -1
  138. package/types/typed-routes/generateRouteTypes.d.ts.map +1 -1
  139. package/types/typed-routes/getTypedRoutesDeclarationFile.d.ts.map +1 -1
  140. package/types/typed-routes/injectRouteHelpers.d.ts +12 -0
  141. package/types/typed-routes/injectRouteHelpers.d.ts.map +1 -0
  142. package/types/utils/redirect.d.ts +1 -3
  143. package/types/utils/redirect.d.ts.map +1 -1
  144. package/types/vite/loadConfig.d.ts +1 -1
  145. package/types/vite/loadConfig.d.ts.map +1 -1
  146. package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
  147. package/types/vite/types.d.ts +25 -0
  148. package/types/vite/types.d.ts.map +1 -1
@@ -42,8 +42,10 @@ var import_promises = require("fs/promises"),
42
42
  import_micromatch = __toESM(require("micromatch"), 1),
43
43
  import_useViteRoutes = require("../router/useViteRoutes.native.js"),
44
44
  import_globDir = require("../utils/globDir.native.js"),
45
- import_getTypedRoutesDeclarationFile = require("./getTypedRoutesDeclarationFile.native.js");
46
- async function generateRouteTypes(outFile, routerRoot, ignoredRouteFiles) {
45
+ import_getTypedRoutesDeclarationFile = require("./getTypedRoutesDeclarationFile.native.js"),
46
+ import_injectRouteHelpers = require("./injectRouteHelpers.native.js"),
47
+ import_matchers = require("../router/matchers.native.js");
48
+ async function generateRouteTypes(outFile, routerRoot, ignoredRouteFiles, typedRoutesMode) {
47
49
  var routePaths = (0, import_globDir.globDir)(routerRoot);
48
50
  ignoredRouteFiles && ignoredRouteFiles.length > 0 && (routePaths = import_micromatch.default.not(routePaths, ignoredRouteFiles, {
49
51
  // The path starts with './', such as './foo/bar/baz.test.tsx', and ignoredRouteFiles is like ['**/*.test.*'], so we need matchBase here.
@@ -55,6 +57,30 @@ async function generateRouteTypes(outFile, routerRoot, ignoredRouteFiles) {
55
57
  context = (0, import_useViteRoutes.globbedRoutesToRouteContext)(routes, routerRoot),
56
58
  declarations = (0, import_getTypedRoutesDeclarationFile.getTypedRoutesDeclarationFile)(context),
57
59
  outDir = (0, import_path.dirname)(outFile);
58
- await import_fs_extra.default.ensureDir(outDir), await (0, import_promises.writeFile)(outFile, declarations);
60
+ if (await import_fs_extra.default.ensureDir(outDir), await (0, import_promises.writeFile)(outFile, declarations), typedRoutesMode) {
61
+ var mode = typedRoutesMode === "type" ? "type" : "runtime",
62
+ _iteratorNormalCompletion = !0,
63
+ _didIteratorError = !1,
64
+ _iteratorError = void 0;
65
+ try {
66
+ for (var _iterator = routePaths[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
67
+ var routePath = _step.value;
68
+ if (!(routePath.includes("_layout") || routePath.includes("+api") || routePath.startsWith("_") || routePath.endsWith(".d.ts"))) {
69
+ var fullPath = (0, import_path.join)(process.cwd(), routerRoot, routePath),
70
+ routeName = routePath.replace(/^\.\//, "").replace(/\+[^/]*$/, "").replace(/\/index$/, "").replace(/index$/, ""),
71
+ cleanRouteName = (0, import_matchers.removeSupportedExtensions)(routeName).replace(/\/?index$/, "");
72
+ cleanRouteName.startsWith("/") || (cleanRouteName = "/" + cleanRouteName), cleanRouteName.includes("[") && (await (0, import_injectRouteHelpers.injectRouteHelpers)(fullPath, cleanRouteName, mode));
73
+ }
74
+ }
75
+ } catch (err) {
76
+ _didIteratorError = !0, _iteratorError = err;
77
+ } finally {
78
+ try {
79
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
80
+ } finally {
81
+ if (_didIteratorError) throw _iteratorError;
82
+ }
83
+ }
84
+ }
59
85
  }
60
86
  //# sourceMappingURL=generateRouteTypes.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","generateRouteTypes_exports","__export","generateRouteTypes","module","exports","import_promises","require","import_path","import_fs_extra","__toESM","import_micromatch","import_useViteRoutes","import_globDir","import_getTypedRoutesDeclarationFile","outFile","routerRoot","ignoredRouteFiles","routePaths","globDir","length","default","not","matchBase","routes","reduce","acc","cur"],"sources":["../../../src/typed-routes/generateRouteTypes.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA0B,CAAAK,0BAC1B;AAOA,IAAAK,eAAsB,GAAAC,OAAA,cAEpB;EAAAC,WACA,GAAAD,OAAA,OACA;EAAAE,eAAA,GAAAC,OAAA,CAAAH,OAAA;EAAAI,iBAAA,GAAAD,OAAA,CAAAH,OAAA;EAAAK,oBAAA,GAAAL,OAAA;EAAAM,cAAA,GAAAN,OAAA;EAAAO,oCAAA,GAAAP,OAAA;AACA,eAAIJ,kBAAaA,CAAAY,OAAA,EAAAC,UAAQ,EAAAC,iBAAU;EAC/B,IAAAC,UAAA,OAAqBL,cAAA,CAAAM,OAAkB,EAAAH,UACzC;EAA2DC,iBAAA,IAAAA,iBAAA,CAAAG,MAAA,SAAAF,UAAA,GAAAP,iBAAA,CAAAU,OAAA,CAAAC,GAAA,CAAAJ,UAAA,EAAAD,iBAAA;IAEzD;IACDM,SAAA;EAEH;EAOA,IAAAC,MAAM,GAAAN,UAAA,CAAAO,MAAQ,WAAUC,GAAA,EAAAC,GAAM,EAC9B;MACF,OAAAD,GAAA,CAAAC,GAAA,QAAAD,GAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","generateRouteTypes_exports","__export","generateRouteTypes","module","exports","import_promises","require","import_path","import_fs_extra","__toESM","import_micromatch","import_useViteRoutes","import_globDir","import_getTypedRoutesDeclarationFile","import_injectRouteHelpers","import_matchers","outFile","routerRoot","ignoredRouteFiles","typedRoutesMode","routePaths","globDir","length","default","not","matchBase","routes","reduce","acc","cur","context","globbedRoutesToRouteContext","declarations","getTypedRoutesDeclarationFile","outDir","dirname","ensureDir","writeFile","mode","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","routePath","includes","startsWith","endsWith","fullPath","join","process","cwd","routeName","replace","cleanRouteName","removeSupportedExtensions","injectRouteHelpers"],"sources":["../../../src/typed-routes/generateRouteTypes.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA0B,CAAAK,0BAC1B;AAUA,IAAAK,eAAsB,GAAAC,OAAA,cAEpB;EAAAC,WACA,GAAAD,OAAA,OACA;EAAAE,eACA,GAAAC,OAAA,CAAAH,OAAA;EAAAI,iBAAA,GAAAD,OAAA,CAAAH,OAAA;EAAAK,oBAAA,GAAAL,OAAA;EAAAM,cAAA,GAAAN,OAAA;EAAAO,oCAAA,GAAAP,OAAA;EAAAQ,yBAAA,GAAAR,OAAA;EAAAS,eAAA,GAAAT,OAAA;AACA,eAAIJ,kBAAaA,CAAAc,OAAA,EAAAC,UAAQ,EAAAC,iBAAU,EAAAC,eAAA;EAC/B,IAAAC,UAAA,OAAqBR,cAAA,CAAAS,OAAkB,EAAAJ,UACzC;EAA2DC,iBAAA,IAAAA,i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A,EAAAH,SAAA,EAAAC,OAAA;UACFC,cAAA,CAAAR,UAAA,UAAAQ,cAAA,SAAAA,cAAA,GAAAA,cAAA,CAAAT,QAAA,oBAAAnC,yBAAA,CAAA8C,kBAAA,EAAAR,QAAA,EAAAM,cAAA,EAAApB,IAAA","ignoreList":[]}
@@ -31,13 +31,15 @@ function getTypedRoutesDeclarationFile(ctx) {
31
31
  const staticRoutes = /* @__PURE__ */new Set(),
32
32
  dynamicRoutes = /* @__PURE__ */new Set(),
33
33
  dynamicRouteContextKeys = /* @__PURE__ */new Set();
34
- return walkRouteNode((0, import_getRoutes.getRoutes)(ctx, {
34
+ walkRouteNode((0, import_getRoutes.getRoutes)(ctx, {
35
35
  platformRoutes: !1,
36
36
  // We don't need to generate platform specific routes
37
37
  ignoreEntryPoints: !0,
38
38
  ignoreRequireErrors: !0
39
39
  // importMode: 'async',
40
- }), "", staticRoutes, dynamicRoutes, dynamicRouteContextKeys), `// deno-lint-ignore-file
40
+ }), "", staticRoutes, dynamicRoutes, dynamicRouteContextKeys);
41
+ const hasRoutes = dynamicRouteContextKeys.size > 0;
42
+ return `// deno-lint-ignore-file
41
43
  /* eslint-disable */
42
44
  // biome-ignore: needed import
43
45
  import type { OneRouter } from 'one'
@@ -49,11 +51,46 @@ declare module 'one' {
49
51
  DynamicRoutes: ${setToUnionType(dynamicRoutes)}
50
52
  DynamicRouteTemplate: ${setToUnionType(dynamicRouteContextKeys)}
51
53
  IsTyped: true
54
+ ${hasRoutes ? `RouteTypes: ${generateRouteTypesMap(dynamicRouteContextKeys)}` : ""}
52
55
  }
53
56
  }
54
57
  }
58
+ ${hasRoutes ? `
59
+ /**
60
+ * Helper type for route information
61
+ */
62
+ type RouteInfo<Params = Record<string, never>> = {
63
+ Params: Params
64
+ LoaderProps: { path: string; params: Params; request?: Request }
65
+ }` : ""}
55
66
  `.trim();
56
67
  }
68
+ function generateRouteTypesMap(dynamicRouteContextKeys) {
69
+ return dynamicRouteContextKeys.size === 0 ? "{}" : `{
70
+ ${[...dynamicRouteContextKeys].sort().map(routePath => {
71
+ const params = extractParams(routePath),
72
+ paramsType = params.length === 0 ? "{}" : generateInlineParamsType(params);
73
+ return ` '${routePath}': RouteInfo<${paramsType}>`;
74
+ }).join(`
75
+ `)}
76
+ }`;
77
+ }
78
+ function extractParams(routePath) {
79
+ const params = [],
80
+ paramRegex = /\[(\.\.\.)?([\w]+)\]/g;
81
+ let match;
82
+ for (; (match = paramRegex.exec(routePath)) !== null;) params.push({
83
+ name: match[2],
84
+ isCatchAll: match[1] === "..."
85
+ });
86
+ return params;
87
+ }
88
+ function generateInlineParamsType(params) {
89
+ return `{ ${params.map(p => {
90
+ const type = p.isCatchAll ? "string[]" : "string";
91
+ return `${p.name}: ${type}`;
92
+ }).join("; ")} }`;
93
+ }
57
94
  function walkRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys) {
58
95
  if (routeNode) {
59
96
  addRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys), parentRoutePath = `${(0, import_matchers.removeSupportedExtensions)(`${parentRoutePath}/${routeNode.route}`).replace(/\/?index$/, "")}`;
@@ -21,7 +21,7 @@ var import_getRoutes = require("../router/getRoutes"), import_matchers = require
21
21
  const CATCH_ALL = /\[\.\.\..+?\]/g, SLUG = /\[.+?\]/g;
22
22
  function getTypedRoutesDeclarationFile(ctx) {
23
23
  const staticRoutes = /* @__PURE__ */ new Set(), dynamicRoutes = /* @__PURE__ */ new Set(), dynamicRouteContextKeys = /* @__PURE__ */ new Set();
24
- return walkRouteNode(
24
+ walkRouteNode(
25
25
  (0, import_getRoutes.getRoutes)(ctx, {
26
26
  platformRoutes: !1,
27
27
  // We don't need to generate platform specific routes
@@ -33,7 +33,9 @@ function getTypedRoutesDeclarationFile(ctx) {
33
33
  staticRoutes,
34
34
  dynamicRoutes,
35
35
  dynamicRouteContextKeys
36
- ), `// deno-lint-ignore-file
36
+ );
37
+ const hasRoutes = dynamicRouteContextKeys.size > 0;
38
+ return `// deno-lint-ignore-file
37
39
  /* eslint-disable */
38
40
  // biome-ignore: needed import
39
41
  import type { OneRouter } from 'one'
@@ -45,11 +47,45 @@ declare module 'one' {
45
47
  DynamicRoutes: ${setToUnionType(dynamicRoutes)}
46
48
  DynamicRouteTemplate: ${setToUnionType(dynamicRouteContextKeys)}
47
49
  IsTyped: true
50
+ ${hasRoutes ? `RouteTypes: ${generateRouteTypesMap(dynamicRouteContextKeys)}` : ""}
48
51
  }
49
52
  }
50
53
  }
54
+ ${hasRoutes ? `
55
+ /**
56
+ * Helper type for route information
57
+ */
58
+ type RouteInfo<Params = Record<string, never>> = {
59
+ Params: Params
60
+ LoaderProps: { path: string; params: Params; request?: Request }
61
+ }` : ""}
51
62
  `.trim();
52
63
  }
64
+ function generateRouteTypesMap(dynamicRouteContextKeys) {
65
+ return dynamicRouteContextKeys.size === 0 ? "{}" : `{
66
+ ${[...dynamicRouteContextKeys].sort().map((routePath) => {
67
+ const params = extractParams(routePath), paramsType = params.length === 0 ? "{}" : generateInlineParamsType(params);
68
+ return ` '${routePath}': RouteInfo<${paramsType}>`;
69
+ }).join(`
70
+ `)}
71
+ }`;
72
+ }
73
+ function extractParams(routePath) {
74
+ const params = [], paramRegex = /\[(\.\.\.)?([\w]+)\]/g;
75
+ let match;
76
+ for (; (match = paramRegex.exec(routePath)) !== null; )
77
+ params.push({
78
+ name: match[2],
79
+ isCatchAll: match[1] === "..."
80
+ });
81
+ return params;
82
+ }
83
+ function generateInlineParamsType(params) {
84
+ return `{ ${params.map((p) => {
85
+ const type = p.isCatchAll ? "string[]" : "string";
86
+ return `${p.name}: ${type}`;
87
+ }).join("; ")} }`;
88
+ }
53
89
  function walkRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys) {
54
90
  if (routeNode) {
55
91
  addRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys), parentRoutePath = `${(0, import_matchers.removeSupportedExtensions)(`${parentRoutePath}/${routeNode.route}`).replace(/\/?index$/, "")}`;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/typed-routes/getTypedRoutesDeclarationFile.ts"],
4
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B,gCAC1B,kBAAwD;AAKxD,MAAM,YAAY,kBAEZ,OAAO;AAEN,SAAS,8BAA8B,KAAuB;AACnE,QAAM,eAAe,oBAAI,IAAY,GAC/B,gBAAgB,oBAAI,IAAY,GAChC,0BAA0B,oBAAI,IAAY;AAEhD;AAAA,QACE,4BAAU,KAAK;AAAA,MACb,gBAAgB;AAAA;AAAA,MAChB,mBAAmB;AAAA,MACnB,qBAAqB;AAAA;AAAA,IAEvB,CAAC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAEO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAQa,eAAe,YAAY,CAAC;AAAA,uBAC3B,eAAe,aAAa,CAAC;AAAA,8BACtB,eAAe,uBAAuB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnE,KAAK;AACP;AAKA,SAAS,cACP,WACA,iBACA,cACA,eACA,yBACA;AACA,MAAK,WAEL;AAAA,iBAAa,WAAW,iBAAiB,cAAc,eAAe,uBAAuB,GAE7F,kBAAkB,OAAG,2CAA0B,GAAG,eAAe,IAAI,UAAU,KAAK,EAAE,EAAE,QAAQ,aAAa,EAAE,CAAC;AAEhH,eAAW,SAAS,UAAU;AAC5B,oBAAc,OAAO,iBAAiB,cAAc,eAAe,uBAAuB;AAAA;AAE9F;AAMA,SAAS,aACP,WACA,iBACA,cACA,eACA,yBACA;AAEA,MADI,CAAC,WAAW,SACZ,KAAC,8BAAa,UAAU,KAAK,EAAG;AAEpC,MAAI,YAAY,GAAG,eAAe,QAAI,2CAA0B,UAAU,KAAK,EAAE,QAAQ,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ACrD;AAAA,IACF;AAEA,UAAM,QAAQ,OAAO,YAAY,GAC3B,eAAe,YAAY,QAAQ,IAAI,KAAK,IAAI,EAAE;AACxD,aAAS,eAAe,GAAG,YAAY,GACvC,SAAS,eAAe,GAAG,WAAW;AAAA,EACxC;AAEA,kBAAS,GAAG,QAAQ,GACb;AACT;",
5
5
  "names": []
6
6
  }
@@ -33,14 +33,16 @@ function getTypedRoutesDeclarationFile(ctx) {
33
33
  var staticRoutes = /* @__PURE__ */new Set(),
34
34
  dynamicRoutes = /* @__PURE__ */new Set(),
35
35
  dynamicRouteContextKeys = /* @__PURE__ */new Set();
36
- return walkRouteNode((0, import_getRoutes.getRoutes)(ctx, {
36
+ walkRouteNode((0, import_getRoutes.getRoutes)(ctx, {
37
37
  platformRoutes: !1,
38
38
  // We don't need to generate platform specific routes
39
39
  ignoreEntryPoints: !0,
40
40
  ignoreRequireErrors: !0
41
41
  }),
42
42
  // importMode: 'async',
43
- "", staticRoutes, dynamicRoutes, dynamicRouteContextKeys), `// deno-lint-ignore-file
43
+ "", staticRoutes, dynamicRoutes, dynamicRouteContextKeys);
44
+ var hasRoutes = dynamicRouteContextKeys.size > 0;
45
+ return `// deno-lint-ignore-file
44
46
  /* eslint-disable */
45
47
  // biome-ignore: needed import
46
48
  import type { OneRouter } from 'one'
@@ -52,11 +54,47 @@ declare module 'one' {
52
54
  DynamicRoutes: ${setToUnionType(dynamicRoutes)}
53
55
  DynamicRouteTemplate: ${setToUnionType(dynamicRouteContextKeys)}
54
56
  IsTyped: true
57
+ ${hasRoutes ? `RouteTypes: ${generateRouteTypesMap(dynamicRouteContextKeys)}` : ""}
55
58
  }
56
59
  }
57
60
  }
61
+ ${hasRoutes ? `
62
+ /**
63
+ * Helper type for route information
64
+ */
65
+ type RouteInfo<Params = Record<string, never>> = {
66
+ Params: Params
67
+ LoaderProps: { path: string; params: Params; request?: Request }
68
+ }` : ""}
58
69
  `.trim();
59
70
  }
71
+ function generateRouteTypesMap(dynamicRouteContextKeys) {
72
+ if (dynamicRouteContextKeys.size === 0) return "{}";
73
+ var routes = [...dynamicRouteContextKeys].sort(),
74
+ entries = routes.map(function (routePath) {
75
+ var params = extractParams(routePath),
76
+ paramsType = params.length === 0 ? "{}" : generateInlineParamsType(params);
77
+ return ` '${routePath}': RouteInfo<${paramsType}>`;
78
+ }).join(`
79
+ `);
80
+ return `{
81
+ ${entries}
82
+ }`;
83
+ }
84
+ function extractParams(routePath) {
85
+ for (var params = [], paramRegex = /\[(\.\.\.)?([\w]+)\]/g, match; (match = paramRegex.exec(routePath)) !== null;) params.push({
86
+ name: match[2],
87
+ isCatchAll: match[1] === "..."
88
+ });
89
+ return params;
90
+ }
91
+ function generateInlineParamsType(params) {
92
+ var entries = params.map(function (p) {
93
+ var type = p.isCatchAll ? "string[]" : "string";
94
+ return `${p.name}: ${type}`;
95
+ });
96
+ return `{ ${entries.join("; ")} }`;
97
+ }
60
98
  function walkRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys) {
61
99
  if (routeNode) {
62
100
  addRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys), parentRoutePath = `${(0, import_matchers.removeSupportedExtensions)(`${parentRoutePath}/${routeNode.route}`).replace(/\/?index$/, "")}`;
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getTypedRoutesDeclarationFile_exports","__export","getTypedRoutesDeclarationFile","module","exports","import_getRoutes","require","import_matchers","CATCH_ALL","SLUG","ctx","staticRoutes","Set","dynamicRoutes","dynamicRouteContextKeys","walkRouteNode","getRoutes","platformRoutes","ignoreEntryPoints","ignoreRequireErrors","setToUnionType","trim","routeNode","parentRoutePath","addRouteNode","removeSupportedExtensions","route","replace","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","children","Symbol","iterator","_step","next","done","child","err","return","isTypedRoute","routePath","startsWith","dynamic","generateCombinations","path","add","replaceAll"],"sources":["../../../src/typed-rout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AAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA;UAEM,IAAAkB,IAAQ,GAAAX,KAAO,CAAApC,KAAA;UAErBe,uBAA2B,CAAAiC,GAAA,CAAAD,IAAA,CAAY,EAAAjC,aAC9B,CAAAkC,GAAA;UACX;UAEA,GAAAD,IAAS,CAAAE,UAAW,CAAAxC,SACb,eAAAwC,UAAA,CAAAvC,IAAA,sCACT","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getTypedRoutesDeclarationFile_exports","__export","getTypedRoutesDeclarationFile","module","exports","import_getRoutes","require","import_matchers","CATCH_ALL","SLUG","ctx","staticRoutes","Set","dynamicRoutes","dynamicRouteContextKeys","walkRouteNode","getRoutes","platformRoutes","ignoreEntryPoints","ignoreRequireErrors","hasRoutes","size","setToUnionType","generateRouteTypesMap","trim","routes","sort","entries","map","routePath","params","extractParams","paramsType","length","generateInlineParamsType","join","paramRegex","match","exec","push","name","isCatchAll","p","type","routeNode","parentRoutePath","addRouteNode","removeSupportedExtensions","route","replace","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","children","Symbol","iterator","_step","next","done","child","err","return","isTypedRoute","startsWith","dynamic","generateCombinations","path"],"sources":["../../../src/typed-routes/getTypedRoutesDeclarationFile.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qCAAA;AAAAC,QAAA,CAAAD,qCAAA;EAAAE,6BAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA0B,CAAAK,qCAC1B;AAKA,IAAAK,gBAAkB,GAAAC,OAAA,gCAEL;EAAAC,eAAA,GAAAD,OAAA;EAAAE,SAAA;EAAAC,IAAA;AAEN,SAASP,8BAA8BQ,GAAA,EAAuB;EACnE,IAA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S,IAAAT,SAAA,CAAAS,MAAA;MACtD;QAGN,IAAAX,iBAAA,EAKM,MAAAC,cAAqB;MAS3B;IACE;EAGA;AACE;AACE,SAAAN,YAAaA,CAAAF,SAAK,EAAAC,eAAoB,EAAAlC,YAAe,EAAAE,aAAA,EAAAC,uBAAA;EACrD,IAAA8B,SAAA,EAAAI,KAAA,QAAAzC,eAAA,CAAAwD,YAAA,EAAAnB,SAAA,CAAAI,KAAA;IACF,IAAAnB,SAAA,MAAAgB,eAAA,QAAAtC,eAAA,CAAAwC,yBAAA,EAAAH,SAAA,CAAAI,KAAA,EAAAC,OAAA;IAEA,IAAApB,SAAM,CAAQmC,UAAO,UAAYnC,SAC3B,OAAAA,SAAe,KAAYe,SAAQ,CAAAqB,OAAS;MAClD,IAAAf,yBAA2B;QAAAC,iBAClB;QAAAC,cAAkB,QAAW;MACxC;QAEA,SAAAC,SAAY,GAAQa,oBACb,CAAArC,SAAA,EAAA0B,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAP,yBAAA,IAAAO,KAAA,GAAAJ,SAAA,CAAAK,IAAA,IAAAC,IAAA,GAAAT,yBAAA;UACT,IAAAiB,IAAA,GAAAV,KAAA,CAAA1D,KAAA","ignoreList":[]}
@@ -0,0 +1,136 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var injectRouteHelpers_exports = {};
22
+ __export(injectRouteHelpers_exports, {
23
+ injectRouteHelpers: () => injectRouteHelpers
24
+ });
25
+ module.exports = __toCommonJS(injectRouteHelpers_exports);
26
+ var import_promises = require("node:fs/promises"),
27
+ import_node_fs = require("node:fs");
28
+ async function injectRouteHelpers(filePath, routePath, mode) {
29
+ if (!(0, import_node_fs.existsSync)(filePath)) return !1;
30
+ try {
31
+ let content = await (0, import_promises.readFile)(filePath, "utf-8"),
32
+ modified = !1;
33
+ const hasTypeRoute = /^type\s+Route\s*=/m.test(content),
34
+ hasConstRoute = /^const\s+route\s*=/m.test(content);
35
+ if (mode === "runtime" && !hasConstRoute) {
36
+ const {
37
+ updatedContent
38
+ } = addCreateRouteImport(content);
39
+ content = updatedContent;
40
+ const routeDeclaration = `const route = createRoute<'${routePath}'>()`;
41
+ content = insertAfterImports(content, routeDeclaration), modified = !0;
42
+ }
43
+ if (mode === "type" && !hasTypeRoute) {
44
+ const {
45
+ updatedContent
46
+ } = addRouteTypeImport(content);
47
+ content = updatedContent;
48
+ const typeDeclaration = `type Route = RouteType<'${routePath}'>`;
49
+ content = insertAfterImports(content, typeDeclaration), modified = !0;
50
+ }
51
+ return modified ? (await (0, import_promises.writeFile)(filePath, content, "utf-8"), !0) : !1;
52
+ } catch (error) {
53
+ return console.error(`Failed to inject route helpers into ${filePath}:`, error), !1;
54
+ }
55
+ }
56
+ function addCreateRouteImport(content) {
57
+ if (/import\s+[^'"]*createRoute[^'"]*from\s+['"]one['"]/m.test(content)) return {
58
+ updatedContent: content,
59
+ importAdded: !1
60
+ };
61
+ const oneImportRegex = /import\s+{([^}]*)}\s+from\s+['"]one['"]/m,
62
+ match = content.match(oneImportRegex);
63
+ if (match) {
64
+ const existingImports = match[1].trim(),
65
+ newImports = existingImports ? `${existingImports}, createRoute` : "createRoute";
66
+ return {
67
+ updatedContent: content.replace(oneImportRegex, `import { ${newImports} } from 'one'`),
68
+ importAdded: !0
69
+ };
70
+ }
71
+ const lastImportIndex = findLastImportIndex(content);
72
+ if (lastImportIndex >= 0) {
73
+ const lines = content.split(`
74
+ `);
75
+ return lines.splice(lastImportIndex + 1, 0, "import { createRoute } from 'one'"), {
76
+ updatedContent: lines.join(`
77
+ `),
78
+ importAdded: !0
79
+ };
80
+ }
81
+ return {
82
+ updatedContent: `import { createRoute } from 'one'
83
+ ` + content,
84
+ importAdded: !0
85
+ };
86
+ }
87
+ function addRouteTypeImport(content) {
88
+ if (/import\s+type\s+[^'"]*RouteType[^'"]*from\s+['"]one['"]/m.test(content)) return {
89
+ updatedContent: content,
90
+ importAdded: !1
91
+ };
92
+ const oneTypeImportRegex = /import\s+type\s+{([^}]*)}\s+from\s+['"]one['"]/m,
93
+ match = content.match(oneTypeImportRegex);
94
+ if (match) {
95
+ const existingImports = match[1].trim(),
96
+ newImports = existingImports ? `${existingImports}, RouteType` : "RouteType";
97
+ return {
98
+ updatedContent: content.replace(oneTypeImportRegex, `import type { ${newImports} } from 'one'`),
99
+ importAdded: !0
100
+ };
101
+ }
102
+ const lastImportIndex = findLastImportIndex(content);
103
+ if (lastImportIndex >= 0) {
104
+ const lines = content.split(`
105
+ `);
106
+ return lines.splice(lastImportIndex + 1, 0, "import type { RouteType } from 'one'"), {
107
+ updatedContent: lines.join(`
108
+ `),
109
+ importAdded: !0
110
+ };
111
+ }
112
+ return {
113
+ updatedContent: `import type { RouteType } from 'one'
114
+ ` + content,
115
+ importAdded: !0
116
+ };
117
+ }
118
+ function findLastImportIndex(content) {
119
+ const lines = content.split(`
120
+ `);
121
+ let lastImportIndex = -1;
122
+ for (let i = 0; i < lines.length; i++) {
123
+ const line = lines[i].trim();
124
+ if (line.startsWith("import ") || lastImportIndex >= 0 && (line.startsWith("from ") || line === "}")) lastImportIndex = i;else if (lastImportIndex >= 0 && line && !line.startsWith("//")) break;
125
+ }
126
+ return lastImportIndex;
127
+ }
128
+ function insertAfterImports(content, codeToInsert) {
129
+ const lines = content.split(`
130
+ `),
131
+ lastImportIndex = findLastImportIndex(content);
132
+ return lastImportIndex >= 0 ? (lines[lastImportIndex + 1] === "" ? lines.splice(lastImportIndex + 2, 0, codeToInsert, "") : lines.splice(lastImportIndex + 1, 0, "", codeToInsert, ""), lines.join(`
133
+ `)) : codeToInsert + `
134
+
135
+ ` + content;
136
+ }
@@ -0,0 +1,104 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var injectRouteHelpers_exports = {};
16
+ __export(injectRouteHelpers_exports, {
17
+ injectRouteHelpers: () => injectRouteHelpers
18
+ });
19
+ module.exports = __toCommonJS(injectRouteHelpers_exports);
20
+ var import_promises = require("node:fs/promises"), import_node_fs = require("node:fs");
21
+ async function injectRouteHelpers(filePath, routePath, mode) {
22
+ if (!(0, import_node_fs.existsSync)(filePath))
23
+ return !1;
24
+ try {
25
+ let content = await (0, import_promises.readFile)(filePath, "utf-8"), modified = !1;
26
+ const hasTypeRoute = /^type\s+Route\s*=/m.test(content), hasConstRoute = /^const\s+route\s*=/m.test(content);
27
+ if (mode === "runtime" && !hasConstRoute) {
28
+ const { updatedContent } = addCreateRouteImport(content);
29
+ content = updatedContent;
30
+ const routeDeclaration = `const route = createRoute<'${routePath}'>()`;
31
+ content = insertAfterImports(content, routeDeclaration), modified = !0;
32
+ }
33
+ if (mode === "type" && !hasTypeRoute) {
34
+ const { updatedContent } = addRouteTypeImport(content);
35
+ content = updatedContent;
36
+ const typeDeclaration = `type Route = RouteType<'${routePath}'>`;
37
+ content = insertAfterImports(content, typeDeclaration), modified = !0;
38
+ }
39
+ return modified ? (await (0, import_promises.writeFile)(filePath, content, "utf-8"), !0) : !1;
40
+ } catch (error) {
41
+ return console.error(`Failed to inject route helpers into ${filePath}:`, error), !1;
42
+ }
43
+ }
44
+ function addCreateRouteImport(content) {
45
+ if (/import\s+[^'"]*createRoute[^'"]*from\s+['"]one['"]/m.test(content))
46
+ return { updatedContent: content, importAdded: !1 };
47
+ const oneImportRegex = /import\s+{([^}]*)}\s+from\s+['"]one['"]/m, match = content.match(oneImportRegex);
48
+ if (match) {
49
+ const existingImports = match[1].trim(), newImports = existingImports ? `${existingImports}, createRoute` : "createRoute";
50
+ return { updatedContent: content.replace(oneImportRegex, `import { ${newImports} } from 'one'`), importAdded: !0 };
51
+ }
52
+ const lastImportIndex = findLastImportIndex(content);
53
+ if (lastImportIndex >= 0) {
54
+ const lines = content.split(`
55
+ `);
56
+ return lines.splice(lastImportIndex + 1, 0, "import { createRoute } from 'one'"), { updatedContent: lines.join(`
57
+ `), importAdded: !0 };
58
+ }
59
+ return { updatedContent: `import { createRoute } from 'one'
60
+ ` + content, importAdded: !0 };
61
+ }
62
+ function addRouteTypeImport(content) {
63
+ if (/import\s+type\s+[^'"]*RouteType[^'"]*from\s+['"]one['"]/m.test(content))
64
+ return { updatedContent: content, importAdded: !1 };
65
+ const oneTypeImportRegex = /import\s+type\s+{([^}]*)}\s+from\s+['"]one['"]/m, match = content.match(oneTypeImportRegex);
66
+ if (match) {
67
+ const existingImports = match[1].trim(), newImports = existingImports ? `${existingImports}, RouteType` : "RouteType";
68
+ return { updatedContent: content.replace(
69
+ oneTypeImportRegex,
70
+ `import type { ${newImports} } from 'one'`
71
+ ), importAdded: !0 };
72
+ }
73
+ const lastImportIndex = findLastImportIndex(content);
74
+ if (lastImportIndex >= 0) {
75
+ const lines = content.split(`
76
+ `);
77
+ return lines.splice(lastImportIndex + 1, 0, "import type { RouteType } from 'one'"), { updatedContent: lines.join(`
78
+ `), importAdded: !0 };
79
+ }
80
+ return { updatedContent: `import type { RouteType } from 'one'
81
+ ` + content, importAdded: !0 };
82
+ }
83
+ function findLastImportIndex(content) {
84
+ const lines = content.split(`
85
+ `);
86
+ let lastImportIndex = -1;
87
+ for (let i = 0; i < lines.length; i++) {
88
+ const line = lines[i].trim();
89
+ if (line.startsWith("import ") || lastImportIndex >= 0 && (line.startsWith("from ") || line === "}"))
90
+ lastImportIndex = i;
91
+ else if (lastImportIndex >= 0 && line && !line.startsWith("//"))
92
+ break;
93
+ }
94
+ return lastImportIndex;
95
+ }
96
+ function insertAfterImports(content, codeToInsert) {
97
+ const lines = content.split(`
98
+ `), lastImportIndex = findLastImportIndex(content);
99
+ return lastImportIndex >= 0 ? (lines[lastImportIndex + 1] === "" ? lines.splice(lastImportIndex + 2, 0, codeToInsert, "") : lines.splice(lastImportIndex + 1, 0, "", codeToInsert, ""), lines.join(`
100
+ `)) : codeToInsert + `
101
+
102
+ ` + content;
103
+ }
104
+ //# sourceMappingURL=injectRouteHelpers.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/typed-routes/injectRouteHelpers.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoC,6BACpC,iBAA2B;AAa3B,eAAsB,mBACpB,UACA,WACA,MACkB;AAClB,MAAI,KAAC,2BAAW,QAAQ;AACtB,WAAO;AAGT,MAAI;AACF,QAAI,UAAU,UAAM,0BAAS,UAAU,OAAO,GAC1C,WAAW;AAGf,UAAM,eAAe,qBAAqB,KAAK,OAAO,GAChD,gBAAgB,sBAAsB,KAAK,OAAO;AAGxD,QAAI,SAAS,aAAa,CAAC,eAAe;AAC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