@expo/router-server 55.0.14 → 55.0.16
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.
|
@@ -13,10 +13,7 @@ export declare function getWatchHandler(outputDir: string, { ctx, regenerateFn }
|
|
|
13
13
|
regenerateFn?: ((outputDir: string, options?: {
|
|
14
14
|
partialTypedGroups?: boolean;
|
|
15
15
|
} | undefined, ctx?: RequireContextPonyFill | undefined) => void) | undefined;
|
|
16
|
-
}): (
|
|
17
|
-
filePath: string;
|
|
18
|
-
type: string;
|
|
19
|
-
}) => Promise<void>;
|
|
16
|
+
}): (filePath: string, type: "add" | "change" | "delete") => Promise<void>;
|
|
20
17
|
/**
|
|
21
18
|
* Regenerate the declaration file.
|
|
22
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAQ3F,YAAY,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,OAAO,KAAK,CAAC;AAE1B;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,EAAE,GAAgB,EAAE,YAAqC,EAAE;;;6BAyDzB,OAAO;gEAqBZ,IAAI;CA9E+B,IAIjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAQ3F,YAAY,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,OAAO,KAAK,CAAC;AAE1B;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,EAAE,GAAgB,EAAE,YAAqC,EAAE;;;6BAyDzB,OAAO;gEAqBZ,IAAI;CA9E+B,IAIjC,UAAU,MAAM,EAAE,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,mBAoCnF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;yBAGC,OAAO;4DAqBZ,IAAI,AATlC,CAAC"}
|
|
@@ -23,7 +23,7 @@ exports.version = 52;
|
|
|
23
23
|
function getWatchHandler(outputDir, { ctx = defaultCtx, regenerateFn = exports.regenerateDeclarations } = {} // Exposed for testing
|
|
24
24
|
) {
|
|
25
25
|
const routeFiles = new Set(ctx.keys().filter((key) => (0, routing_1.isTypedRoute)(key)));
|
|
26
|
-
return async function callback(
|
|
26
|
+
return async function callback(filePath, type) {
|
|
27
27
|
// Sanity check that we are in an Expo Router project
|
|
28
28
|
if (!process.env.EXPO_ROUTER_APP_ROOT)
|
|
29
29
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":";;;;;;AAqBA,0CA0CC;AA/DD,yDAAiE;AACjE,0DAA4D;AAC5D,0DAA2F;AAC3F,sDAAyB;AACzB,0DAA6B;AAE7B,yCAA2D;AAE3D,MAAM,UAAU,GAAG,IAAA,wBAAc,EAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,oCAAsB,CAAC,CAAC;AAIlG;;;GAGG;AACU,QAAA,OAAO,GAAG,EAAE,CAAC;AAE1B;;GAEG;AACH,SAAgB,eAAe,CAC7B,SAAiB,EACjB,EAAE,GAAG,GAAG,UAAU,EAAE,YAAY,GAAG,8BAAsB,EAAE,GAAG,EAAE,CAAC,sBAAsB;;IAEvF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,GAAG,CAAC,CAAC,C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ACvB,CAAC;AACH,CAAC,CACF,CAAC;AAEF;;;GAGG;AACH,SAAS,QAAQ,CACf,EAAK,EACL,UAAkB,IAAI;IAEtB,IAAI,KAAoC,CAAC;IACzC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;QACjB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACd,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { EXPO_ROUTER_CTX_IGNORE } from 'expo-router/_ctx-shared';\nimport { isTypedRoute } from 'expo-router/internal/routing';\nimport { requireContext, type RequireContextPonyFill } from 'expo-router/internal/testing';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { getTypedRoutesDeclarationFile } from './generate';\n\nconst defaultCtx = requireContext(process.env.EXPO_ROUTER_APP_ROOT, true, EXPO_ROUTER_CTX_IGNORE);\n\nexport type { RequireContextPonyFill } from 'expo-router/internal/testing';\n\n/**\n * This file is imported via `@expo/cli`. While users should be using the same SDK version of `expo-router` as `@expo/cli`,\n * this export allows us to ensure that the version of the `expo-router` package is compatible with the version of `@expo/cli`.\n */\nexport const version = 52;\n\n/**\n * Generate a Metro watch handler that regenerates the typed routes declaration file\n */\nexport function getWatchHandler(\n outputDir: string,\n { ctx = defaultCtx, regenerateFn = regenerateDeclarations } = {} // Exposed for testing\n) {\n const routeFiles = new Set(ctx.keys().filter((key) => isTypedRoute(key)));\n\n return async function callback(filePath: string, type: 'add' | 'change' | 'delete') {\n // Sanity check that we are in an Expo Router project\n if (!process.env.EXPO_ROUTER_APP_ROOT) return;\n\n let shouldRegenerate = false;\n let relativePath = path.relative(process.env.EXPO_ROUTER_APP_ROOT, filePath);\n const isInsideAppRoot = !relativePath.startsWith('../');\n const basename = path.basename(relativePath);\n\n if (!isInsideAppRoot) return;\n\n // require.context paths always start with './' when relative to the root\n relativePath = `./${relativePath}`;\n\n if (type === 'delete') {\n ctx.__delete(relativePath);\n if (routeFiles.has(relativePath)) {\n routeFiles.delete(relativePath);\n shouldRegenerate = true;\n }\n } else if (type === 'add') {\n ctx.__add(relativePath);\n if (isTypedRoute(basename)) {\n routeFiles.add(relativePath);\n shouldRegenerate = true;\n }\n } else {\n shouldRegenerate = routeFiles.has(relativePath);\n }\n\n if (shouldRegenerate) {\n // TODO(@kitten): This was altered from `regenerateFn(outputDir, ctx)` which, as per the types, is incorrect\n // It's unclear whether fixing this will have other unintended consequences!\n regenerateFn(outputDir, {}, ctx);\n }\n };\n}\n\n/**\n * Regenerate the declaration file.\n *\n * This function needs to be debounced due to Metro's handling of renaming folders.\n * For example, if you have the file /(tabs)/route.tsx and you rename the folder to /(tabs,test)/route.tsx\n *\n * Metro will fire 2 filesystem events:\n * - ADD /(tabs,test)/router.tsx\n * - DELETE /(tabs)/router.tsx\n *\n * If you process the types after the ADD, then they will crash as you will have conflicting routes\n */\nexport const regenerateDeclarations = debounce(\n (\n outputDir: string,\n options: { partialTypedGroups?: boolean } = {},\n ctx: RequireContextPonyFill = defaultCtx\n ) => {\n // Don't crash the process, just log the error. The user will most likely fix it and continue\n try {\n const file = getTypedRoutesDeclarationFile(ctx, options);\n if (!file) return;\n fs.writeFileSync(path.resolve(outputDir, './router.d.ts'), file);\n } catch (error) {\n console.error(error);\n }\n }\n);\n\n/**\n * Debounce a function to only run once after a period of inactivity\n * If called while waiting, it will reset the timer\n */\nfunction debounce<T extends (...args: any[]) => any>(\n fn: T,\n timeout: number = 1000\n): (...args: Parameters<T>) => void {\n let timer: ReturnType<typeof setTimeout>;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n fn(...args);\n }, timeout);\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/router-server",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.16",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"expo"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@expo/metro-runtime": "^55.0.
|
|
37
|
+
"@expo/metro-runtime": "^55.0.11",
|
|
38
38
|
"react": "*",
|
|
39
39
|
"react-dom": "*",
|
|
40
40
|
"expo": "*",
|
|
41
|
-
"expo-constants": "^55.0.
|
|
42
|
-
"expo-font": "^55.0.
|
|
41
|
+
"expo-constants": "^55.0.16",
|
|
42
|
+
"expo-font": "^55.0.7",
|
|
43
43
|
"expo-router": "*",
|
|
44
|
-
"expo-server": "^55.0.
|
|
44
|
+
"expo-server": "^55.0.9",
|
|
45
45
|
"react-server-dom-webpack": "~19.0.1 || ~19.1.2 || ~19.2.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "7c081282cf88968f81732feb67a71840e769a40f"
|
|
72
72
|
}
|