@ts-for-gir/cli 4.0.0-rc.3 → 4.0.0-rc.4
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/bin/ts-for-gir +358 -148
- package/dist-templates/types-locally/.ts-for-girrc.js +6 -0
- package/dist-templates/types-locally/README.md +15 -0
- package/dist-templates/types-locally/esbuild.ts +10 -0
- package/dist-templates/types-locally/main.ts +21 -0
- package/dist-templates/types-locally/package.json +18 -0
- package/dist-templates/types-locally/tsconfig.json +17 -0
- package/dist-templates/types-npm/README.md +14 -0
- package/dist-templates/types-npm/esbuild.ts +10 -0
- package/dist-templates/types-npm/main.ts +19 -0
- package/dist-templates/types-npm/package.json +23 -0
- package/dist-templates/types-npm/tsconfig.json +15 -0
- package/dist-templates/types-workspace/.ts-for-girrc.js +12 -0
- package/dist-templates/types-workspace/README.md +26 -0
- package/dist-templates/types-workspace/package.json +22 -0
- package/dist-templates/types-workspace/packages/app/esbuild.ts +10 -0
- package/dist-templates/types-workspace/packages/app/main.ts +19 -0
- package/dist-templates/types-workspace/packages/app/package.json +23 -0
- package/dist-templates/types-workspace/packages/app/tsconfig.json +15 -0
- package/dist-templates/types-workspace/tsconfig.json +11 -0
- package/package.json +14 -11
- package/src/commands/create.ts +214 -0
- package/src/commands/index.ts +1 -0
- package/src/config/config-loader.ts +1 -0
- package/src/config/index.ts +9 -1
- package/src/config/options.ts +27 -0
- package/src/start.ts +2 -1
- package/src/types/command-args.ts +23 -0
package/bin/ts-for-gir
CHANGED
|
@@ -3346,7 +3346,7 @@ var require_lodash = __commonJS({
|
|
|
3346
3346
|
}
|
|
3347
3347
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
3348
3348
|
});
|
|
3349
|
-
function
|
|
3349
|
+
function join17(array, separator) {
|
|
3350
3350
|
return array == null ? "" : nativeJoin.call(array, separator);
|
|
3351
3351
|
}
|
|
3352
3352
|
function last(array) {
|
|
@@ -4304,7 +4304,7 @@ var require_lodash = __commonJS({
|
|
|
4304
4304
|
copyObject(source, keys(source), object, customizer);
|
|
4305
4305
|
});
|
|
4306
4306
|
var at = flatRest(baseAt);
|
|
4307
|
-
function
|
|
4307
|
+
function create2(prototype, properties) {
|
|
4308
4308
|
var result2 = baseCreate(prototype);
|
|
4309
4309
|
return properties == null ? result2 : baseAssign(result2, properties);
|
|
4310
4310
|
}
|
|
@@ -5056,7 +5056,7 @@ var require_lodash = __commonJS({
|
|
|
5056
5056
|
lodash2.conforms = conforms;
|
|
5057
5057
|
lodash2.constant = constant;
|
|
5058
5058
|
lodash2.countBy = countBy;
|
|
5059
|
-
lodash2.create =
|
|
5059
|
+
lodash2.create = create2;
|
|
5060
5060
|
lodash2.curry = curry;
|
|
5061
5061
|
lodash2.curryRight = curryRight;
|
|
5062
5062
|
lodash2.debounce = debounce;
|
|
@@ -5270,7 +5270,7 @@ var require_lodash = __commonJS({
|
|
|
5270
5270
|
lodash2.isUndefined = isUndefined;
|
|
5271
5271
|
lodash2.isWeakMap = isWeakMap;
|
|
5272
5272
|
lodash2.isWeakSet = isWeakSet;
|
|
5273
|
-
lodash2.join =
|
|
5273
|
+
lodash2.join = join17;
|
|
5274
5274
|
lodash2.kebabCase = kebabCase;
|
|
5275
5275
|
lodash2.last = last;
|
|
5276
5276
|
lodash2.lastIndexOf = lastIndexOf;
|
|
@@ -5532,17 +5532,17 @@ var require_lunr = __commonJS({
|
|
|
5532
5532
|
"../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js"(exports2, module) {
|
|
5533
5533
|
(function() {
|
|
5534
5534
|
var lunr2 = function(config) {
|
|
5535
|
-
var
|
|
5536
|
-
|
|
5535
|
+
var builder8 = new lunr2.Builder();
|
|
5536
|
+
builder8.pipeline.add(
|
|
5537
5537
|
lunr2.trimmer,
|
|
5538
5538
|
lunr2.stopWordFilter,
|
|
5539
5539
|
lunr2.stemmer
|
|
5540
5540
|
);
|
|
5541
|
-
|
|
5541
|
+
builder8.searchPipeline.add(
|
|
5542
5542
|
lunr2.stemmer
|
|
5543
5543
|
);
|
|
5544
|
-
config.call(
|
|
5545
|
-
return
|
|
5544
|
+
config.call(builder8, builder8);
|
|
5545
|
+
return builder8.build();
|
|
5546
5546
|
};
|
|
5547
5547
|
lunr2.version = "2.3.9";
|
|
5548
5548
|
lunr2.utils = {};
|
|
@@ -6218,12 +6218,12 @@ var require_lunr = __commonJS({
|
|
|
6218
6218
|
};
|
|
6219
6219
|
lunr2.TokenSet._nextId = 1;
|
|
6220
6220
|
lunr2.TokenSet.fromArray = function(arr) {
|
|
6221
|
-
var
|
|
6221
|
+
var builder8 = new lunr2.TokenSet.Builder();
|
|
6222
6222
|
for (var i = 0, len = arr.length; i < len; i++) {
|
|
6223
|
-
|
|
6223
|
+
builder8.insert(arr[i]);
|
|
6224
6224
|
}
|
|
6225
|
-
|
|
6226
|
-
return
|
|
6225
|
+
builder8.finish();
|
|
6226
|
+
return builder8.root;
|
|
6227
6227
|
};
|
|
6228
6228
|
lunr2.TokenSet.fromClause = function(clause) {
|
|
6229
6229
|
if ("editDistance" in clause) {
|
|
@@ -7268,7 +7268,7 @@ import { dirname, join } from "node:path";
|
|
|
7268
7268
|
import { fileURLToPath } from "node:url";
|
|
7269
7269
|
function getPackageVersion() {
|
|
7270
7270
|
if (true) {
|
|
7271
|
-
return "4.0.0-rc.
|
|
7271
|
+
return "4.0.0-rc.4";
|
|
7272
7272
|
}
|
|
7273
7273
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
7274
7274
|
const currentDir = dirname(currentModulePath);
|
|
@@ -7879,10 +7879,10 @@ ${"=".repeat(50)}`);
|
|
|
7879
7879
|
if (statistics.typeStatistics.commonTypeConflicts.length > 0) {
|
|
7880
7880
|
console.log(`
|
|
7881
7881
|
\u2694\uFE0F Type Conflicts:`);
|
|
7882
|
-
statistics.typeStatistics.commonTypeConflicts.forEach(({ conflictType, count, examples:
|
|
7882
|
+
statistics.typeStatistics.commonTypeConflicts.forEach(({ conflictType, count, examples: examples8 }) => {
|
|
7883
7883
|
console.log(` ${yellow(conflictType)}: ${count} conflicts`);
|
|
7884
|
-
if (
|
|
7885
|
-
console.log(` \u2514\u2500 Examples: ${gray(
|
|
7884
|
+
if (examples8.length > 0) {
|
|
7885
|
+
console.log(` \u2514\u2500 Examples: ${gray(examples8.join(", "))}`);
|
|
7886
7886
|
}
|
|
7887
7887
|
});
|
|
7888
7888
|
}
|
|
@@ -8165,7 +8165,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8165
8165
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
8166
8166
|
function getPackageVersion2() {
|
|
8167
8167
|
if (true) {
|
|
8168
|
-
return "4.0.0-rc.
|
|
8168
|
+
return "4.0.0-rc.4";
|
|
8169
8169
|
}
|
|
8170
8170
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
8171
8171
|
const currentDir = dirname2(currentModulePath);
|
|
@@ -11113,13 +11113,22 @@ var DependencyManager = class _DependencyManager {
|
|
|
11113
11113
|
return this.config.noNamespace ? `import type * as ${namespace} from '${importPath}'` : `import type ${namespace} from '${importPath}';`;
|
|
11114
11114
|
}
|
|
11115
11115
|
createPackageJsonImport(importPath, libraryVersion) {
|
|
11116
|
+
const pinnedVersion = libraryVersion ? `${libraryVersion.toString()}-${APP_VERSION}` : APP_VERSION;
|
|
11117
|
+
const format = this.config.depVersionFormat ?? (this.config.workspace ? "workspace" : "exact");
|
|
11116
11118
|
let depVersion;
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11119
|
+
switch (format) {
|
|
11120
|
+
case "workspace":
|
|
11121
|
+
depVersion = "workspace:^";
|
|
11122
|
+
break;
|
|
11123
|
+
case "caret":
|
|
11124
|
+
depVersion = `^${pinnedVersion}`;
|
|
11125
|
+
break;
|
|
11126
|
+
case "any":
|
|
11127
|
+
depVersion = "*";
|
|
11128
|
+
break;
|
|
11129
|
+
default:
|
|
11130
|
+
depVersion = pinnedVersion;
|
|
11131
|
+
break;
|
|
11123
11132
|
}
|
|
11124
11133
|
return `"${importPath}": "${depVersion}"`;
|
|
11125
11134
|
}
|
|
@@ -15202,16 +15211,16 @@ function transformBacktickTypeRefs(text, ctx) {
|
|
|
15202
15211
|
});
|
|
15203
15212
|
return text;
|
|
15204
15213
|
}
|
|
15205
|
-
function transformGirDocHighlights(
|
|
15206
|
-
return
|
|
15214
|
+
function transformGirDocHighlights(description8) {
|
|
15215
|
+
return description8.replace(/(?<!\{)(?<!\w)@([A-Za-z_][A-Za-z0-9_]*)/g, "`$1`");
|
|
15207
15216
|
}
|
|
15208
|
-
function transformGirDocCodeBlocks(
|
|
15209
|
-
|
|
15217
|
+
function transformGirDocCodeBlocks(description8) {
|
|
15218
|
+
description8 = description8.replaceAll(/```\s*\{\s*\.(\w+)[^}]*\}/gm, "```$1").replaceAll(/\|\[<!-- language="([^"]+)" -->/gm, (_match, lang) => {
|
|
15210
15219
|
if (lang === "plain" || lang === "text") return "\n```";
|
|
15211
15220
|
return `
|
|
15212
15221
|
\`\`\`${lang.toLowerCase()}`;
|
|
15213
15222
|
}).replaceAll(/\|\[/gm, "\n```").replaceAll(/\]\|/gm, "```\n");
|
|
15214
|
-
return
|
|
15223
|
+
return description8;
|
|
15215
15224
|
}
|
|
15216
15225
|
|
|
15217
15226
|
// ../lib/src/utils/objects.ts
|
|
@@ -19505,6 +19514,11 @@ var options = {
|
|
|
19505
19514
|
default: defaults.workspace,
|
|
19506
19515
|
normalize: true
|
|
19507
19516
|
},
|
|
19517
|
+
depVersionFormat: {
|
|
19518
|
+
type: "string",
|
|
19519
|
+
description: "Dependency version spec format in generated package.json files. Defaults to 'workspace' when --workspace, else 'exact'",
|
|
19520
|
+
choices: ["workspace", "caret", "any", "exact"]
|
|
19521
|
+
},
|
|
19508
19522
|
onlyVersionPrefix: {
|
|
19509
19523
|
type: "boolean",
|
|
19510
19524
|
description: "Only use the version prefix for the ambient module exports. This is useful if, for whatever reason, you want to use different library versions of the same library in your project.",
|
|
@@ -19557,6 +19571,7 @@ var generateOptions = {
|
|
|
19557
19571
|
promisify: options.promisify,
|
|
19558
19572
|
npmScope: options.npmScope,
|
|
19559
19573
|
workspace: options.workspace,
|
|
19574
|
+
depVersionFormat: options.depVersionFormat,
|
|
19560
19575
|
onlyVersionPrefix: options.onlyVersionPrefix,
|
|
19561
19576
|
noPrettyPrint: options.noPrettyPrint,
|
|
19562
19577
|
noAdvancedVariants: options.noAdvancedVariants,
|
|
@@ -19612,6 +19627,25 @@ var docOptions = {
|
|
|
19612
19627
|
description: "Directory containing pre-generated TypeDoc JSON files for merge mode (from 'ts-for-gir json')"
|
|
19613
19628
|
}
|
|
19614
19629
|
};
|
|
19630
|
+
var createOptions = {
|
|
19631
|
+
template: {
|
|
19632
|
+
type: "string",
|
|
19633
|
+
alias: "t",
|
|
19634
|
+
description: "Template to scaffold (types-locally, types-npm, types-workspace)",
|
|
19635
|
+
choices: ["types-locally", "types-npm", "types-workspace"]
|
|
19636
|
+
},
|
|
19637
|
+
install: {
|
|
19638
|
+
type: "boolean",
|
|
19639
|
+
description: "Run npm install after scaffolding (use --no-install to skip)",
|
|
19640
|
+
default: true
|
|
19641
|
+
},
|
|
19642
|
+
force: {
|
|
19643
|
+
type: "boolean",
|
|
19644
|
+
description: "Allow scaffolding into a non-empty target directory",
|
|
19645
|
+
default: false
|
|
19646
|
+
},
|
|
19647
|
+
verbose: options.verbose
|
|
19648
|
+
};
|
|
19615
19649
|
var analyzeOptions = {
|
|
19616
19650
|
reportFile: {
|
|
19617
19651
|
type: "string",
|
|
@@ -19778,6 +19812,7 @@ async function load(cliOptions) {
|
|
|
19778
19812
|
const stringKeys = [
|
|
19779
19813
|
["npmScope", options.npmScope.default],
|
|
19780
19814
|
["reporterOutput", options.reporterOutput.default],
|
|
19815
|
+
["depVersionFormat", void 0],
|
|
19781
19816
|
["theme", docOptions.theme.default],
|
|
19782
19817
|
["sourceLinkTemplate", void 0],
|
|
19783
19818
|
["readme", void 0],
|
|
@@ -19816,13 +19851,13 @@ async function load(cliOptions) {
|
|
|
19816
19851
|
}
|
|
19817
19852
|
|
|
19818
19853
|
// src/commands/command-builder.ts
|
|
19819
|
-
function createBuilder(options2,
|
|
19854
|
+
function createBuilder(options2, examples8) {
|
|
19820
19855
|
return (yargs2) => {
|
|
19821
19856
|
const optionNames = Object.keys(options2);
|
|
19822
19857
|
for (const optionName of optionNames) {
|
|
19823
19858
|
yargs2 = yargs2.option(optionName, options2[optionName]);
|
|
19824
19859
|
}
|
|
19825
|
-
return yargs2.example(
|
|
19860
|
+
return yargs2.example(examples8);
|
|
19826
19861
|
};
|
|
19827
19862
|
}
|
|
19828
19863
|
|
|
@@ -20643,9 +20678,184 @@ var copy = {
|
|
|
20643
20678
|
examples: examples2
|
|
20644
20679
|
};
|
|
20645
20680
|
|
|
20681
|
+
// src/commands/create.ts
|
|
20682
|
+
import { spawnSync } from "node:child_process";
|
|
20683
|
+
import { cpSync, existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
20684
|
+
import { dirname as dirname6, join as join9, resolve as resolve5 } from "node:path";
|
|
20685
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
20686
|
+
import { input, select as select2 } from "@inquirer/prompts";
|
|
20687
|
+
var command3 = "create [name]";
|
|
20688
|
+
var description3 = "Scaffold a new GJS TypeScript project from a template";
|
|
20689
|
+
var examples3 = [
|
|
20690
|
+
[`${APP_NAME} create my-app --template types-npm`, "Scaffold using the @girs/* NPM types"],
|
|
20691
|
+
[`${APP_NAME} create my-app --template types-locally`, "Scaffold and generate types into ./@types/ locally"],
|
|
20692
|
+
[
|
|
20693
|
+
`${APP_NAME} create my-app --template types-workspace`,
|
|
20694
|
+
"Scaffold an npm workspace with types as workspace packages"
|
|
20695
|
+
],
|
|
20696
|
+
[`${APP_NAME} create`, "Interactive: prompts for name and template"]
|
|
20697
|
+
];
|
|
20698
|
+
var TEMPLATE_CHOICES = [
|
|
20699
|
+
{
|
|
20700
|
+
value: "types-locally",
|
|
20701
|
+
name: "types-locally",
|
|
20702
|
+
description: "Generate GIR types directly into ./@types/ (no package format, no @girs/* deps)"
|
|
20703
|
+
},
|
|
20704
|
+
{
|
|
20705
|
+
value: "types-npm",
|
|
20706
|
+
name: "types-npm",
|
|
20707
|
+
description: "Use pre-generated types from the @girs/* NPM packages"
|
|
20708
|
+
},
|
|
20709
|
+
{
|
|
20710
|
+
value: "types-workspace",
|
|
20711
|
+
name: "types-workspace",
|
|
20712
|
+
description: "npm workspace; generate @girs/* as workspace packages under ./@girs/"
|
|
20713
|
+
}
|
|
20714
|
+
];
|
|
20715
|
+
var PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
|
|
20716
|
+
var TEXT_FILE_EXT = /* @__PURE__ */ new Set([".json", ".md", ".ts", ".tsx", ".js", ".mjs", ".cjs"]);
|
|
20717
|
+
var builder3 = createBuilder(createOptions, examples3);
|
|
20718
|
+
function findTemplatesRoot() {
|
|
20719
|
+
const __filename2 = fileURLToPath4(import.meta.url);
|
|
20720
|
+
const __dirname3 = dirname6(__filename2);
|
|
20721
|
+
const candidates = [
|
|
20722
|
+
// Bundled production binary (bin/ts-for-gir): ../dist-templates
|
|
20723
|
+
resolve5(__dirname3, "..", "dist-templates"),
|
|
20724
|
+
// Source layout (src/commands/create.ts): ../../dist-templates then ../../templates
|
|
20725
|
+
resolve5(__dirname3, "..", "..", "dist-templates"),
|
|
20726
|
+
resolve5(__dirname3, "..", "..", "templates")
|
|
20727
|
+
];
|
|
20728
|
+
for (const path of candidates) {
|
|
20729
|
+
if (existsSync3(path)) return path;
|
|
20730
|
+
}
|
|
20731
|
+
throw new Error(
|
|
20732
|
+
`Could not locate templates directory. Looked in:
|
|
20733
|
+
${candidates.join("\n ")}
|
|
20734
|
+
If you are running from source, make sure packages/cli/templates/ exists. If you are running the published CLI, make sure dist-templates/ was packed.`
|
|
20735
|
+
);
|
|
20736
|
+
}
|
|
20737
|
+
function listTemplates(templatesRoot) {
|
|
20738
|
+
const knownIds = TEMPLATE_CHOICES.map((c) => c.value);
|
|
20739
|
+
return readdirSync(templatesRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => knownIds.includes(name));
|
|
20740
|
+
}
|
|
20741
|
+
function sanitizeProjectName(raw) {
|
|
20742
|
+
const trimmed = raw.trim();
|
|
20743
|
+
if (!trimmed) throw new Error("Project name cannot be empty");
|
|
20744
|
+
const cleaned = trimmed.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+/, "").replace(/[._-]+$/, "");
|
|
20745
|
+
if (!cleaned) throw new Error(`"${raw}" is not a valid npm package name`);
|
|
20746
|
+
return cleaned;
|
|
20747
|
+
}
|
|
20748
|
+
function isDirEmpty(path) {
|
|
20749
|
+
if (!existsSync3(path)) return true;
|
|
20750
|
+
return readdirSync(path).length === 0;
|
|
20751
|
+
}
|
|
20752
|
+
function substituteInFile(filePath, projectName) {
|
|
20753
|
+
const content = readFileSync4(filePath, "utf8");
|
|
20754
|
+
if (!content.includes(PROJECT_NAME_PLACEHOLDER)) return;
|
|
20755
|
+
writeFileSync2(filePath, content.replaceAll(PROJECT_NAME_PLACEHOLDER, projectName));
|
|
20756
|
+
}
|
|
20757
|
+
function walkAndSubstitute(rootDir, projectName) {
|
|
20758
|
+
for (const entry of readdirSync(rootDir, { withFileTypes: true })) {
|
|
20759
|
+
const full = join9(rootDir, entry.name);
|
|
20760
|
+
if (entry.isDirectory()) {
|
|
20761
|
+
if (entry.name === "node_modules") continue;
|
|
20762
|
+
walkAndSubstitute(full, projectName);
|
|
20763
|
+
continue;
|
|
20764
|
+
}
|
|
20765
|
+
if (!entry.isFile()) continue;
|
|
20766
|
+
const ext = entry.name.slice(entry.name.lastIndexOf("."));
|
|
20767
|
+
if (!TEXT_FILE_EXT.has(ext)) continue;
|
|
20768
|
+
substituteInFile(full, projectName);
|
|
20769
|
+
}
|
|
20770
|
+
}
|
|
20771
|
+
var handler3 = async (args) => {
|
|
20772
|
+
const opts = args;
|
|
20773
|
+
const log3 = new Logger(opts.verbose ?? false, "CreateCommand");
|
|
20774
|
+
const templatesRoot = findTemplatesRoot();
|
|
20775
|
+
const available = listTemplates(templatesRoot);
|
|
20776
|
+
if (available.length === 0) {
|
|
20777
|
+
throw new Error(`No templates found in ${templatesRoot}`);
|
|
20778
|
+
}
|
|
20779
|
+
let template2 = opts.template;
|
|
20780
|
+
if (template2 && !available.includes(template2)) {
|
|
20781
|
+
throw new Error(`Unknown template "${template2}". Available: ${available.join(", ")}`);
|
|
20782
|
+
}
|
|
20783
|
+
if (!template2) {
|
|
20784
|
+
if (!process.stdin.isTTY) {
|
|
20785
|
+
throw new Error(`--template is required (non-TTY). Available: ${available.join(", ")}`);
|
|
20786
|
+
}
|
|
20787
|
+
template2 = await select2({
|
|
20788
|
+
message: "Choose a template:",
|
|
20789
|
+
choices: TEMPLATE_CHOICES.filter((c) => available.includes(c.value)).map((c) => ({
|
|
20790
|
+
value: c.value,
|
|
20791
|
+
name: c.name,
|
|
20792
|
+
description: c.description
|
|
20793
|
+
}))
|
|
20794
|
+
});
|
|
20795
|
+
}
|
|
20796
|
+
let nameRaw = opts.name;
|
|
20797
|
+
if (!nameRaw) {
|
|
20798
|
+
if (!process.stdin.isTTY) {
|
|
20799
|
+
throw new Error("Project name is required (non-TTY). Pass it as the first positional argument.");
|
|
20800
|
+
}
|
|
20801
|
+
nameRaw = await input({
|
|
20802
|
+
message: "Project name:",
|
|
20803
|
+
default: "my-gjs-app",
|
|
20804
|
+
validate: (v) => v.trim().length > 0 ? true : "Project name cannot be empty"
|
|
20805
|
+
});
|
|
20806
|
+
}
|
|
20807
|
+
const projectName = sanitizeProjectName(nameRaw);
|
|
20808
|
+
const targetDir = resolve5(process.cwd(), projectName);
|
|
20809
|
+
if (existsSync3(targetDir) && !isDirEmpty(targetDir) && !opts.force) {
|
|
20810
|
+
throw new Error(
|
|
20811
|
+
`Target directory ${targetDir} exists and is not empty. Use --force to scaffold into a non-empty directory.`
|
|
20812
|
+
);
|
|
20813
|
+
}
|
|
20814
|
+
mkdirSync(targetDir, { recursive: true });
|
|
20815
|
+
const templateDir = join9(templatesRoot, template2);
|
|
20816
|
+
cpSync(templateDir, targetDir, { recursive: true });
|
|
20817
|
+
walkAndSubstitute(targetDir, projectName);
|
|
20818
|
+
log3.success(`Scaffolded ${template2} into ${targetDir}`);
|
|
20819
|
+
if (opts.install) {
|
|
20820
|
+
log3.info("Running npm install...");
|
|
20821
|
+
const result = spawnSync("npm", ["install", "--no-audit", "--no-fund"], {
|
|
20822
|
+
cwd: targetDir,
|
|
20823
|
+
stdio: "inherit"
|
|
20824
|
+
});
|
|
20825
|
+
if (result.status !== 0) {
|
|
20826
|
+
log3.warn("npm install failed; you can re-run it manually in the project directory.");
|
|
20827
|
+
}
|
|
20828
|
+
}
|
|
20829
|
+
log3.info("\nNext steps:");
|
|
20830
|
+
log3.white(` cd ${projectName}`);
|
|
20831
|
+
if (!opts.install) log3.white(" npm install");
|
|
20832
|
+
switch (template2) {
|
|
20833
|
+
case "types-locally":
|
|
20834
|
+
log3.white(" npm run generate");
|
|
20835
|
+
log3.white(" npm run check:types");
|
|
20836
|
+
log3.white(" npm run build && npm start");
|
|
20837
|
+
break;
|
|
20838
|
+
case "types-npm":
|
|
20839
|
+
log3.white(" npm run check");
|
|
20840
|
+
log3.white(" npm run build && npm start");
|
|
20841
|
+
break;
|
|
20842
|
+
case "types-workspace":
|
|
20843
|
+
log3.white(" npm run build:types && npm install");
|
|
20844
|
+
log3.white(" npm run build:app && npm start");
|
|
20845
|
+
break;
|
|
20846
|
+
}
|
|
20847
|
+
};
|
|
20848
|
+
var create = {
|
|
20849
|
+
command: command3,
|
|
20850
|
+
description: description3,
|
|
20851
|
+
builder: builder3,
|
|
20852
|
+
handler: handler3,
|
|
20853
|
+
examples: examples3
|
|
20854
|
+
};
|
|
20855
|
+
|
|
20646
20856
|
// ../generator-html-doc/src/html-doc-generator.ts
|
|
20647
20857
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
20648
|
-
import { join as
|
|
20858
|
+
import { join as join16 } from "node:path";
|
|
20649
20859
|
|
|
20650
20860
|
// ../generator-json/src/gir-metadata-deserializer.ts
|
|
20651
20861
|
import { DeclarationReflection } from "typedoc";
|
|
@@ -20671,16 +20881,16 @@ var GirMetadataDeserializer = class {
|
|
|
20671
20881
|
|
|
20672
20882
|
// ../generator-json/src/json-definition-generator.ts
|
|
20673
20883
|
import { mkdir as mkdir3, writeFile as writeFile5 } from "node:fs/promises";
|
|
20674
|
-
import { join as
|
|
20884
|
+
import { join as join12 } from "node:path";
|
|
20675
20885
|
|
|
20676
20886
|
// ../generator-json/src/typedoc-pipeline.ts
|
|
20677
|
-
import { readFileSync as
|
|
20887
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
20678
20888
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
20679
20889
|
import { tmpdir } from "node:os";
|
|
20680
|
-
import { join as
|
|
20890
|
+
import { join as join11 } from "node:path";
|
|
20681
20891
|
|
|
20682
20892
|
// ../generator-typescript/src/template-processor.ts
|
|
20683
|
-
import { dirname as
|
|
20893
|
+
import { dirname as dirname7, join as join10, relative } from "node:path";
|
|
20684
20894
|
var TemplateProcessor = class extends TemplateEngine {
|
|
20685
20895
|
data;
|
|
20686
20896
|
packageName;
|
|
@@ -20710,8 +20920,8 @@ var TemplateProcessor = class extends TemplateEngine {
|
|
|
20710
20920
|
dep,
|
|
20711
20921
|
deps,
|
|
20712
20922
|
typeDir,
|
|
20713
|
-
join:
|
|
20714
|
-
dirname:
|
|
20923
|
+
join: join10,
|
|
20924
|
+
dirname: dirname7,
|
|
20715
20925
|
...this.config,
|
|
20716
20926
|
packageName: this.packageName
|
|
20717
20927
|
};
|
|
@@ -20781,10 +20991,10 @@ ${append}`;
|
|
|
20781
20991
|
const rendered = await this.loadAll(templateDirname, fileExtension, ejsOptions, overrideTemplateData);
|
|
20782
20992
|
const result = {};
|
|
20783
20993
|
for (const filename of Object.keys(rendered)) {
|
|
20784
|
-
const destPath =
|
|
20994
|
+
const destPath = join10(baseOutputPath, outputDirname, filename);
|
|
20785
20995
|
result[destPath] = `${rendered[filename]}
|
|
20786
20996
|
${append}`;
|
|
20787
|
-
await this.write(result[destPath], baseOutputPath,
|
|
20997
|
+
await this.write(result[destPath], baseOutputPath, join10(outputDirname, filename));
|
|
20788
20998
|
}
|
|
20789
20999
|
return result;
|
|
20790
21000
|
}
|
|
@@ -20793,8 +21003,8 @@ ${append}`;
|
|
|
20793
21003
|
* This is TypeScript-specific logic for handling package.json mode
|
|
20794
21004
|
*/
|
|
20795
21005
|
getOutputPath(baseOutputPath, outputFilename) {
|
|
20796
|
-
const filePath = this.config.package ?
|
|
20797
|
-
const outputPath =
|
|
21006
|
+
const filePath = this.config.package ? join10(this.data?.importName || this.packageName, outputFilename) : outputFilename;
|
|
21007
|
+
const outputPath = join10(baseOutputPath, filePath);
|
|
20798
21008
|
return outputPath;
|
|
20799
21009
|
}
|
|
20800
21010
|
/**
|
|
@@ -24053,9 +24263,9 @@ var GirMetadataSerializer = class _GirMetadataSerializer {
|
|
|
24053
24263
|
[IntrospectedAlias, (s, o) => s.buildBaseMetadata(o, "alias")]
|
|
24054
24264
|
];
|
|
24055
24265
|
buildMetadata(girObj) {
|
|
24056
|
-
for (const [ctor,
|
|
24266
|
+
for (const [ctor, handler8] of _GirMetadataSerializer.METADATA_DISPATCH) {
|
|
24057
24267
|
if (girObj instanceof ctor) {
|
|
24058
|
-
return
|
|
24268
|
+
return handler8(this, girObj);
|
|
24059
24269
|
}
|
|
24060
24270
|
}
|
|
24061
24271
|
return null;
|
|
@@ -24180,7 +24390,7 @@ var TypeDocPipeline = class {
|
|
|
24180
24390
|
return this._modules;
|
|
24181
24391
|
}
|
|
24182
24392
|
async start() {
|
|
24183
|
-
this.tempDir = await mkdtemp(
|
|
24393
|
+
this.tempDir = await mkdtemp(join11(tmpdir(), "ts-for-gir-typedoc-"));
|
|
24184
24394
|
const tempConfig = {
|
|
24185
24395
|
...this.config,
|
|
24186
24396
|
outdir: this.tempDir,
|
|
@@ -24207,10 +24417,10 @@ var TypeDocPipeline = class {
|
|
|
24207
24417
|
* convert to ProjectReflection, and enrich with GIR metadata.
|
|
24208
24418
|
*/
|
|
24209
24419
|
async createTypeDocApp(module) {
|
|
24210
|
-
const moduleDir =
|
|
24211
|
-
const entryPoint =
|
|
24212
|
-
const tsconfigPath =
|
|
24213
|
-
const readmePath =
|
|
24420
|
+
const moduleDir = join11(this.tempDir, module.importName);
|
|
24421
|
+
const entryPoint = join11(moduleDir, `${module.importName}.d.ts`);
|
|
24422
|
+
const tsconfigPath = join11(moduleDir, "tsconfig.json");
|
|
24423
|
+
const readmePath = join11(moduleDir, "README.md");
|
|
24214
24424
|
const result = await this.bootstrapAndConvert(
|
|
24215
24425
|
{
|
|
24216
24426
|
entryPoints: [entryPoint],
|
|
@@ -24236,13 +24446,13 @@ var TypeDocPipeline = class {
|
|
|
24236
24446
|
* Useful for TypeDoc's `projectToObject()` base path.
|
|
24237
24447
|
*/
|
|
24238
24448
|
getModuleDir(module) {
|
|
24239
|
-
return normalizePath(
|
|
24449
|
+
return normalizePath(join11(this.tempDir, module.importName));
|
|
24240
24450
|
}
|
|
24241
24451
|
/**
|
|
24242
24452
|
* Get the normalized path to the GJS package temporary directory.
|
|
24243
24453
|
*/
|
|
24244
24454
|
getGjsDir() {
|
|
24245
|
-
return normalizePath(
|
|
24455
|
+
return normalizePath(join11(this.tempDir, "gjs"));
|
|
24246
24456
|
}
|
|
24247
24457
|
/**
|
|
24248
24458
|
* Bootstrap a TypeDoc Application for the GJS core types package.
|
|
@@ -24255,16 +24465,16 @@ var TypeDocPipeline = class {
|
|
|
24255
24465
|
* Returns null if the GJS package was not generated (e.g. temp dir missing).
|
|
24256
24466
|
*/
|
|
24257
24467
|
async createGjsTypeDocApp() {
|
|
24258
|
-
const gjsDir =
|
|
24259
|
-
const tsconfigPath =
|
|
24260
|
-
const readmePath =
|
|
24468
|
+
const gjsDir = join11(this.tempDir, "gjs");
|
|
24469
|
+
const tsconfigPath = join11(gjsDir, "tsconfig.json");
|
|
24470
|
+
const readmePath = join11(gjsDir, "README.md");
|
|
24261
24471
|
const entryPoints = [
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24472
|
+
join11(gjsDir, "gjs.d.ts"),
|
|
24473
|
+
join11(gjsDir, "cairo.d.ts"),
|
|
24474
|
+
join11(gjsDir, "gettext.d.ts"),
|
|
24475
|
+
join11(gjsDir, "system.d.ts"),
|
|
24476
|
+
join11(gjsDir, "dom.d.ts"),
|
|
24477
|
+
join11(gjsDir, "console.d.ts")
|
|
24268
24478
|
];
|
|
24269
24479
|
try {
|
|
24270
24480
|
const result = await this.bootstrapAndConvert(
|
|
@@ -24293,7 +24503,7 @@ var TypeDocPipeline = class {
|
|
|
24293
24503
|
async createCombinedTypeDocApp() {
|
|
24294
24504
|
const result = await this.bootstrapAndConvert(
|
|
24295
24505
|
{
|
|
24296
|
-
entryPoints: [
|
|
24506
|
+
entryPoints: [join11(this.tempDir, "*")],
|
|
24297
24507
|
entryPointStrategy: "packages",
|
|
24298
24508
|
name: "TypeScript API Documentation for GJS",
|
|
24299
24509
|
...this.sourceLinkOptions,
|
|
@@ -24319,7 +24529,7 @@ var TypeDocPipeline = class {
|
|
|
24319
24529
|
async createMergedTypeDocApp(jsonDir) {
|
|
24320
24530
|
const app = await this.bootstrapApp(
|
|
24321
24531
|
{
|
|
24322
|
-
entryPoints: [
|
|
24532
|
+
entryPoints: [join11(jsonDir, "*.json")],
|
|
24323
24533
|
entryPointStrategy: "merge",
|
|
24324
24534
|
name: "TypeScript API Documentation for GJS"
|
|
24325
24535
|
},
|
|
@@ -24688,7 +24898,7 @@ var TypeDocPipeline = class {
|
|
|
24688
24898
|
/** Try to read the generated package.json for a module from the temp directory. */
|
|
24689
24899
|
readPackageJson(importName) {
|
|
24690
24900
|
try {
|
|
24691
|
-
const content =
|
|
24901
|
+
const content = readFileSync5(join11(this.tempDir, importName, "package.json"), "utf8");
|
|
24692
24902
|
return JSON.parse(content);
|
|
24693
24903
|
} catch {
|
|
24694
24904
|
return null;
|
|
@@ -24755,7 +24965,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24755
24965
|
const jsonStr = `${JSON.stringify(jsonOutput, null, pretty ? " " : "")}
|
|
24756
24966
|
`;
|
|
24757
24967
|
if (this.config.outdir) {
|
|
24758
|
-
const filepath =
|
|
24968
|
+
const filepath = join12(this.config.outdir, "Gjs.json");
|
|
24759
24969
|
await writeFile5(filepath, jsonStr, "utf8");
|
|
24760
24970
|
this.log.info(`Generated ${filepath}`);
|
|
24761
24971
|
} else {
|
|
@@ -24770,7 +24980,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24770
24980
|
const jsonStr = `${JSON.stringify(jsonOutput, null, pretty ? " " : "")}
|
|
24771
24981
|
`;
|
|
24772
24982
|
if (this.config.outdir) {
|
|
24773
|
-
const filepath =
|
|
24983
|
+
const filepath = join12(this.config.outdir, `${module.packageName}.json`);
|
|
24774
24984
|
await writeFile5(filepath, jsonStr, "utf8");
|
|
24775
24985
|
this.log.info(`Generated ${filepath}`);
|
|
24776
24986
|
} else {
|
|
@@ -24780,9 +24990,9 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24780
24990
|
};
|
|
24781
24991
|
|
|
24782
24992
|
// ../typedoc-theme/src/theme.ts
|
|
24783
|
-
import { copyFileSync, existsSync as
|
|
24784
|
-
import { dirname as
|
|
24785
|
-
import { fileURLToPath as
|
|
24993
|
+
import { copyFileSync, existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
24994
|
+
import { dirname as dirname9, join as join15 } from "node:path";
|
|
24995
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
24786
24996
|
import { DefaultTheme, RendererEvent } from "typedoc";
|
|
24787
24997
|
|
|
24788
24998
|
// ../typedoc-theme/src/context.ts
|
|
@@ -25055,8 +25265,8 @@ import { JSX as JSX3 } from "typedoc";
|
|
|
25055
25265
|
|
|
25056
25266
|
// ../typedoc-theme/src/search-splitter.ts
|
|
25057
25267
|
var import_lunr = __toESM(require_lunr(), 1);
|
|
25058
|
-
import { readFileSync as
|
|
25059
|
-
import { join as
|
|
25268
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
25269
|
+
import { join as join13 } from "node:path";
|
|
25060
25270
|
import { deflateSync, inflateSync } from "node:zlib";
|
|
25061
25271
|
var KIND_MODULE = 2;
|
|
25062
25272
|
function sanitizeModuleName(name) {
|
|
@@ -25073,20 +25283,20 @@ function getModuleName(row, moduleNames) {
|
|
|
25073
25283
|
return void 0;
|
|
25074
25284
|
}
|
|
25075
25285
|
function buildChunk(rows) {
|
|
25076
|
-
const
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
25286
|
+
const builder8 = new import_lunr.default.Builder();
|
|
25287
|
+
builder8.pipeline.add(import_lunr.default.trimmer);
|
|
25288
|
+
builder8.ref("id");
|
|
25289
|
+
builder8.field("name", { boost: 10 });
|
|
25080
25290
|
for (let i = 0; i < rows.length; i++) {
|
|
25081
|
-
|
|
25291
|
+
builder8.add({ id: i, name: rows[i].name });
|
|
25082
25292
|
}
|
|
25083
|
-
const index =
|
|
25293
|
+
const index = builder8.build();
|
|
25084
25294
|
const data = { rows, index };
|
|
25085
25295
|
const compressed = deflateSync(Buffer.from(JSON.stringify(data)));
|
|
25086
25296
|
return compressed.toString("base64");
|
|
25087
25297
|
}
|
|
25088
25298
|
function readSearchData(assetsDir) {
|
|
25089
|
-
const raw =
|
|
25299
|
+
const raw = readFileSync6(join13(assetsDir, "search.js"), "utf-8");
|
|
25090
25300
|
const match = raw.match(/window\.searchData\s*=\s*"([^"]+)"/);
|
|
25091
25301
|
if (!match?.[1]) {
|
|
25092
25302
|
throw new Error("Could not extract searchData from search.js");
|
|
@@ -25096,7 +25306,7 @@ function readSearchData(assetsDir) {
|
|
|
25096
25306
|
return JSON.parse(decompressed.toString("utf-8"));
|
|
25097
25307
|
}
|
|
25098
25308
|
async function splitSearchIndex(outputDir) {
|
|
25099
|
-
const assetsDir =
|
|
25309
|
+
const assetsDir = join13(outputDir, "assets");
|
|
25100
25310
|
let searchData;
|
|
25101
25311
|
try {
|
|
25102
25312
|
searchData = readSearchData(assetsDir);
|
|
@@ -25128,11 +25338,11 @@ async function splitSearchIndex(outputDir) {
|
|
|
25128
25338
|
for (const [moduleName, moduleRows] of moduleMap) {
|
|
25129
25339
|
const chunk = buildChunk(moduleRows);
|
|
25130
25340
|
const filename = `search-${sanitizeModuleName(moduleName)}.js`;
|
|
25131
|
-
|
|
25341
|
+
writeFileSync3(join13(assetsDir, filename), `window.searchData = "${chunk}";`);
|
|
25132
25342
|
}
|
|
25133
25343
|
const modulesChunk = buildChunk(moduleEntries);
|
|
25134
|
-
|
|
25135
|
-
|
|
25344
|
+
writeFileSync3(join13(assetsDir, "search-modules.js"), `window.searchData = "${modulesChunk}";`);
|
|
25345
|
+
writeFileSync3(join13(assetsDir, "search.js"), "window.searchData = null;");
|
|
25136
25346
|
const totalChunks = moduleMap.size + 1;
|
|
25137
25347
|
console.log(`[search-splitter] Split ${rows.length} entries into ${totalChunks} chunks (${moduleMap.size} modules)`);
|
|
25138
25348
|
}
|
|
@@ -25537,7 +25747,7 @@ function giDocgenModuleMemberSummary(context, member) {
|
|
|
25537
25747
|
}
|
|
25538
25748
|
const nsMeta = member.girNamespaceMetadata;
|
|
25539
25749
|
const commentSummary = context.commentShortSummary(member);
|
|
25540
|
-
const
|
|
25750
|
+
const description8 = commentSummary || (nsMeta?.description ? JSX4.createElement("p", null, nsMeta.description) : null);
|
|
25541
25751
|
return JSX4.createElement(
|
|
25542
25752
|
JSX4.Fragment,
|
|
25543
25753
|
null,
|
|
@@ -25549,7 +25759,7 @@ function giDocgenModuleMemberSummary(context, member) {
|
|
|
25549
25759
|
JSX4.createElement(
|
|
25550
25760
|
"dd",
|
|
25551
25761
|
{ class: classNames({ "tsd-member-summary": true }, context.getReflectionClasses(member)) },
|
|
25552
|
-
|
|
25762
|
+
description8
|
|
25553
25763
|
)
|
|
25554
25764
|
);
|
|
25555
25765
|
}
|
|
@@ -25658,16 +25868,16 @@ import { JSX as JSX7 } from "typedoc";
|
|
|
25658
25868
|
var giDocgenPageSidebar = (context, props) => JSX7.createElement(JSX7.Fragment, null, context.pageNavigation(props));
|
|
25659
25869
|
|
|
25660
25870
|
// ../typedoc-theme/src/partials/sidebar.ts
|
|
25661
|
-
import { readFileSync as
|
|
25662
|
-
import { dirname as
|
|
25663
|
-
import { fileURLToPath as
|
|
25871
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
25872
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
25873
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
25664
25874
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
|
|
25665
25875
|
function getTsForGirVersion() {
|
|
25666
25876
|
if (true) {
|
|
25667
|
-
return "4.0.0-rc.
|
|
25877
|
+
return "4.0.0-rc.4";
|
|
25668
25878
|
}
|
|
25669
|
-
const __dirname3 =
|
|
25670
|
-
return JSON.parse(
|
|
25879
|
+
const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
|
|
25880
|
+
return JSON.parse(readFileSync7(join14(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
25671
25881
|
}
|
|
25672
25882
|
var TSFOR_GIR_VERSION = getTsForGirVersion();
|
|
25673
25883
|
function giDocgenModuleInfo(context, mod, nsMeta) {
|
|
@@ -26100,7 +26310,7 @@ var GiDocgenThemeRenderContext = class extends DefaultThemeRenderContext {
|
|
|
26100
26310
|
};
|
|
26101
26311
|
|
|
26102
26312
|
// ../typedoc-theme/src/theme.ts
|
|
26103
|
-
var __dirname2 =
|
|
26313
|
+
var __dirname2 = dirname9(fileURLToPath6(import.meta.url));
|
|
26104
26314
|
var FAVICON_FILES = [
|
|
26105
26315
|
"favicon.ico",
|
|
26106
26316
|
"favicon-96x96.png",
|
|
@@ -26123,21 +26333,21 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
26123
26333
|
constructor(renderer) {
|
|
26124
26334
|
super(renderer);
|
|
26125
26335
|
this.owner.on(RendererEvent.END, (event) => {
|
|
26126
|
-
const assetsDir =
|
|
26127
|
-
copyFileSync(
|
|
26128
|
-
copyFileSync(
|
|
26129
|
-
copyFileSync(
|
|
26130
|
-
const faviconDir =
|
|
26336
|
+
const assetsDir = join15(event.outputDirectory, "assets");
|
|
26337
|
+
copyFileSync(join15(__dirname2, "static", "style.css"), join15(assetsDir, "gi-docgen.css"));
|
|
26338
|
+
copyFileSync(join15(__dirname2, "static", "gi-docgen-inherited.js"), join15(assetsDir, "gi-docgen-inherited.js"));
|
|
26339
|
+
copyFileSync(join15(__dirname2, "static", "logo_x4.png"), join15(assetsDir, "logo_x4.png"));
|
|
26340
|
+
const faviconDir = join15(__dirname2, "static", "favicon");
|
|
26131
26341
|
for (const file of FAVICON_FILES) {
|
|
26132
|
-
copyFileSync(
|
|
26342
|
+
copyFileSync(join15(faviconDir, file), join15(assetsDir, file));
|
|
26133
26343
|
}
|
|
26134
|
-
const iconsSourceDir =
|
|
26135
|
-
const iconsOutputDir =
|
|
26136
|
-
if (
|
|
26137
|
-
|
|
26138
|
-
for (const file of
|
|
26344
|
+
const iconsSourceDir = join15(__dirname2, "..", "..", "..", "refs", "library-icons", "library-icons");
|
|
26345
|
+
const iconsOutputDir = join15(assetsDir, "library-icons");
|
|
26346
|
+
if (existsSync4(iconsSourceDir)) {
|
|
26347
|
+
mkdirSync2(iconsOutputDir, { recursive: true });
|
|
26348
|
+
for (const file of readdirSync2(iconsSourceDir)) {
|
|
26139
26349
|
if (file.endsWith("-r.svg")) {
|
|
26140
|
-
copyFileSync(
|
|
26350
|
+
copyFileSync(join15(iconsSourceDir, file), join15(iconsOutputDir, file));
|
|
26141
26351
|
}
|
|
26142
26352
|
}
|
|
26143
26353
|
}
|
|
@@ -26153,7 +26363,7 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
26153
26363
|
background_color: "#1e1e1e",
|
|
26154
26364
|
display: "standalone"
|
|
26155
26365
|
};
|
|
26156
|
-
|
|
26366
|
+
writeFileSync4(join15(assetsDir, "site.webmanifest"), JSON.stringify(manifest, null, 2));
|
|
26157
26367
|
});
|
|
26158
26368
|
}
|
|
26159
26369
|
getNavigation(project) {
|
|
@@ -26207,7 +26417,7 @@ var HtmlDocGenerator = class _HtmlDocGenerator {
|
|
|
26207
26417
|
} else {
|
|
26208
26418
|
for (const module of this.pipeline.modules) {
|
|
26209
26419
|
const result = await this.pipeline.createTypeDocApp(module);
|
|
26210
|
-
await this.generateDocsWithTheme(result,
|
|
26420
|
+
await this.generateDocsWithTheme(result, join16(outdir, module.packageName));
|
|
26211
26421
|
}
|
|
26212
26422
|
}
|
|
26213
26423
|
this.log.success(`HTML documentation generated for ${this.pipeline.modules.length} modules in ${outdir}`);
|
|
@@ -26252,9 +26462,9 @@ var HtmlDocGenerator = class _HtmlDocGenerator {
|
|
|
26252
26462
|
import prettier from "prettier";
|
|
26253
26463
|
var logger4 = new Logger(false, "TypeScriptFormatter");
|
|
26254
26464
|
var TypeScriptFormatter = class extends Formatter {
|
|
26255
|
-
format(
|
|
26465
|
+
format(input2) {
|
|
26256
26466
|
try {
|
|
26257
|
-
return prettier.format(
|
|
26467
|
+
return prettier.format(input2, {
|
|
26258
26468
|
singleQuote: true,
|
|
26259
26469
|
parser: "typescript",
|
|
26260
26470
|
printWidth: 120,
|
|
@@ -26262,7 +26472,7 @@ var TypeScriptFormatter = class extends Formatter {
|
|
|
26262
26472
|
});
|
|
26263
26473
|
} catch (error) {
|
|
26264
26474
|
logger4.warn("Failed to format with prettier, returning original input", error);
|
|
26265
|
-
return Promise.resolve(
|
|
26475
|
+
return Promise.resolve(input2);
|
|
26266
26476
|
}
|
|
26267
26477
|
}
|
|
26268
26478
|
};
|
|
@@ -26391,9 +26601,9 @@ async function runGenerationCommand(args, options2) {
|
|
|
26391
26601
|
}
|
|
26392
26602
|
|
|
26393
26603
|
// src/commands/doc.ts
|
|
26394
|
-
var
|
|
26395
|
-
var
|
|
26396
|
-
var
|
|
26604
|
+
var command4 = "doc [modules..]";
|
|
26605
|
+
var description4 = "Generates HTML documentation from GIR files using TypeDoc";
|
|
26606
|
+
var examples4 = [
|
|
26397
26607
|
[`${APP_NAME} doc Gtk-4.0 --outdir ./docs`, "Generate HTML documentation for Gtk-4.0"],
|
|
26398
26608
|
[`${APP_NAME} doc '*' --outdir ./docs`, "Generate documentation for all locally installed GIR modules"],
|
|
26399
26609
|
[
|
|
@@ -26401,8 +26611,8 @@ var examples3 = [
|
|
|
26401
26611
|
"Generate HTML from pre-generated JSON files (low memory)"
|
|
26402
26612
|
]
|
|
26403
26613
|
];
|
|
26404
|
-
var
|
|
26405
|
-
var
|
|
26614
|
+
var builder4 = createBuilder(docOptions, examples4);
|
|
26615
|
+
var handler4 = async (args) => {
|
|
26406
26616
|
const config = getOptionsGeneration(await load(args));
|
|
26407
26617
|
if (config.merge) {
|
|
26408
26618
|
if (!config.jsonDir) {
|
|
@@ -26421,17 +26631,17 @@ var handler3 = async (args) => {
|
|
|
26421
26631
|
});
|
|
26422
26632
|
};
|
|
26423
26633
|
var doc = {
|
|
26424
|
-
command:
|
|
26425
|
-
description:
|
|
26426
|
-
builder:
|
|
26427
|
-
handler:
|
|
26428
|
-
examples:
|
|
26634
|
+
command: command4,
|
|
26635
|
+
description: description4,
|
|
26636
|
+
builder: builder4,
|
|
26637
|
+
handler: handler4,
|
|
26638
|
+
examples: examples4
|
|
26429
26639
|
};
|
|
26430
26640
|
|
|
26431
26641
|
// src/commands/generate.ts
|
|
26432
|
-
var
|
|
26433
|
-
var
|
|
26434
|
-
var
|
|
26642
|
+
var command5 = "generate [modules..]";
|
|
26643
|
+
var description5 = "Generates Typescript type definition .d.ts files from GIR for GJS";
|
|
26644
|
+
var examples5 = [
|
|
26435
26645
|
[
|
|
26436
26646
|
`${APP_NAME} generate`,
|
|
26437
26647
|
`Run '${APP_NAME} generate' in your gjs project to generate typings for your project, pass the gir modules you need for your project`
|
|
@@ -26441,8 +26651,8 @@ var examples4 = [
|
|
|
26441
26651
|
[`${APP_NAME} generate --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
|
|
26442
26652
|
[`${APP_NAME} generate --ignore=Gtk-4.0 xrandr-1.3`, "Generate .d.ts. files but not for Gtk-4.0 and xrandr-1.3"]
|
|
26443
26653
|
];
|
|
26444
|
-
var
|
|
26445
|
-
var
|
|
26654
|
+
var builder5 = createBuilder(generateOptions, examples5);
|
|
26655
|
+
var handler5 = async (args) => {
|
|
26446
26656
|
await runGenerationCommand(args, {
|
|
26447
26657
|
generatorType: 0 /* TYPES */,
|
|
26448
26658
|
loggerName: "GenerateCommand",
|
|
@@ -26452,25 +26662,25 @@ var handler4 = async (args) => {
|
|
|
26452
26662
|
});
|
|
26453
26663
|
};
|
|
26454
26664
|
var generate = {
|
|
26455
|
-
command:
|
|
26456
|
-
description:
|
|
26457
|
-
builder:
|
|
26458
|
-
handler:
|
|
26459
|
-
examples:
|
|
26665
|
+
command: command5,
|
|
26666
|
+
description: description5,
|
|
26667
|
+
builder: builder5,
|
|
26668
|
+
handler: handler5,
|
|
26669
|
+
examples: examples5
|
|
26460
26670
|
};
|
|
26461
26671
|
|
|
26462
26672
|
// src/commands/json.ts
|
|
26463
|
-
var
|
|
26464
|
-
var
|
|
26465
|
-
var
|
|
26673
|
+
var command6 = "json [modules..]";
|
|
26674
|
+
var description6 = "Generates JSON representation from GIR files for analysis and tooling";
|
|
26675
|
+
var examples6 = [
|
|
26466
26676
|
[`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
|
|
26467
26677
|
[`${APP_NAME} json 'Gtk*'`, "You can also use wild cards"],
|
|
26468
26678
|
[`${APP_NAME} json '*'`, "If you want to parse all of your locally installed gir modules run"],
|
|
26469
26679
|
[`${APP_NAME} json --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
|
|
26470
26680
|
[`${APP_NAME} json --ignore=Gtk-4.0 xrandr-1.3`, "Generate JSON files but not for Gtk-4.0 and xrandr-1.3"]
|
|
26471
26681
|
];
|
|
26472
|
-
var
|
|
26473
|
-
var
|
|
26682
|
+
var builder6 = createBuilder(generateOptions, examples6);
|
|
26683
|
+
var handler6 = async (args) => {
|
|
26474
26684
|
await runGenerationCommand(args, {
|
|
26475
26685
|
generatorType: 2 /* JSON */,
|
|
26476
26686
|
loggerName: "JsonCommand",
|
|
@@ -26480,26 +26690,26 @@ var handler5 = async (args) => {
|
|
|
26480
26690
|
});
|
|
26481
26691
|
};
|
|
26482
26692
|
var json2 = {
|
|
26483
|
-
command:
|
|
26484
|
-
description:
|
|
26485
|
-
builder:
|
|
26486
|
-
handler:
|
|
26487
|
-
examples:
|
|
26693
|
+
command: command6,
|
|
26694
|
+
description: description6,
|
|
26695
|
+
builder: builder6,
|
|
26696
|
+
handler: handler6,
|
|
26697
|
+
examples: examples6
|
|
26488
26698
|
};
|
|
26489
26699
|
|
|
26490
26700
|
// src/commands/list.ts
|
|
26491
|
-
var
|
|
26492
|
-
var
|
|
26701
|
+
var command7 = "list [modules..]";
|
|
26702
|
+
var description7 = "Lists all available GIR modules";
|
|
26493
26703
|
var logger5 = new Logger(true, "ListCommand");
|
|
26494
|
-
var
|
|
26704
|
+
var examples7 = [
|
|
26495
26705
|
[`${APP_NAME} list -g ./vala-girs/gir-1.0`, "Lists all available GIR modules in ./vala-girs/gir-1.0"],
|
|
26496
26706
|
[
|
|
26497
26707
|
`${APP_NAME} list --ignore=Gtk-3.0 xrandr-1.3`,
|
|
26498
26708
|
"Lists all available GIR modules in /usr/share/gir-1.0 but not Gtk-3.0 and xrandr-1.3"
|
|
26499
26709
|
]
|
|
26500
26710
|
];
|
|
26501
|
-
var
|
|
26502
|
-
var
|
|
26711
|
+
var builder7 = createBuilder(listOptions, examples7);
|
|
26712
|
+
var handler7 = async (args) => {
|
|
26503
26713
|
const config = await load(args);
|
|
26504
26714
|
const generateConfig = getOptionsGeneration(config);
|
|
26505
26715
|
const registry = new NSRegistry();
|
|
@@ -26540,15 +26750,15 @@ var handler6 = async (args) => {
|
|
|
26540
26750
|
}
|
|
26541
26751
|
};
|
|
26542
26752
|
var list = {
|
|
26543
|
-
command:
|
|
26544
|
-
description:
|
|
26545
|
-
builder:
|
|
26546
|
-
handler:
|
|
26547
|
-
examples:
|
|
26753
|
+
command: command7,
|
|
26754
|
+
description: description7,
|
|
26755
|
+
builder: builder7,
|
|
26756
|
+
handler: handler7,
|
|
26757
|
+
examples: examples7
|
|
26548
26758
|
};
|
|
26549
26759
|
|
|
26550
26760
|
// src/start.ts
|
|
26551
|
-
void yargs(hideBin(process.argv)).scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).command(analyze).command(generate).command(json2).command(list).command(copy).command(doc).demandCommand(1).help().argv;
|
|
26761
|
+
void yargs(hideBin(process.argv)).scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).command(analyze).command(create).command(generate).command(json2).command(list).command(copy).command(doc).demandCommand(1).help().argv;
|
|
26552
26762
|
/*! Bundled license information:
|
|
26553
26763
|
|
|
26554
26764
|
lodash/lodash.js:
|