MCPcopy Index your code
hub / github.com/QwikDev/qwik / makeNormalizePath

Function makeNormalizePath

packages/qwik/src/optimizer/src/plugins/plugin.ts:1079–1098  ·  view source on GitHub ↗
(sys: OptimizerSystem)

Source from the content-addressed store, hash-verified

1077
1078/** Convert windows backslashes to forward slashes */
1079export const makeNormalizePath = (sys: OptimizerSystem) => (id: string) => {
1080 if (typeof id === 'string') {
1081 if (isWin(sys.os)) {
1082 // MIT https://github.com/sindresorhus/slash/blob/main/license
1083 // Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
1084 const isExtendedLengthPath = /^\\\\\?\\/.test(id);
1085 if (!isExtendedLengthPath) {
1086 const hasNonAscii = /[^\u0000-\u0080]+/.test(id); // eslint-disable-line no-control-regex
1087 if (!hasNonAscii) {
1088 id = id.replace(/\\/g, '/');
1089 }
1090 }
1091 // windows normalize
1092 return sys.path.posix.normalize(id);
1093 }
1094 // posix normalize
1095 return sys.path.normalize(id);
1096 }
1097 return id;
1098};
1099
1100function isAdditionalFile(mod: TransformModule) {
1101 return mod.isEntry || mod.segment;

Callers 1

initFunction · 0.85

Calls 2

isWinFunction · 0.90
normalizeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…