@ms-cloudpack/path-utilities 3.2.1 → 3.2.3

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/lib/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  export { findPackageRoot } from './findPackageRoot.js';
2
+ export { findProjectRoot } from './findProjectRoot.js';
2
3
  export { formatLocation } from './formatLocation.js';
3
4
  export { globSourceFiles } from './globSourceFiles.js';
4
- export { sourceFilesGlobs, alwaysExcludeGlobs } from './sourceFilesGlobs.js';
5
5
  export { intermediateToSourcePath } from './intermediateToSourcePath.js';
6
+ export { isExternalPackage } from './isExternalPackage.js';
6
7
  export { isFile } from './isFile.js';
7
8
  export { isFileSync } from './isFileSync.js';
8
9
  export { isFolder } from './isFolder.js';
9
10
  export { isFolderSync } from './isFolderSync.js';
10
11
  export { normalizedPathRelativeTo } from './normalizedPathRelativeTo.js';
11
12
  export { pathSymbolReplacement } from './pathSymbolReplacement.js';
12
- export { javascriptExtensions, jsxExtensions, sourceExtensions, typescriptExtensions } from './sourceExtensions.js';
13
- export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';
14
- export { findProjectRoot } from './findProjectRoot.js';
15
- export { isExternalPackage } from './isExternalPackage.js';
16
13
  export { resolve } from './resolve.js';
17
14
  export { resolveModule } from './resolveModule.js';
15
+ export { base64AssetExtensions, cjsSourceRegex, esmSourceRegex, javascriptExtensions, javascriptRegex, jsxExtensions, jsxRegex, nonJsSourceExtensions, plainJsExtensions, plainJsRegex, sourceExtensions, sourceRegex, textExtensions, transpiledSourceRegex, typescriptExtensions, typescriptRegex, webExtensions, } from './sourceExtensions.js';
16
+ export { alwaysExcludeGlobs, sourceFilesGlobs } from './sourceFilesGlobs.js';
17
+ export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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E,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
package/lib/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  export { findPackageRoot } from './findPackageRoot.js';
2
+ export { findProjectRoot } from './findProjectRoot.js';
2
3
  export { formatLocation } from './formatLocation.js';
3
4
  export { globSourceFiles } from './globSourceFiles.js';
4
- export { sourceFilesGlobs, alwaysExcludeGlobs } from './sourceFilesGlobs.js';
5
5
  export { intermediateToSourcePath } from './intermediateToSourcePath.js';
6
+ export { isExternalPackage } from './isExternalPackage.js';
6
7
  export { isFile } from './isFile.js';
7
8
  export { isFileSync } from './isFileSync.js';
8
9
  export { isFolder } from './isFolder.js';
9
10
  export { isFolderSync } from './isFolderSync.js';
10
11
  export { normalizedPathRelativeTo } from './normalizedPathRelativeTo.js';
11
12
  export { pathSymbolReplacement } from './pathSymbolReplacement.js';
12
- export { javascriptExtensions, jsxExtensions, sourceExtensions, typescriptExtensions } from './sourceExtensions.js';
13
- export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';
14
- export { findProjectRoot } from './findProjectRoot.js';
15
- export { isExternalPackage } from './isExternalPackage.js';
16
13
  export { resolve } from './resolve.js';
17
14
  export { resolveModule } from './resolveModule.js';
15
+ export { base64AssetExtensions, cjsSourceRegex, esmSourceRegex, javascriptExtensions, javascriptRegex, jsxExtensions, jsxRegex, nonJsSourceExtensions, plainJsExtensions, plainJsRegex, sourceExtensions, sourceRegex, textExtensions, transpiledSourceRegex, typescriptExtensions, typescriptRegex, webExtensions, } from './sourceExtensions.js';
16
+ export { alwaysExcludeGlobs, sourceFilesGlobs } from './sourceFilesGlobs.js';
17
+ export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';
18
18
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { findPackageRoot } from './findPackageRoot.js';\nexport { formatLocation } from './formatLocation.js';\nexport { globSourceFiles } from './globSourceFiles.js';\nexport { sourceFilesGlobs, alwaysExcludeGlobs } from './sourceFilesGlobs.js';\nexport { intermediateToSourcePath } from './intermediateToSourcePath.js';\nexport { isFile } from './isFile.js';\nexport { isFileSync } from './isFileSync.js';\nexport { isFolder } from './isFolder.js';\nexport { isFolderSync } from './isFolderSync.js';\nexport { normalizedPathRelativeTo } from './normalizedPathRelativeTo.js';\nexport { pathSymbolReplacement } from './pathSymbolReplacement.js';\nexport { javascriptExtensions, jsxExtensions, sourceExtensions, typescriptExtensions } from './sourceExtensions.js';\nexport { sourceToIntermediatePath } from './sourceToIntermediatePath.js';\nexport { findProjectRoot } from './findProjectRoot.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { resolve } from './resolve.js';\nexport { resolveModule } from './resolveModule.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export { findPackageRoot } from './findPackageRoot.js';\nexport { findProjectRoot } from './findProjectRoot.js';\nexport { formatLocation } from './formatLocation.js';\nexport { globSourceFiles } from './globSourceFiles.js';\nexport { intermediateToSourcePath } from './intermediateToSourcePath.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { isFile } from './isFile.js';\nexport { isFileSync } from './isFileSync.js';\nexport { isFolder } from './isFolder.js';\nexport { isFolderSync } from './isFolderSync.js';\nexport { normalizedPathRelativeTo } from './normalizedPathRelativeTo.js';\nexport { pathSymbolReplacement } from './pathSymbolReplacement.js';\nexport { resolve } from './resolve.js';\nexport { resolveModule } from './resolveModule.js';\nexport {\n base64AssetExtensions,\n cjsSourceRegex,\n esmSourceRegex,\n javascriptExtensions,\n javascriptRegex,\n jsxExtensions,\n jsxRegex,\n nonJsSourceExtensions,\n plainJsExtensions,\n plainJsRegex,\n sourceExtensions,\n sourceRegex,\n textExtensions,\n transpiledSourceRegex,\n typescriptExtensions,\n typescriptRegex,\n webExtensions,\n} from './sourceExtensions.js';\nexport { alwaysExcludeGlobs, sourceFilesGlobs } from './sourceFilesGlobs.js';\nexport { sourceToIntermediatePath } from './sourceToIntermediatePath.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"intermediateToSourcePath.d.ts","sourceRoot":"","sources":["../src/intermediateToSourcePath.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA4C/G"}
1
+ {"version":3,"file":"intermediateToSourcePath.d.ts","sourceRoot":"","sources":["../src/intermediateToSourcePath.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,wBAAwB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAwC/G"}
@@ -1,7 +1,7 @@
1
1
  import path from 'path';
2
2
  import { isFileSync } from './isFileSync.js';
3
3
  import { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
4
- import { sourceExtensions } from './sourceExtensions.js';
4
+ import { sourceExtensions, sourceRegex } from './sourceExtensions.js';
5
5
  // TODO: this assumption won't work for all repos (tracked by https://github.com/microsoft/cloudpack/issues/2366)
6
6
  const intermediateFolderNames = ['lib', 'lib-amd', 'lib-esm', 'lib-commonjs', 'dist'];
7
7
  const sourceFolderName = 'src';
@@ -10,9 +10,8 @@ const sourceFolderName = 'src';
10
10
  * (e.g. "./src/foo/foo.tsx"). Note: source files must exist so that the utility can resolve the source.
11
11
  */
12
12
  export function intermediateToSourcePath(relativeIntermediatePath, rootPath) {
13
- const originalExt = path.extname(relativeIntermediatePath);
14
13
  const originalDir = path.dirname(relativeIntermediatePath);
15
- const basename = path.basename(relativeIntermediatePath, sourceExtensions.includes(originalExt) ? originalExt : undefined);
14
+ const basename = path.basename(relativeIntermediatePath).replace(sourceRegex, '');
16
15
  // Normalize to get rid of leading ./ or any other extra segments, then split into parts.
17
16
  const dirParts = path.normalize(originalDir).split(/[\\/]/g);
18
17
  if (dirParts[0] === sourceFolderName && isFileSync(path.resolve(rootPath, relativeIntermediatePath))) {
@@ -1 +1 @@
1
- {"version":3,"file":"intermediateToSourcePath.js","sourceRoot":"","sources":["../src/intermediateToSourcePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,iHAAiH;AACjH,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AACtF,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,wBAAgC,EAAE,QAAgB;IACzF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAC5B,wBAAwB,EACxB,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAA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,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAE1F,4FAA4F;IAC5F,UAAU,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import path from 'path';\nimport { isFileSync } from './isFileSync.js';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { sourceExtensions } from './sourceExtensions.js';\n\n// TODO: this assumption won't work for all repos (tracked by https://github.com/microsoft/cloudpack/issues/2366)\nconst intermediateFolderNames = ['lib', 'lib-amd', 'lib-esm', 'lib-commonjs', 'dist'];\nconst sourceFolderName = 'src';\n\n/**\n * Takes a relative intermediate content path (e.g. \"lib/foo/bar.js\") and resolves it to a source content path\n * (e.g. \"./src/foo/foo.tsx\"). Note: source files must exist so that the utility can resolve the source.\n */\nexport function intermediateToSourcePath(relativeIntermediatePath: string, rootPath: string): string | undefined {\n const originalExt = path.extname(relativeIntermediatePath);\n const originalDir = path.dirname(relativeIntermediatePath);\n const basename = path.basename(\n relativeIntermediatePath,\n sourceExtensions.includes(originalExt) ? originalExt : undefined,\n );\n\n // Normalize to get rid of leading ./ or any other extra segments, then split into parts.\n const dirParts = path.normalize(originalDir).split(/[\\\\/]/g);\n if (dirParts[0] === sourceFolderName && isFileSync(path.resolve(rootPath, relativeIntermediatePath))) {\n // This is already a complete source path. Use it as-is.\n return normalizeRelativePath(relativeIntermediatePath);\n }\n\n const candidates: string[] = [];\n\n // Find the first non-'..' folder name. If it's a known intermediate folder name, then we can\n // replace it with the source folder name and add candidate paths for all extensions.\n const firstDirIndex = dirParts.findIndex((part) => part !== '..');\n if (firstDirIndex !== -1 && intermediateFolderNames.includes(dirParts[firstDirIndex])) {\n // Join the parts back together, replacing the part with the source folder name.\n dirParts[firstDirIndex] = sourceFolderName;\n const newDir = dirParts.join('/');\n\n // Push all possible source extensions.\n candidates.push(...sourceExtensions.map((ext) => path.join(newDir, basename + ext)));\n\n // Push the original.\n candidates.push(path.join(newDir, basename));\n }\n\n // Push the original path with all supported source extensions.\n candidates.push(...sourceExtensions.map((ext) => path.join(originalDir, basename + ext)));\n\n // And finally push the original path with the original extension in case it wasn't covered.\n candidates.push(relativeIntermediatePath);\n\n const match = candidates.find((candidate) => isFileSync(path.resolve(rootPath, candidate)));\n if (match) {\n return normalizeRelativePath(match);\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"intermediateToSourcePath.js","sourceRoot":"","sources":["../src/intermediateToSourcePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEtE,iHAAiH;AACjH,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AACtF,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,wBAAgC,EAAE,QAAgB;IACzF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAElF,yFAAyF;IACzF,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CA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AAwB,CAAC,CAAC;IAE1C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import path from 'path';\nimport { isFileSync } from './isFileSync.js';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { sourceExtensions, sourceRegex } from './sourceExtensions.js';\n\n// TODO: this assumption won't work for all repos (tracked by https://github.com/microsoft/cloudpack/issues/2366)\nconst intermediateFolderNames = ['lib', 'lib-amd', 'lib-esm', 'lib-commonjs', 'dist'];\nconst sourceFolderName = 'src';\n\n/**\n * Takes a relative intermediate content path (e.g. \"lib/foo/bar.js\") and resolves it to a source content path\n * (e.g. \"./src/foo/foo.tsx\"). Note: source files must exist so that the utility can resolve the source.\n */\nexport function intermediateToSourcePath(relativeIntermediatePath: string, rootPath: string): string | undefined {\n const originalDir = path.dirname(relativeIntermediatePath);\n const basename = path.basename(relativeIntermediatePath).replace(sourceRegex, '');\n\n // Normalize to get rid of leading ./ or any other extra segments, then split into parts.\n const dirParts = path.normalize(originalDir).split(/[\\\\/]/g);\n if (dirParts[0] === sourceFolderName && isFileSync(path.resolve(rootPath, relativeIntermediatePath))) {\n // This is already a complete source path. Use it as-is.\n return normalizeRelativePath(relativeIntermediatePath);\n }\n\n const candidates: string[] = [];\n\n // Find the first non-'..' folder name. If it's a known intermediate folder name, then we can\n // replace it with the source folder name and add candidate paths for all extensions.\n const firstDirIndex = dirParts.findIndex((part) => part !== '..');\n if (firstDirIndex !== -1 && intermediateFolderNames.includes(dirParts[firstDirIndex])) {\n // Join the parts back together, replacing the part with the source folder name.\n dirParts[firstDirIndex] = sourceFolderName;\n const newDir = dirParts.join('/');\n\n // Push all possible source extensions.\n candidates.push(...sourceExtensions.map((ext) => path.join(newDir, basename + ext)));\n\n // Push the original.\n candidates.push(path.join(newDir, basename));\n }\n\n // Push the original path with all supported source extensions.\n candidates.push(...sourceExtensions.map((ext) => path.join(originalDir, basename + ext)));\n\n // And finally push the original path with the original extension in case it wasn't covered.\n candidates.push(relativeIntermediatePath);\n\n const match = candidates.find((candidate) => isFileSync(path.resolve(rootPath, candidate)));\n if (match) {\n return normalizeRelativePath(match);\n }\n\n return undefined;\n}\n"]}
@@ -8,6 +8,10 @@ export declare const typescriptExtensions: ReadonlyArray<string>;
8
8
  * (Does not include `.json`.)
9
9
  */
10
10
  export declare const javascriptExtensions: ReadonlyArray<string>;
11
+ /**
12
+ * All valid non-JSX JavaScript file extensions.
13
+ */
14
+ export declare const plainJsExtensions: ReadonlyArray<string>;
11
15
  /**
12
16
  * All valid TypeScript and JavaScript source file extensions.
13
17
  * (Does not include `.json`.)
@@ -17,4 +21,53 @@ export declare const sourceExtensions: ReadonlyArray<string>;
17
21
  * All valid JSX/TSX source file extensions.
18
22
  */
19
23
  export declare const jsxExtensions: ReadonlyArray<string>;
24
+ /**
25
+ * Web extensions for `resolve-web-extensions` capability (the most common JS and TS extensions with `.web` prefix).
26
+ */
27
+ export declare const webExtensions: ReadonlyArray<string>;
28
+ /**
29
+ * Supported media and font file extensions.
30
+ */
31
+ export declare const base64AssetExtensions: ReadonlyArray<string>;
32
+ /**
33
+ * Other source file extensions that are not JS/TS, including JSON, CSS, SCSS, and WASM,
34
+ * but not HTML or media/font files.
35
+ */
36
+ export declare const nonJsSourceExtensions: ReadonlyArray<string>;
37
+ /**
38
+ * Text file extensions which don't require further processing before display.
39
+ */
40
+ export declare const textExtensions: ReadonlyArray<string>;
41
+ /**
42
+ * Matches all TypeScript and JavaScript source files. The match only includes the `.ext` part.
43
+ */
44
+ export declare const sourceRegex: RegExp;
45
+ /**
46
+ * Matches only JS/TS files with an explicit CJS extension. The match only includes the `.ext` part.
47
+ */
48
+ export declare const cjsSourceRegex: RegExp;
49
+ /**
50
+ * Matches only JS/TS files with an explicit ESM extension. The match only includes the `.ext` part.
51
+ */
52
+ export declare const esmSourceRegex: RegExp;
53
+ /**
54
+ * Matches all TypeScript source files. The match only includes the `.ext` part.
55
+ */
56
+ export declare const typescriptRegex: RegExp;
57
+ /**
58
+ * Matches all JavaScript source files. The match only includes the `.ext` part.
59
+ */
60
+ export declare const javascriptRegex: RegExp;
61
+ /**
62
+ * Matches JSX (`[cm]?jsx`) source files only. The match only includes the `.ext` part.
63
+ */
64
+ export declare const jsxRegex: RegExp;
65
+ /**
66
+ * Matches non-JSX JavaScript files. The match only includes the `.ext` part.
67
+ */
68
+ export declare const plainJsRegex: RegExp;
69
+ /**
70
+ * Matches files which must be transpiled: all TS files, plus JSX. The match only includes the `.ext` part.
71
+ */
72
+ export declare const transpiledSourceRegex: RegExp;
20
73
  //# sourceMappingURL=sourceExtensions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceExtensions.d.ts","sourceRoot":"","sources":["../src/sourceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAqD,CAAC;AAE7G;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAqD,CAAC;AAE7G;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAsD,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,MAAM,CAAuD,CAAC"}
1
+ {"version":3,"file":"sourceExtensions.d.ts","sourceRoot":"","sources":["../src/sourceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAqD,CAAC;AAE7G;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAqD,CAAC;AAE7G;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAA2B,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAsD,CAAC;AAE1G;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,MAAM,CAAuD,CAAC;AAExG;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,MAAM,CAAkD,CAAC;AAEnG;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAmBvD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAgD,CAAC;AAEzG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,MAAM,CAA6B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,WAAW,QAAqB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,cAAc,QAAiB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,cAAc,QAAiB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,eAAe,QAAkB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,QAAkB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,QAAQ,QAAiB,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,YAAY,QAAgB,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAA0B,CAAC"}
@@ -8,6 +8,10 @@ export const typescriptExtensions = ['.tsx', '.ts', '.mtsx', '.mts', '.ctsx', '.
8
8
  * (Does not include `.json`.)
9
9
  */
10
10
  export const javascriptExtensions = ['.mjsx', '.mjs', '.jsx', '.js', '.cjsx', '.cjs'];
11
+ /**
12
+ * All valid non-JSX JavaScript file extensions.
13
+ */
14
+ export const plainJsExtensions = ['.js', '.mjs', '.cjs'];
11
15
  /**
12
16
  * All valid TypeScript and JavaScript source file extensions.
13
17
  * (Does not include `.json`.)
@@ -17,4 +21,72 @@ export const sourceExtensions = [...typescriptExtensions, ...javascriptExtension
17
21
  * All valid JSX/TSX source file extensions.
18
22
  */
19
23
  export const jsxExtensions = sourceExtensions.filter((ext) => ext.endsWith('x'));
24
+ /**
25
+ * Web extensions for `resolve-web-extensions` capability (the most common JS and TS extensions with `.web` prefix).
26
+ */
27
+ export const webExtensions = ['.web.tsx', '.web.ts', '.web.jsx', '.web.js'];
28
+ /**
29
+ * Supported media and font file extensions.
30
+ */
31
+ export const base64AssetExtensions = [
32
+ '.aac',
33
+ '.avif',
34
+ '.bmp',
35
+ '.eot',
36
+ '.gif',
37
+ '.jpeg',
38
+ '.jpg',
39
+ '.mp3',
40
+ '.mp4',
41
+ '.ogg',
42
+ '.otf',
43
+ '.png',
44
+ '.svg',
45
+ '.ttf',
46
+ '.wav',
47
+ '.webp',
48
+ '.woff',
49
+ '.woff2',
50
+ ];
51
+ /**
52
+ * Other source file extensions that are not JS/TS, including JSON, CSS, SCSS, and WASM,
53
+ * but not HTML or media/font files.
54
+ */
55
+ export const nonJsSourceExtensions = ['.json', '.css', '.scss', '.sass', '.wasm'];
56
+ /**
57
+ * Text file extensions which don't require further processing before display.
58
+ */
59
+ export const textExtensions = ['.htm', '.html', '.txt'];
60
+ /**
61
+ * Matches all TypeScript and JavaScript source files. The match only includes the `.ext` part.
62
+ */
63
+ export const sourceRegex = /\.[cm]?[jt]sx?$/i;
64
+ /**
65
+ * Matches only JS/TS files with an explicit CJS extension. The match only includes the `.ext` part.
66
+ */
67
+ export const cjsSourceRegex = /\.c[jt]sx?$/i;
68
+ /**
69
+ * Matches only JS/TS files with an explicit ESM extension. The match only includes the `.ext` part.
70
+ */
71
+ export const esmSourceRegex = /\.m[jt]sx?$/i;
72
+ /**
73
+ * Matches all TypeScript source files. The match only includes the `.ext` part.
74
+ */
75
+ export const typescriptRegex = /\.[cm]?tsx?$/i;
76
+ /**
77
+ * Matches all JavaScript source files. The match only includes the `.ext` part.
78
+ */
79
+ export const javascriptRegex = /\.[cm]?jsx?$/i;
80
+ /**
81
+ * Matches JSX (`[cm]?jsx`) source files only. The match only includes the `.ext` part.
82
+ */
83
+ export const jsxRegex = /\.[cm]?jsx$/i;
84
+ /**
85
+ * Matches non-JSX JavaScript files. The match only includes the `.ext` part.
86
+ */
87
+ export const plainJsRegex = /\.[cm]?js$/i;
88
+ /**
89
+ * Matches files which must be transpiled: all TS files, plus JSX. The match only includes the `.ext` part.
90
+ */
91
+ export const transpiledSourceRegex = /\.[cm]?(?:tsx?|jsx)$/i;
20
92
  //# sourceMappingURL=sourceExtensions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceExtensions.js","sourceRoot":"","sources":["../src/sourceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7G;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7G;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,GAAG,oBAAoB,EAAE,GAAG,oBAAoB,CAAC,CAAC;AAE1G;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["/**\n * All valid TypeScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const typescriptExtensions: ReadonlyArray<string> = ['.tsx', '.ts', '.mtsx', '.mts', '.ctsx', '.cts'];\n\n/**\n * All valid JavaScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const javascriptExtensions: ReadonlyArray<string> = ['.mjsx', '.mjs', '.jsx', '.js', '.cjsx', '.cjs'];\n\n/**\n * All valid TypeScript and JavaScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const sourceExtensions: ReadonlyArray<string> = [...typescriptExtensions, ...javascriptExtensions];\n\n/**\n * All valid JSX/TSX source file extensions.\n */\nexport const jsxExtensions: ReadonlyArray<string> = sourceExtensions.filter((ext) => ext.endsWith('x'));\n"]}
1
+ {"version":3,"file":"sourceExtensions.js","sourceRoot":"","sources":["../src/sourceExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7G;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7G;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,GAAG,oBAAoB,EAAE,GAAG,oBAAoB,CAAC,CAAC;AAE1G;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAExG;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEzG;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA0B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC","sourcesContent":["/**\n * All valid TypeScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const typescriptExtensions: ReadonlyArray<string> = ['.tsx', '.ts', '.mtsx', '.mts', '.ctsx', '.cts'];\n\n/**\n * All valid JavaScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const javascriptExtensions: ReadonlyArray<string> = ['.mjsx', '.mjs', '.jsx', '.js', '.cjsx', '.cjs'];\n\n/**\n * All valid non-JSX JavaScript file extensions.\n */\nexport const plainJsExtensions: ReadonlyArray<string> = ['.js', '.mjs', '.cjs'];\n\n/**\n * All valid TypeScript and JavaScript source file extensions.\n * (Does not include `.json`.)\n */\nexport const sourceExtensions: ReadonlyArray<string> = [...typescriptExtensions, ...javascriptExtensions];\n\n/**\n * All valid JSX/TSX source file extensions.\n */\nexport const jsxExtensions: ReadonlyArray<string> = sourceExtensions.filter((ext) => ext.endsWith('x'));\n\n/**\n * Web extensions for `resolve-web-extensions` capability (the most common JS and TS extensions with `.web` prefix).\n */\nexport const webExtensions: ReadonlyArray<string> = ['.web.tsx', '.web.ts', '.web.jsx', '.web.js'];\n\n/**\n * Supported media and font file extensions.\n */\nexport const base64AssetExtensions: ReadonlyArray<string> = [\n '.aac',\n '.avif',\n '.bmp',\n '.eot',\n '.gif',\n '.jpeg',\n '.jpg',\n '.mp3',\n '.mp4',\n '.ogg',\n '.otf',\n '.png',\n '.svg',\n '.ttf',\n '.wav',\n '.webp',\n '.woff',\n '.woff2',\n];\n\n/**\n * Other source file extensions that are not JS/TS, including JSON, CSS, SCSS, and WASM,\n * but not HTML or media/font files.\n */\nexport const nonJsSourceExtensions: ReadonlyArray<string> = ['.json', '.css', '.scss', '.sass', '.wasm'];\n\n/**\n * Text file extensions which don't require further processing before display.\n */\nexport const textExtensions: ReadonlyArray<string> = ['.htm', '.html', '.txt'];\n\n/**\n * Matches all TypeScript and JavaScript source files. The match only includes the `.ext` part.\n */\nexport const sourceRegex = /\\.[cm]?[jt]sx?$/i;\n\n/**\n * Matches only JS/TS files with an explicit CJS extension. The match only includes the `.ext` part.\n */\nexport const cjsSourceRegex = /\\.c[jt]sx?$/i;\n\n/**\n * Matches only JS/TS files with an explicit ESM extension. The match only includes the `.ext` part.\n */\nexport const esmSourceRegex = /\\.m[jt]sx?$/i;\n\n/**\n * Matches all TypeScript source files. The match only includes the `.ext` part.\n */\nexport const typescriptRegex = /\\.[cm]?tsx?$/i;\n\n/**\n * Matches all JavaScript source files. The match only includes the `.ext` part.\n */\nexport const javascriptRegex = /\\.[cm]?jsx?$/i;\n\n/**\n * Matches JSX (`[cm]?jsx`) source files only. The match only includes the `.ext` part.\n */\nexport const jsxRegex = /\\.[cm]?jsx$/i;\n\n/**\n * Matches non-JSX JavaScript files. The match only includes the `.ext` part.\n */\nexport const plainJsRegex = /\\.[cm]?js$/i;\n\n/**\n * Matches files which must be transpiled: all TS files, plus JSX. The match only includes the `.ext` part.\n */\nexport const transpiledSourceRegex = /\\.[cm]?(?:tsx?|jsx)$/i;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sourceFilesGlobs.d.ts","sourceRoot":"","sources":["../src/sourceFilesGlobs.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAiF,CAAC;AAE/G;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAA0B,CAAC"}
1
+ {"version":3,"file":"sourceFilesGlobs.d.ts","sourceRoot":"","sources":["../src/sourceFilesGlobs.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,UAAiF,CAAC;AAE/G;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAA0B,CAAC"}
@@ -6,6 +6,7 @@ const sourceExtensionsGlob = `**/*.{${sourceExtensions.map((ext) => ext.slice(1)
6
6
  * Other file extensions to watch.
7
7
  * These are not source files, but might affect the bundle output.
8
8
  */
9
+ // TODO this should be unified with sourceExtensions lists, but it could change hashes
9
10
  const otherExtensionsGlob = `**/*.{json,css,scss,sass,graphql,htm,html,txt,md,mdx}`;
10
11
  /**
11
12
  * All valid source file globs.
@@ -1 +1 @@
1
- {"version":3,"file":"sourceFilesGlobs.js","sourceRoot":"","sources":["../src/sourceFilesGlobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,UAAU,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAExF,MAAM,kBAAkB,GAAG,CAAC,QAAQ,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE3F,MAAM,oBAAoB,GAAG,SAAS,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAE/F;;;GAGG;AACH,MAAM,mBAAmB,GAAG,uDAAuD,CAAC;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,kBAAkB,CAAC,CAAC;AAE/G;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { sourceExtensions } from './sourceExtensions.js';\n\nconst ignoreDirs = ['node_modules', 'dist', 'build', 'out', 'test', 'tests', '__test*'];\n\nconst defaultIgnorePaths = [`!**/{${ignoreDirs.join(',')}}/**`, '!**/*.{test.*,d.ts,map}'];\n\nconst sourceExtensionsGlob = `**/*.{${sourceExtensions.map((ext) => ext.slice(1)).join(',')}}`;\n\n/**\n * Other file extensions to watch.\n * These are not source files, but might affect the bundle output.\n */\nconst otherExtensionsGlob = `**/*.{json,css,scss,sass,graphql,htm,html,txt,md,mdx}`;\n\n/**\n * All valid source file globs.\n * Used for file watching and hashing of internal packages.\n */\nexport const sourceFilesGlobs = ['src/**/*', sourceExtensionsGlob, otherExtensionsGlob, ...defaultIgnorePaths];\n\n/**\n * Negated globs for paths (such as `node_modules`) that should always be excluded from source\n * files regardless of user settings.\n */\nexport const alwaysExcludeGlobs = ['!**/node_modules/**'];\n"]}
1
+ {"version":3,"file":"sourceFilesGlobs.js","sourceRoot":"","sources":["../src/sourceFilesGlobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,UAAU,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAExF,MAAM,kBAAkB,GAAG,CAAC,QAAQ,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;AAE3F,MAAM,oBAAoB,GAAG,SAAS,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAE/F;;;GAGG;AACH,sFAAsF;AACtF,MAAM,mBAAmB,GAAG,uDAAuD,CAAC;AAEpF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,kBAAkB,CAAC,CAAC;AAE/G;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["import { sourceExtensions } from './sourceExtensions.js';\n\nconst ignoreDirs = ['node_modules', 'dist', 'build', 'out', 'test', 'tests', '__test*'];\n\nconst defaultIgnorePaths = [`!**/{${ignoreDirs.join(',')}}/**`, '!**/*.{test.*,d.ts,map}'];\n\nconst sourceExtensionsGlob = `**/*.{${sourceExtensions.map((ext) => ext.slice(1)).join(',')}}`;\n\n/**\n * Other file extensions to watch.\n * These are not source files, but might affect the bundle output.\n */\n// TODO this should be unified with sourceExtensions lists, but it could change hashes\nconst otherExtensionsGlob = `**/*.{json,css,scss,sass,graphql,htm,html,txt,md,mdx}`;\n\n/**\n * All valid source file globs.\n * Used for file watching and hashing of internal packages.\n */\nexport const sourceFilesGlobs = ['src/**/*', sourceExtensionsGlob, otherExtensionsGlob, ...defaultIgnorePaths];\n\n/**\n * Negated globs for paths (such as `node_modules`) that should always be excluded from source\n * files regardless of user settings.\n */\nexport const alwaysExcludeGlobs = ['!**/node_modules/**'];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/path-utilities",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Path utilities for Cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,14 +24,14 @@
24
24
  "test": "cloudpack-scripts test"
25
25
  },
26
26
  "dependencies": {
27
- "@ms-cloudpack/path-string-parsing": "^1.2.7",
27
+ "@ms-cloudpack/path-string-parsing": "^1.3.0",
28
28
  "import-meta-resolve": "^4.1.0",
29
29
  "resolve": "^1.22.0",
30
30
  "tinyglobby": "^0.2.13",
31
31
  "workspace-tools": "^0.38.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@ms-cloudpack/common-types": "^0.33.0",
34
+ "@ms-cloudpack/common-types": "^0.33.2",
35
35
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
36
36
  "@ms-cloudpack/scripts": "^0.0.1",
37
37
  "@ms-cloudpack/test-utilities": "^0.5.0"