@qualcomm-ui/mdx-vite 2.17.1 → 2.17.2
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/dist/cli.js +62 -59
- package/dist/cli.js.map +3 -3
- package/dist/docs-plugin/internal/search-indexer.d.ts.map +1 -1
- package/dist/docs-plugin/internal/services/markdown/markdown-file-reader.d.ts +4 -4
- package/dist/docs-plugin/internal/services/markdown/markdown-file-reader.d.ts.map +1 -1
- package/dist/index.js +63 -60
- package/dist/index.js.map +3 -3
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/search-indexer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EAEP,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB,OAAO,
|
|
1
|
+
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/search-indexer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EAEP,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAEL,KAAK,eAAe,EAEpB,eAAe,EAQf,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,YAAY,CAAA;AAInB,qBAAa,aAAa;IA4Cf,MAAM,EAAE,oBAAoB;IAC5B,WAAW;IA5CpB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CA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-
*
|
|
11
|
-
*
|
|
12
|
-
* unavailable.
|
|
10
|
+
* Runs a single git log command to collect the last commit metadata for all
|
|
11
|
+
* MDX files under srcDir. Returns a map keyed by absolute file path.
|
|
13
12
|
*/
|
|
14
|
-
export declare function
|
|
13
|
+
export declare function buildGitMetadataMap(srcDir: string, mode: PageTimestampMetadataMode): Map<string, GitMetadata>;
|
|
15
14
|
interface PageCache {
|
|
16
15
|
frontmatter: PageFrontmatter;
|
|
17
16
|
md5: string;
|
|
@@ -23,6 +22,7 @@ export declare class MarkdownFileReader {
|
|
|
23
22
|
enabled: boolean;
|
|
24
23
|
pageTimestampMetadata: PageTimestampMetadataMode;
|
|
25
24
|
cachedFileCount: number;
|
|
25
|
+
gitMetadataMap: Map<string, GitMetadata>;
|
|
26
26
|
logWarnings: boolean;
|
|
27
27
|
private mdxCache;
|
|
28
28
|
constructor(enabled: boolean, pageTimestampMetadata?: PageTimestampMetadataMode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file-reader.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown-file-reader.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,gBAAgB,CAAA;AAG7D,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAEjE,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;
|
|
1
|
+
{"version":3,"file":"markdown-file-reader.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown-file-reader.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,C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IA+ED,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAChC,IAAI;CAKR"}
|
package/dist/index.js
CHANGED
|
@@ -3490,7 +3490,7 @@ import { watch } from "chokidar";
|
|
|
3490
3490
|
import { glob as glob2 } from "glob";
|
|
3491
3491
|
import { existsSync, statSync } from "node:fs";
|
|
3492
3492
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
3493
|
-
import { basename as basename3, dirname as dirname4, join as join7, relative as
|
|
3493
|
+
import { basename as basename3, dirname as dirname4, join as join7, relative as relative2, resolve as resolve6 } from "node:path";
|
|
3494
3494
|
import {
|
|
3495
3495
|
createHighlighter
|
|
3496
3496
|
} from "shiki";
|
|
@@ -3505,7 +3505,7 @@ import chalk4 from "chalk";
|
|
|
3505
3505
|
import chokidar from "chokidar";
|
|
3506
3506
|
import { glob } from "glob";
|
|
3507
3507
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
3508
|
-
import { join as join6, resolve as
|
|
3508
|
+
import { join as join6, resolve as resolve5 } from "node:path";
|
|
3509
3509
|
import prettyMilliseconds from "pretty-ms";
|
|
3510
3510
|
|
|
3511
3511
|
// ../../../node_modules/.pnpm/@commander-js+extra-typings@14.0.0_commander@14.0.2/node_modules/@commander-js/extra-typings/esm.mjs
|
|
@@ -3968,43 +3968,41 @@ import chalk from "chalk";
|
|
|
3968
3968
|
import { execSync } from "node:child_process";
|
|
3969
3969
|
import { createHash } from "node:crypto";
|
|
3970
3970
|
import { readFileSync } from "node:fs";
|
|
3971
|
-
import {
|
|
3971
|
+
import { resolve } from "node:path";
|
|
3972
3972
|
import remarkFrontmatter from "remark-frontmatter";
|
|
3973
3973
|
import remarkParse2 from "remark-parse";
|
|
3974
3974
|
import remarkParseFrontmatter from "remark-parse-frontmatter";
|
|
3975
3975
|
import remarkStringify2 from "remark-stringify";
|
|
3976
3976
|
import { unified as unified2 } from "unified";
|
|
3977
|
-
function
|
|
3978
|
-
|
|
3979
|
-
encoding: "utf-8"
|
|
3980
|
-
}).trim();
|
|
3981
|
-
}
|
|
3982
|
-
function getGitMetadata(filePath, mode) {
|
|
3977
|
+
function buildGitMetadataMap(srcDir, mode) {
|
|
3978
|
+
const map = /* @__PURE__ */ new Map();
|
|
3983
3979
|
if (mode === "off") {
|
|
3984
|
-
return
|
|
3980
|
+
return map;
|
|
3985
3981
|
}
|
|
3986
3982
|
try {
|
|
3987
|
-
const repoRoot =
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
const
|
|
3991
|
-
|
|
3992
|
-
{
|
|
3993
|
-
|
|
3994
|
-
|
|
3983
|
+
const repoRoot = execSync("git rev-parse --show-toplevel", {
|
|
3984
|
+
encoding: "utf-8"
|
|
3985
|
+
}).trim();
|
|
3986
|
+
const format = mode === "user-and-timestamp" ? "%cI%x09%aN" : "%cI";
|
|
3987
|
+
const output = execSync(
|
|
3988
|
+
`git log --format="COMMIT%x09${format}" --name-only -- "${srcDir}/**/*.mdx"`,
|
|
3989
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
3990
|
+
);
|
|
3991
|
+
let currentMetadata = {};
|
|
3992
|
+
for (const line of output.split("\n")) {
|
|
3993
|
+
if (line.startsWith("COMMIT ")) {
|
|
3994
|
+
const parts = line.split(" ");
|
|
3995
|
+
currentMetadata = mode === "user-and-timestamp" ? { updatedBy: parts[2], updatedOn: parts[1] } : { updatedOn: parts[1] };
|
|
3996
|
+
} else if (line.trim()) {
|
|
3997
|
+
const absolutePath = resolve(repoRoot, line.trim());
|
|
3998
|
+
if (!map.has(absolutePath)) {
|
|
3999
|
+
map.set(absolutePath, currentMetadata);
|
|
4000
|
+
}
|
|
3995
4001
|
}
|
|
3996
|
-
).trim();
|
|
3997
|
-
if (!result) {
|
|
3998
|
-
return {};
|
|
3999
4002
|
}
|
|
4000
|
-
if (mode === "user-and-timestamp") {
|
|
4001
|
-
const [updatedOn, updatedBy] = result.split("\n");
|
|
4002
|
-
return { updatedBy, updatedOn };
|
|
4003
|
-
}
|
|
4004
|
-
return { updatedOn: result };
|
|
4005
4003
|
} catch {
|
|
4006
|
-
return {};
|
|
4007
4004
|
}
|
|
4005
|
+
return map;
|
|
4008
4006
|
}
|
|
4009
4007
|
var MarkdownFileReader = class {
|
|
4010
4008
|
constructor(enabled, pageTimestampMetadata = "off") {
|
|
@@ -4012,6 +4010,7 @@ var MarkdownFileReader = class {
|
|
|
4012
4010
|
this.pageTimestampMetadata = pageTimestampMetadata;
|
|
4013
4011
|
}
|
|
4014
4012
|
cachedFileCount = 0;
|
|
4013
|
+
gitMetadataMap = /* @__PURE__ */ new Map();
|
|
4015
4014
|
logWarnings = true;
|
|
4016
4015
|
mdxCache = {};
|
|
4017
4016
|
hash(input) {
|
|
@@ -4078,7 +4077,7 @@ var MarkdownFileReader = class {
|
|
|
4078
4077
|
const existingCache = this.mdxCache[filepath];
|
|
4079
4078
|
const shouldFetchGitMetadata = !this.enabled || !existingCache;
|
|
4080
4079
|
if (shouldFetchGitMetadata) {
|
|
4081
|
-
const gitMetadata =
|
|
4080
|
+
const gitMetadata = this.gitMetadataMap.get(filepath) ?? {};
|
|
4082
4081
|
if (!frontmatter.updatedOn && gitMetadata.updatedOn) {
|
|
4083
4082
|
frontmatter.updatedOn = gitMetadata.updatedOn;
|
|
4084
4083
|
}
|
|
@@ -5385,6 +5384,10 @@ var SearchIndexer = class {
|
|
|
5385
5384
|
this.config.routingStrategy
|
|
5386
5385
|
);
|
|
5387
5386
|
this._mdxFileCount = mdxFileGlob.length;
|
|
5387
|
+
this.fileCache.gitMetadataMap = buildGitMetadataMap(
|
|
5388
|
+
this.config.srcDir,
|
|
5389
|
+
this.fileCache.pageTimestampMetadata
|
|
5390
|
+
);
|
|
5388
5391
|
const compiledFiles = mdxFileGlob.map((file) => this.compileMdxFile(file));
|
|
5389
5392
|
const mdxIndex = compiledFiles.map((fileData) => fileData.pageSections).flat();
|
|
5390
5393
|
filterFileGlob(
|
|
@@ -5404,7 +5407,7 @@ import AdmZip from "adm-zip";
|
|
|
5404
5407
|
import chalk3 from "chalk";
|
|
5405
5408
|
import { minimatch } from "minimatch";
|
|
5406
5409
|
import { mkdir, readdir, readFile as readFile4, rm, stat, writeFile } from "node:fs/promises";
|
|
5407
|
-
import { basename as basename2, dirname as dirname3, join as join5, relative
|
|
5410
|
+
import { basename as basename2, dirname as dirname3, join as join5, relative, resolve as resolve4 } from "node:path";
|
|
5408
5411
|
import remarkFrontmatter2 from "remark-frontmatter";
|
|
5409
5412
|
import remarkMdx3 from "remark-mdx";
|
|
5410
5413
|
import remarkParse4 from "remark-parse";
|
|
@@ -5435,7 +5438,7 @@ import { kebabCase } from "@qualcomm-ui/utils/change-case";
|
|
|
5435
5438
|
// src/ai-knowledge/generator/utils.ts
|
|
5436
5439
|
import { createHash as createHash2 } from "node:crypto";
|
|
5437
5440
|
import { access, readFile } from "node:fs/promises";
|
|
5438
|
-
import { dirname, join as join2, resolve } from "node:path";
|
|
5441
|
+
import { dirname, join as join2, resolve as resolve2 } from "node:path";
|
|
5439
5442
|
import ts from "typescript";
|
|
5440
5443
|
async function exists(dirPath) {
|
|
5441
5444
|
return access(dirPath).then(() => true).catch(() => false);
|
|
@@ -5481,7 +5484,7 @@ function extractRelativeImports(content) {
|
|
|
5481
5484
|
}
|
|
5482
5485
|
async function resolveModulePath(importPath, fromFile) {
|
|
5483
5486
|
const fromDir = dirname(fromFile);
|
|
5484
|
-
const baseResolved =
|
|
5487
|
+
const baseResolved = resolve2(fromDir, importPath);
|
|
5485
5488
|
const extensions = [".ts", ".tsx", ".js", ".jsx", ""];
|
|
5486
5489
|
for (const ext of extensions) {
|
|
5487
5490
|
const fullPath = baseResolved + ext;
|
|
@@ -5649,7 +5652,7 @@ function formatDemos(demosFolder) {
|
|
|
5649
5652
|
|
|
5650
5653
|
// src/ai-knowledge/generator/doc-props-plugin.ts
|
|
5651
5654
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
5652
|
-
import { dirname as dirname2, join as join4, resolve as
|
|
5655
|
+
import { dirname as dirname2, join as join4, resolve as resolve3 } from "node:path";
|
|
5653
5656
|
import { visit as visit7 } from "unist-util-visit";
|
|
5654
5657
|
function extractBestType(propInfo) {
|
|
5655
5658
|
const type = propInfo.resolvedType?.prettyType || propInfo.type;
|
|
@@ -5693,7 +5696,7 @@ var PropFormatter = class {
|
|
|
5693
5696
|
return this.docProps;
|
|
5694
5697
|
}
|
|
5695
5698
|
const config2 = getConfig();
|
|
5696
|
-
const resolvedDocPropsPath = config2.docPropsPath ? await exists(config2.docPropsPath) ? config2.docPropsPath :
|
|
5699
|
+
const resolvedDocPropsPath = config2.docPropsPath ? await exists(config2.docPropsPath) ? config2.docPropsPath : resolve3(process.cwd(), config2.docPropsPath) : join4(dirname2(config2.routeDir), "doc-props.json");
|
|
5697
5700
|
if (!await exists(resolvedDocPropsPath)) {
|
|
5698
5701
|
if (config2.verbose) {
|
|
5699
5702
|
console.log(`Doc props file not found at: ${resolvedDocPropsPath}`);
|
|
@@ -6296,7 +6299,7 @@ var KnowledgeGenerator = class {
|
|
|
6296
6299
|
if (excludePatterns.length === 0) {
|
|
6297
6300
|
return false;
|
|
6298
6301
|
}
|
|
6299
|
-
const relativePath =
|
|
6302
|
+
const relativePath = relative(this.config.routeDir, absolutePath);
|
|
6300
6303
|
return excludePatterns.some(
|
|
6301
6304
|
(pattern) => minimatch(relativePath, pattern, { matchBase: true })
|
|
6302
6305
|
);
|
|
@@ -6305,7 +6308,7 @@ var KnowledgeGenerator = class {
|
|
|
6305
6308
|
if (shouldExclude(dirPath)) {
|
|
6306
6309
|
if (this.config.verbose) {
|
|
6307
6310
|
console.log(
|
|
6308
|
-
`Excluding directory: ${
|
|
6311
|
+
`Excluding directory: ${relative(this.config.routeDir, dirPath)}`
|
|
6309
6312
|
);
|
|
6310
6313
|
}
|
|
6311
6314
|
return;
|
|
@@ -6543,7 +6546,7 @@ var KnowledgeGenerator = class {
|
|
|
6543
6546
|
lines.push("");
|
|
6544
6547
|
const fileContent = lines.join("\n");
|
|
6545
6548
|
const fileName = `${kebabCase3(extraFile.id)}.md`;
|
|
6546
|
-
const outfile = `${
|
|
6549
|
+
const outfile = `${resolve4(this.config.outputPath)}/${fileName}`;
|
|
6547
6550
|
await writeFile(outfile, fileContent, "utf-8");
|
|
6548
6551
|
const stats = await stat(outfile);
|
|
6549
6552
|
totalSize += stats.size / 1024;
|
|
@@ -6646,7 +6649,7 @@ var KnowledgeGenerator = class {
|
|
|
6646
6649
|
lines.push("");
|
|
6647
6650
|
const fileContent = lines.join("\n");
|
|
6648
6651
|
const fileName = `${kebabCase3(page.id || page.name)}.md`;
|
|
6649
|
-
const outfile = `${
|
|
6652
|
+
const outfile = `${resolve4(this.config.outputPath)}/${fileName}`;
|
|
6650
6653
|
await writeFile(outfile, fileContent, "utf-8");
|
|
6651
6654
|
const stats = await stat(outfile);
|
|
6652
6655
|
totalSize += stats.size / 1024;
|
|
@@ -6830,12 +6833,12 @@ var PluginState = class {
|
|
|
6830
6833
|
createIndexer(config2) {
|
|
6831
6834
|
this.config = config2;
|
|
6832
6835
|
this.configFilePath = config2.filePath;
|
|
6833
|
-
this.docPropsFilePath = config2.typeDocProps ? fixPath(
|
|
6834
|
-
this.routesDir = fixPath(
|
|
6836
|
+
this.docPropsFilePath = config2.typeDocProps ? fixPath(resolve5(this.cwd, config2.typeDocProps)) : "";
|
|
6837
|
+
this.routesDir = fixPath(resolve5(config2.appDirectory, config2.pageDirectory));
|
|
6835
6838
|
this.knowledgeConfig = config2.knowledge;
|
|
6836
6839
|
this.indexer = new SearchIndexer({
|
|
6837
6840
|
...config2,
|
|
6838
|
-
srcDir: fixPath(
|
|
6841
|
+
srcDir: fixPath(resolve5(this.cwd, config2.appDirectory)),
|
|
6839
6842
|
typeDocProps: this.resolveDocProps()
|
|
6840
6843
|
});
|
|
6841
6844
|
const exportsConfig = config2.knowledge?.global?.exports;
|
|
@@ -8643,7 +8646,7 @@ function angularDemoPlugin({
|
|
|
8643
8646
|
return null;
|
|
8644
8647
|
}
|
|
8645
8648
|
const demoId = componentClass;
|
|
8646
|
-
const importPath =
|
|
8649
|
+
const importPath = relative2(process.cwd(), filePath).replace(/\\/g, "/");
|
|
8647
8650
|
const fileName = basename3(filePath);
|
|
8648
8651
|
const importsWithoutStrip = stripImports(code, filePath);
|
|
8649
8652
|
const sourceCode = [];
|
|
@@ -8937,7 +8940,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8937
8940
|
}
|
|
8938
8941
|
function resolveRelativeImport2(source, fromFile) {
|
|
8939
8942
|
const fromDir = dirname4(fromFile);
|
|
8940
|
-
const resolved =
|
|
8943
|
+
const resolved = resolve6(fromDir, source);
|
|
8941
8944
|
const extensions = [".ts", ".js"];
|
|
8942
8945
|
for (const ext of extensions) {
|
|
8943
8946
|
const withExt = resolved + ext;
|
|
@@ -8975,7 +8978,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8975
8978
|
}
|
|
8976
8979
|
const paths = parseResult.config?.compilerOptions?.paths;
|
|
8977
8980
|
const baseUrl = parseResult.config?.compilerOptions?.baseUrl || "./";
|
|
8978
|
-
const resolvedBaseUrl =
|
|
8981
|
+
const resolvedBaseUrl = resolve6(currentDir, baseUrl);
|
|
8979
8982
|
if (paths) {
|
|
8980
8983
|
for (const [alias, targets] of Object.entries(paths)) {
|
|
8981
8984
|
if (Array.isArray(targets) && targets.length > 0) {
|
|
@@ -8983,7 +8986,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8983
8986
|
const pattern = new RegExp(
|
|
8984
8987
|
`^${alias.replace("*", "(.*)").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace("\\(\\*\\)", "(.*)")}$`
|
|
8985
8988
|
);
|
|
8986
|
-
const replacement =
|
|
8989
|
+
const replacement = resolve6(
|
|
8987
8990
|
resolvedBaseUrl,
|
|
8988
8991
|
target.replace("*", "$1")
|
|
8989
8992
|
);
|
|
@@ -8993,7 +8996,7 @@ export function getAngularDemoInfo(demoId) {
|
|
|
8993
8996
|
}
|
|
8994
8997
|
const extendsPath = parseResult.config?.extends;
|
|
8995
8998
|
if (extendsPath) {
|
|
8996
|
-
const resolvedExtends =
|
|
8999
|
+
const resolvedExtends = resolve6(currentDir, extendsPath);
|
|
8997
9000
|
const extendedAliases = loadTsConfigPathsFromFile(resolvedExtends);
|
|
8998
9001
|
pathAliases.push(...extendedAliases);
|
|
8999
9002
|
}
|
|
@@ -9088,7 +9091,7 @@ function loadTsConfigPathsFromFile(tsconfigPath) {
|
|
|
9088
9091
|
}
|
|
9089
9092
|
const paths = parseResult.config?.compilerOptions?.paths;
|
|
9090
9093
|
const baseUrl = parseResult.config?.compilerOptions?.baseUrl || "./";
|
|
9091
|
-
const resolvedBaseUrl =
|
|
9094
|
+
const resolvedBaseUrl = resolve6(configDir, baseUrl);
|
|
9092
9095
|
if (paths) {
|
|
9093
9096
|
for (const [alias, targets] of Object.entries(paths)) {
|
|
9094
9097
|
if (Array.isArray(targets) && targets.length > 0) {
|
|
@@ -9096,7 +9099,7 @@ function loadTsConfigPathsFromFile(tsconfigPath) {
|
|
|
9096
9099
|
const pattern = new RegExp(
|
|
9097
9100
|
`^${alias.replace("*", "(.*)").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace("\\(\\*\\)", "(.*)")}$`
|
|
9098
9101
|
);
|
|
9099
|
-
const replacement =
|
|
9102
|
+
const replacement = resolve6(
|
|
9100
9103
|
resolvedBaseUrl,
|
|
9101
9104
|
target.replace("*", "$1")
|
|
9102
9105
|
);
|
|
@@ -9106,7 +9109,7 @@ function loadTsConfigPathsFromFile(tsconfigPath) {
|
|
|
9106
9109
|
}
|
|
9107
9110
|
const extendsPath = parseResult.config?.extends;
|
|
9108
9111
|
if (extendsPath) {
|
|
9109
|
-
let resolvedExtends =
|
|
9112
|
+
let resolvedExtends = resolve6(configDir, extendsPath);
|
|
9110
9113
|
if (!resolvedExtends.endsWith(".json")) {
|
|
9111
9114
|
resolvedExtends += ".json";
|
|
9112
9115
|
}
|
|
@@ -9147,7 +9150,7 @@ function resolvePathAlias(source, pathAliases) {
|
|
|
9147
9150
|
}
|
|
9148
9151
|
function resolveTemplateFile(templateUrl, fromFile) {
|
|
9149
9152
|
const fromDir = dirname4(fromFile);
|
|
9150
|
-
const resolved =
|
|
9153
|
+
const resolved = resolve6(fromDir, templateUrl);
|
|
9151
9154
|
if (existsSync(resolved)) {
|
|
9152
9155
|
return resolved;
|
|
9153
9156
|
}
|
|
@@ -9197,7 +9200,7 @@ var NODE_BUILTINS = [
|
|
|
9197
9200
|
import chalk6 from "chalk";
|
|
9198
9201
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
9199
9202
|
import { readFile as readFile7 } from "node:fs/promises";
|
|
9200
|
-
import { dirname as dirname5, join as join8, relative as
|
|
9203
|
+
import { dirname as dirname5, join as join8, relative as relative3, resolve as resolve7, sep } from "node:path";
|
|
9201
9204
|
import * as ts3 from "typescript";
|
|
9202
9205
|
import { pascalCase } from "@qualcomm-ui/utils/change-case";
|
|
9203
9206
|
function createDemoName(filePath) {
|
|
@@ -9320,7 +9323,7 @@ function extractSpecifiers(importClause) {
|
|
|
9320
9323
|
}
|
|
9321
9324
|
function resolveRelativeImport(source, fromFile) {
|
|
9322
9325
|
const fromDir = dirname5(fromFile);
|
|
9323
|
-
const resolved =
|
|
9326
|
+
const resolved = resolve7(fromDir, source);
|
|
9324
9327
|
const extensions = [".ts", ".tsx", ".js", ".jsx"];
|
|
9325
9328
|
for (const ext of extensions) {
|
|
9326
9329
|
const withExt = resolved + ext;
|
|
@@ -9364,7 +9367,7 @@ function loadTsConfigPaths(fromFile) {
|
|
|
9364
9367
|
}
|
|
9365
9368
|
const paths = parseResult.config?.compilerOptions?.paths;
|
|
9366
9369
|
const baseUrl = parseResult.config?.compilerOptions?.baseUrl || "./";
|
|
9367
|
-
const resolvedBaseUrl =
|
|
9370
|
+
const resolvedBaseUrl = resolve7(currentDir, baseUrl);
|
|
9368
9371
|
if (paths) {
|
|
9369
9372
|
for (const [alias, targets] of Object.entries(paths)) {
|
|
9370
9373
|
if (Array.isArray(targets) && targets.length > 0) {
|
|
@@ -9372,7 +9375,7 @@ function loadTsConfigPaths(fromFile) {
|
|
|
9372
9375
|
const pattern = new RegExp(
|
|
9373
9376
|
`^${alias.replace("*", "(.*)").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace("\\(\\*\\)", "(.*)")}$`
|
|
9374
9377
|
);
|
|
9375
|
-
const replacement =
|
|
9378
|
+
const replacement = resolve7(
|
|
9376
9379
|
resolvedBaseUrl,
|
|
9377
9380
|
target.replace("*", "$1")
|
|
9378
9381
|
);
|
|
@@ -9382,7 +9385,7 @@ function loadTsConfigPaths(fromFile) {
|
|
|
9382
9385
|
}
|
|
9383
9386
|
const extendsPath = parseResult.config?.extends;
|
|
9384
9387
|
if (extendsPath) {
|
|
9385
|
-
const resolvedExtends =
|
|
9388
|
+
const resolvedExtends = resolve7(currentDir, extendsPath);
|
|
9386
9389
|
const extendedAliases = loadTsConfigPathsFromFile2(resolvedExtends);
|
|
9387
9390
|
pathAliases.push(...extendedAliases);
|
|
9388
9391
|
}
|
|
@@ -9413,7 +9416,7 @@ function loadTsConfigPathsFromFile2(tsconfigPath) {
|
|
|
9413
9416
|
}
|
|
9414
9417
|
const paths = parseResult.config?.compilerOptions?.paths;
|
|
9415
9418
|
const baseUrl = parseResult.config?.compilerOptions?.baseUrl || "./";
|
|
9416
|
-
const resolvedBaseUrl =
|
|
9419
|
+
const resolvedBaseUrl = resolve7(configDir, baseUrl);
|
|
9417
9420
|
if (paths) {
|
|
9418
9421
|
for (const [alias, targets] of Object.entries(paths)) {
|
|
9419
9422
|
if (Array.isArray(targets) && targets.length > 0) {
|
|
@@ -9421,7 +9424,7 @@ function loadTsConfigPathsFromFile2(tsconfigPath) {
|
|
|
9421
9424
|
const pattern = new RegExp(
|
|
9422
9425
|
`^${alias.replace("*", "(.*)").replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace("\\(\\*\\)", "(.*)")}$`
|
|
9423
9426
|
);
|
|
9424
|
-
const replacement =
|
|
9427
|
+
const replacement = resolve7(
|
|
9425
9428
|
resolvedBaseUrl,
|
|
9426
9429
|
target.replace("*", "$1")
|
|
9427
9430
|
);
|
|
@@ -9431,7 +9434,7 @@ function loadTsConfigPathsFromFile2(tsconfigPath) {
|
|
|
9431
9434
|
}
|
|
9432
9435
|
const extendsPath = parseResult.config?.extends;
|
|
9433
9436
|
if (extendsPath) {
|
|
9434
|
-
let resolvedExtends =
|
|
9437
|
+
let resolvedExtends = resolve7(configDir, extendsPath);
|
|
9435
9438
|
if (!resolvedExtends.endsWith(".json")) {
|
|
9436
9439
|
resolvedExtends += ".json";
|
|
9437
9440
|
}
|
|
@@ -9471,7 +9474,7 @@ function resolvePathAlias2(source, pathAliases) {
|
|
|
9471
9474
|
return null;
|
|
9472
9475
|
}
|
|
9473
9476
|
function extractPageId(filePath, routesDir) {
|
|
9474
|
-
const relativePath =
|
|
9477
|
+
const relativePath = relative3(routesDir, filePath);
|
|
9475
9478
|
const pathParts = relativePath.split(sep);
|
|
9476
9479
|
if (pathParts.includes("demos")) {
|
|
9477
9480
|
const demosIndex = pathParts.indexOf("demos");
|
|
@@ -9494,7 +9497,7 @@ function isDemoFile(filePath) {
|
|
|
9494
9497
|
import chalk7 from "chalk";
|
|
9495
9498
|
import { glob as glob3 } from "glob";
|
|
9496
9499
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
9497
|
-
import { basename as basename4, resolve as
|
|
9500
|
+
import { basename as basename4, resolve as resolve8 } from "node:path";
|
|
9498
9501
|
import { createHighlighter as createHighlighter2 } from "shiki";
|
|
9499
9502
|
import * as ts4 from "typescript";
|
|
9500
9503
|
import {
|
|
@@ -9561,7 +9564,7 @@ function reactDemoPlugin({
|
|
|
9561
9564
|
if (isDemoFile(file)) {
|
|
9562
9565
|
await handleDemoAdditionOrUpdate({ filePath: file });
|
|
9563
9566
|
} else {
|
|
9564
|
-
const normalizedFile =
|
|
9567
|
+
const normalizedFile = resolve8(file);
|
|
9565
9568
|
const dependentDemos = relativeImportDependents.get(normalizedFile);
|
|
9566
9569
|
if (!dependentDemos?.size) {
|
|
9567
9570
|
return [];
|