expo-router 4.0.11 → 4.0.12
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/build/rsc/path.d.ts +1 -0
- package/build/rsc/path.d.ts.map +1 -1
- package/build/rsc/path.js +8 -1
- package/build/rsc/path.js.map +1 -1
- package/package.json +4 -3
package/build/rsc/path.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export declare const encodeFilePathToAbsolute: (filePath: string) => string;
|
|
11
11
|
export declare const decodeFilePathFromAbsolute: (filePath: string) => string;
|
|
12
12
|
export declare const filePathToFileURL: (filePath: string) => string;
|
|
13
|
+
/** Return the original "osPath" based on the file URL */
|
|
13
14
|
export declare const fileURLToFilePath: (fileURL: string) => string;
|
|
14
15
|
export declare const joinPath: (...paths: string[]) => string;
|
|
15
16
|
export declare const extname: (filePath: string) => string;
|
package/build/rsc/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,eAAO,MAAM,wBAAwB,aAAc,MAAM,WAQxD,CAAC;AAEF,eAAO,MAAM,0BAA0B,aAAc,MAAM,WAK1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,MAAM,WAAoC,CAAC;AAEvF,eAAO,MAAM,iBAAiB,YAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,eAAO,MAAM,wBAAwB,aAAc,MAAM,WAQxD,CAAC;AAEF,eAAO,MAAM,0BAA0B,aAAc,MAAM,WAK1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,MAAM,WAAoC,CAAC;AAEvF,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,YAAa,MAAM,WAahD,CAAC;AAGF,eAAO,MAAM,QAAQ,aAAc,MAAM,EAAE,WAmB1C,CAAC;AAEF,eAAO,MAAM,OAAO,aAAc,MAAM,WAGvC,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,SAAS,YAAY,EAAE,CAAC;AAE/C,eAAO,MAAM,iBAAiB,SAAU,MAAM,aAiBxC,CAAC;AAEP,eAAO,MAAM,cAAc,iCAEf,MAAM,KACf,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAgDtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,4BAWvB,CAAC"}
|
package/build/rsc/path.js
CHANGED
|
@@ -37,11 +37,18 @@ const decodeFilePathFromAbsolute = (filePath) => {
|
|
|
37
37
|
exports.decodeFilePathFromAbsolute = decodeFilePathFromAbsolute;
|
|
38
38
|
const filePathToFileURL = (filePath) => 'file://' + encodeURI(filePath);
|
|
39
39
|
exports.filePathToFileURL = filePathToFileURL;
|
|
40
|
+
/** Return the original "osPath" based on the file URL */
|
|
40
41
|
const fileURLToFilePath = (fileURL) => {
|
|
41
42
|
if (!fileURL.startsWith('file://')) {
|
|
42
43
|
throw new Error('Not a file URL');
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
const filePath = decodeURI(fileURL.slice('file://'.length));
|
|
46
|
+
// File URLs are always formatted in POSIX, using a leading `/` (URL pathname) separator.
|
|
47
|
+
// On POSIX systems, this leading `/` is the root directory, which is valid for absolute file paths.
|
|
48
|
+
// On UNIX systems, this leading `/` needs to be stripped, and the actual UNIX formatted path is returned - to match Metro's behavior
|
|
49
|
+
return ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)
|
|
50
|
+
? filePath.slice(1).replace(/\//g, '\\')
|
|
51
|
+
: filePath;
|
|
45
52
|
};
|
|
46
53
|
exports.fileURLToFilePath = fileURLToFilePath;
|
|
47
54
|
// for filePath
|
package/build/rsc/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,eAAe;AACf,0EAA0E;AAC1E,0BAA0B;AAC1B,4EAA4E;AAC5E,8BAA8B;AAC9B,qEAAqE;AACrE,6BAA6B;AAE7B,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE7C,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3D,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,GAAG,GAAG,QAAQ,CAAC;AACxB,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC;AAEK,MAAM,0BAA0B,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC7D,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1B;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC;AAEK,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAA1E,QAAA,iBAAiB,qBAAyD;AAEhF,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,EAAE;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C,OAAO,IAAI,CAAC;aACb;SACF;aAAM,IAAI,IAAI,KAAK,UAAU,EAAE;YAC9B,gBAAgB,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;YACzC,MAAM;SACP;aAAM,IAAI,IAAI,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC;SAChD;KACF;IACD,IAAI,kBAAkB,KAAK,CAAC,CAAC,IAAI,gBAAgB,KAAK,CAAC,CAAC,EAAE;QACxD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,kBAAkB,CAAE,CAAC,IAAI,CAAC;IACxD,IAAI,YAAY,EAAE;QAChB,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAC;KAChF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAnDW,QAAA,cAAc,kBAmDzB;AAEF;;GAEG;AACI,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,EAAE;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QACxC,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,IAAI,CAAC;SACb;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE;YAC3B,OAAO,SAAS,CAAC;SAClB;aAAM;YACL,OAAO,MAAM,CAAC;SACf;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACjC,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/utils/path.ts#L1\n */\n\n// Terminology:\n// - filePath: posix-like file path, e.g. `/foo/bar.js` or `c:/foo/bar.js`\n// This is used by Vite.\n// - fileURL: file URL, e.g. `file:///foo/bar.js` or `file:///c:/foo/bar.js`\n// This is used by import().\n// - osPath: os dependent path, e.g. `/foo/bar.js` or `c:\\foo\\bar.js`\n// This is used by node:fs.\n\nconst ABSOLUTE_WIN32_PATH_REGEXP = /^\\/[a-zA-Z]:\\//;\n\nexport const encodeFilePathToAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n throw new Error('Unsupported absolute file path');\n }\n if (filePath.startsWith('/')) {\n return filePath;\n }\n return '/' + filePath;\n};\n\nexport const decodeFilePathFromAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n return filePath.slice(1);\n }\n return filePath;\n};\n\nexport const filePathToFileURL = (filePath: string) => 'file://' + encodeURI(filePath);\n\nexport const fileURLToFilePath = (fileURL: string) => {\n if (!fileURL.startsWith('file://')) {\n throw new Error('Not a file URL');\n }\n return decodeURI(fileURL.slice('file://'.length));\n};\n\n// for filePath\nexport const joinPath = (...paths: string[]) => {\n const isAbsolute = paths[0]?.startsWith('/');\n const items = ([] as string[]).concat(...paths.map((path) => path.split('/')));\n let i = 0;\n while (i < items.length) {\n if (items[i] === '.' || items[i] === '') {\n items.splice(i, 1);\n } else if (items[i] === '..') {\n if (i > 0) {\n items.splice(i - 1, 2);\n --i;\n } else {\n items.splice(i, 1);\n }\n } else {\n ++i;\n }\n }\n return (isAbsolute ? '/' : '') + items.join('/') || '.';\n};\n\nexport const extname = (filePath: string) => {\n const index = filePath.lastIndexOf('.');\n return index > 0 ? filePath.slice(index) : '';\n};\n\nexport type PathSpecItem =\n | { type: 'literal'; name: string }\n | { type: 'group'; name?: string }\n | { type: 'wildcard'; name?: string };\nexport type PathSpec = readonly PathSpecItem[];\n\nexport const parsePathWithSlug = (path: string): PathSpec =>\n path\n .split('/')\n .filter(Boolean)\n .map((name) => {\n let type: 'literal' | 'group' | 'wildcard' = 'literal';\n const isSlug = name.startsWith('[') && name.endsWith(']');\n if (isSlug) {\n type = 'group';\n name = name.slice(1, -1);\n }\n const isWildcard = name.startsWith('...');\n if (isWildcard) {\n type = 'wildcard';\n name = name.slice(3);\n }\n return { type, name };\n });\n\nexport const getPathMapping = (\n pathSpec: PathSpec,\n pathname: string\n): Record<string, string | string[]> | null => {\n const actual = pathname.split('/').filter(Boolean);\n if (pathSpec.length > actual.length) {\n return null;\n }\n const mapping: Record<string, string | string[]> = {};\n let wildcardStartIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[i]!;\n if (type === 'literal') {\n if (name !== actual[i]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardStartIndex = i;\n break;\n } else if (name) {\n mapping[name] = actual[i]!;\n }\n }\n if (wildcardStartIndex === -1) {\n if (pathSpec.length !== actual.length) {\n return null;\n }\n return mapping;\n }\n let wildcardEndIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[pathSpec.length - i - 1]!;\n if (type === 'literal') {\n if (name !== actual[actual.length - i - 1]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardEndIndex = actual.length - i - 1;\n break;\n } else if (name) {\n mapping[name] = actual[actual.length - i - 1]!;\n }\n }\n if (wildcardStartIndex === -1 || wildcardEndIndex === -1) {\n throw new Error('Invalid wildcard path');\n }\n const wildcardName = pathSpec[wildcardStartIndex]!.name;\n if (wildcardName) {\n mapping[wildcardName] = actual.slice(wildcardStartIndex, wildcardEndIndex + 1);\n }\n return mapping;\n};\n\n/**\n * Transform a path spec to a regular expression.\n */\nexport const path2regexp = (path: PathSpec) => {\n const parts = path.map(({ type, name }) => {\n if (type === 'literal') {\n return name;\n } else if (type === 'group') {\n return `([^/]+)`;\n } else {\n return `(.*)`;\n }\n });\n return `^/${parts.join('/')}$`;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,eAAe;AACf,0EAA0E;AAC1E,0BAA0B;AAC1B,4EAA4E;AAC5E,8BAA8B;AAC9B,qEAAqE;AACrE,6BAA6B;AAE7B,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE7C,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3D,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,GAAG,GAAG,QAAQ,CAAC;AACxB,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC;AAEK,MAAM,0BAA0B,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC7D,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC1B;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC;AAEK,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAA1E,QAAA,iBAAiB,qBAAyD;AAEvF,yDAAyD;AAClD,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACnC;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AACjC,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/utils/path.ts#L1\n */\n\n// Terminology:\n// - filePath: posix-like file path, e.g. `/foo/bar.js` or `c:/foo/bar.js`\n// This is used by Vite.\n// - fileURL: file URL, e.g. `file:///foo/bar.js` or `file:///c:/foo/bar.js`\n// This is used by import().\n// - osPath: os dependent path, e.g. `/foo/bar.js` or `c:\\foo\\bar.js`\n// This is used by node:fs.\n\nconst ABSOLUTE_WIN32_PATH_REGEXP = /^\\/[a-zA-Z]:\\//;\n\nexport const encodeFilePathToAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n throw new Error('Unsupported absolute file path');\n }\n if (filePath.startsWith('/')) {\n return filePath;\n }\n return '/' + filePath;\n};\n\nexport const decodeFilePathFromAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n return filePath.slice(1);\n }\n return filePath;\n};\n\nexport const filePathToFileURL = (filePath: string) => 'file://' + encodeURI(filePath);\n\n/** Return the original \"osPath\" based on the file URL */\nexport const fileURLToFilePath = (fileURL: string) => {\n if (!fileURL.startsWith('file://')) {\n throw new Error('Not a file URL');\n }\n\n const filePath = decodeURI(fileURL.slice('file://'.length));\n\n // File URLs are always formatted in POSIX, using a leading `/` (URL pathname) separator.\n // On POSIX systems, this leading `/` is the root directory, which is valid for absolute file paths.\n // On UNIX systems, this leading `/` needs to be stripped, and the actual UNIX formatted path is returned - to match Metro's behavior\n return ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)\n ? filePath.slice(1).replace(/\\//g, '\\\\')\n : filePath;\n};\n\n// for filePath\nexport const joinPath = (...paths: string[]) => {\n const isAbsolute = paths[0]?.startsWith('/');\n const items = ([] as string[]).concat(...paths.map((path) => path.split('/')));\n let i = 0;\n while (i < items.length) {\n if (items[i] === '.' || items[i] === '') {\n items.splice(i, 1);\n } else if (items[i] === '..') {\n if (i > 0) {\n items.splice(i - 1, 2);\n --i;\n } else {\n items.splice(i, 1);\n }\n } else {\n ++i;\n }\n }\n return (isAbsolute ? '/' : '') + items.join('/') || '.';\n};\n\nexport const extname = (filePath: string) => {\n const index = filePath.lastIndexOf('.');\n return index > 0 ? filePath.slice(index) : '';\n};\n\nexport type PathSpecItem =\n | { type: 'literal'; name: string }\n | { type: 'group'; name?: string }\n | { type: 'wildcard'; name?: string };\nexport type PathSpec = readonly PathSpecItem[];\n\nexport const parsePathWithSlug = (path: string): PathSpec =>\n path\n .split('/')\n .filter(Boolean)\n .map((name) => {\n let type: 'literal' | 'group' | 'wildcard' = 'literal';\n const isSlug = name.startsWith('[') && name.endsWith(']');\n if (isSlug) {\n type = 'group';\n name = name.slice(1, -1);\n }\n const isWildcard = name.startsWith('...');\n if (isWildcard) {\n type = 'wildcard';\n name = name.slice(3);\n }\n return { type, name };\n });\n\nexport const getPathMapping = (\n pathSpec: PathSpec,\n pathname: string\n): Record<string, string | string[]> | null => {\n const actual = pathname.split('/').filter(Boolean);\n if (pathSpec.length > actual.length) {\n return null;\n }\n const mapping: Record<string, string | string[]> = {};\n let wildcardStartIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[i]!;\n if (type === 'literal') {\n if (name !== actual[i]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardStartIndex = i;\n break;\n } else if (name) {\n mapping[name] = actual[i]!;\n }\n }\n if (wildcardStartIndex === -1) {\n if (pathSpec.length !== actual.length) {\n return null;\n }\n return mapping;\n }\n let wildcardEndIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[pathSpec.length - i - 1]!;\n if (type === 'literal') {\n if (name !== actual[actual.length - i - 1]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardEndIndex = actual.length - i - 1;\n break;\n } else if (name) {\n mapping[name] = actual[actual.length - i - 1]!;\n }\n }\n if (wildcardStartIndex === -1 || wildcardEndIndex === -1) {\n throw new Error('Invalid wildcard path');\n }\n const wildcardName = pathSpec[wildcardStartIndex]!.name;\n if (wildcardName) {\n mapping[wildcardName] = actual.slice(wildcardStartIndex, wildcardEndIndex + 1);\n }\n return mapping;\n};\n\n/**\n * Transform a path spec to a regular expression.\n */\nexport const path2regexp = (path: PathSpec) => {\n const parts = path.map(({ type, name }) => {\n if (type === 'literal') {\n return name;\n } else if (type === 'group') {\n return `([^/]+)`;\n } else {\n return `(.*)`;\n }\n });\n return `^/${parts.join('/')}$`;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-router",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.12",
|
|
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",
|
|
@@ -115,7 +115,8 @@
|
|
|
115
115
|
"react-native-is-edge-to-edge": "^1.1.6",
|
|
116
116
|
"schema-utils": "^4.0.1",
|
|
117
117
|
"semver": "~7.6.3",
|
|
118
|
-
"server-only": "^0.0.1"
|
|
118
|
+
"server-only": "^0.0.1",
|
|
119
|
+
"react-server-dom-webpack": "19.0.0-rc-6230622a1a-20240610"
|
|
119
120
|
},
|
|
120
|
-
"gitHead": "
|
|
121
|
+
"gitHead": "1faceb8d22bebee4571ef3a2f9578bec33dc26b1"
|
|
121
122
|
}
|