@mp-lb/forum-cli 0.1.8 → 0.1.9
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/index.js +38 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32246,7 +32246,11 @@ var rawFileId = (href) => {
|
|
|
32246
32246
|
try {
|
|
32247
32247
|
const url2 = new URL(href);
|
|
32248
32248
|
const parts = url2.pathname.split("/").filter(Boolean);
|
|
32249
|
-
|
|
32249
|
+
if (url2.search || url2.hash) return null;
|
|
32250
|
+
if ((url2.hostname === "hyperdoc.forumlabs.net" || url2.hostname === "dx.ink") && parts.length === 1) {
|
|
32251
|
+
return decodeURIComponent(parts[0] ?? "");
|
|
32252
|
+
}
|
|
32253
|
+
return url2.hostname === "app.forumlabs.net" && parts.length === 2 && parts[0] === "raw-file" ? decodeURIComponent(parts[1] ?? "") : null;
|
|
32250
32254
|
} catch {
|
|
32251
32255
|
return null;
|
|
32252
32256
|
}
|
|
@@ -32373,6 +32377,7 @@ Usage:
|
|
|
32373
32377
|
fm file ls [directoryPath] [--store <storeId>] [--token <jwt>]
|
|
32374
32378
|
fm file read <filePath> [--store <storeId>] [--token <jwt>]
|
|
32375
32379
|
fm compile <workspace>/<store> <entry-file> [-o <output-file>] [--optional] [--token <jwt>]
|
|
32380
|
+
fm compile --stdin [-o <output-file>] [--optional] [--token <jwt>]
|
|
32376
32381
|
fm file info <filePath> [--store <storeId>] [--token <jwt>]
|
|
32377
32382
|
fm file move <sourcePath> <destinationPath> [--store <storeId>] [--token <jwt>]
|
|
32378
32383
|
fm file delete <filePath> [--store <storeId>] [--token <jwt>]
|
|
@@ -32539,6 +32544,7 @@ var parseArgs = (argv) => {
|
|
|
32539
32544
|
let notify = false;
|
|
32540
32545
|
let openBrowser = true;
|
|
32541
32546
|
let optional2 = false;
|
|
32547
|
+
let stdin = false;
|
|
32542
32548
|
let readonly2 = false;
|
|
32543
32549
|
let verbose = false;
|
|
32544
32550
|
let watch3 = false;
|
|
@@ -32693,6 +32699,10 @@ var parseArgs = (argv) => {
|
|
|
32693
32699
|
optional2 = true;
|
|
32694
32700
|
continue;
|
|
32695
32701
|
}
|
|
32702
|
+
if (current === "--stdin") {
|
|
32703
|
+
stdin = true;
|
|
32704
|
+
continue;
|
|
32705
|
+
}
|
|
32696
32706
|
if (isSyncCommand && (current === "-p" || current === "--prioritize" || current.startsWith("--prioritize="))) {
|
|
32697
32707
|
const value = current.startsWith("--prioritize=") ? current.slice("--prioritize=".length) : next;
|
|
32698
32708
|
if (value !== "local" && value !== "remote") {
|
|
@@ -32781,6 +32791,7 @@ var parseArgs = (argv) => {
|
|
|
32781
32791
|
notify,
|
|
32782
32792
|
openBrowser,
|
|
32783
32793
|
optional: optional2,
|
|
32794
|
+
stdin,
|
|
32784
32795
|
readonly: readonly2,
|
|
32785
32796
|
verbose,
|
|
32786
32797
|
watch: watch3,
|
|
@@ -37965,19 +37976,33 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37965
37976
|
}
|
|
37966
37977
|
if (command === "compile") {
|
|
37967
37978
|
const [storeInput, entryPath, ...extra] = rest;
|
|
37968
|
-
|
|
37969
|
-
|
|
37970
|
-
|
|
37971
|
-
|
|
37972
|
-
|
|
37973
|
-
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
37979
|
+
let entry;
|
|
37980
|
+
if (parsed.stdin) {
|
|
37981
|
+
if (rest.length > 0) {
|
|
37982
|
+
throw new Error(
|
|
37983
|
+
`Usage: ${commandNames} compile --stdin [-o <output-file>] [--optional]`
|
|
37984
|
+
);
|
|
37985
|
+
}
|
|
37986
|
+
entry = {
|
|
37987
|
+
id: "stdin",
|
|
37988
|
+
path: "stdin",
|
|
37989
|
+
content: { text: await readStdinText() }
|
|
37990
|
+
};
|
|
37991
|
+
} else {
|
|
37992
|
+
if (!storeInput || !entryPath || extra.length > 0) {
|
|
37993
|
+
throw new Error(
|
|
37994
|
+
`Usage: ${commandNames} compile <workspace>/<store> <entry-file> [-o <output-file>] [--optional]`
|
|
37995
|
+
);
|
|
37996
|
+
}
|
|
37997
|
+
if (!isMarkdownStorePath(entryPath)) {
|
|
37998
|
+
throw new Error(
|
|
37999
|
+
`Compile only supports Forum-hosted Markdown files: ${entryPath}`
|
|
38000
|
+
);
|
|
38001
|
+
}
|
|
38002
|
+
const storeRef = await resolveOwnStoreRef(storeInput, client);
|
|
38003
|
+
entry = await client.readFileByRef({ ...storeRef, path: entryPath });
|
|
38004
|
+
if (!entry) throw new Error(`Entry file not found: ${entryPath}`);
|
|
37977
38005
|
}
|
|
37978
|
-
const storeRef = await resolveOwnStoreRef(storeInput, client);
|
|
37979
|
-
const entry = await client.readFileByRef({ ...storeRef, path: entryPath });
|
|
37980
|
-
if (!entry) throw new Error(`Entry file not found: ${entryPath}`);
|
|
37981
38006
|
const result = await compileMarkdown({
|
|
37982
38007
|
entry,
|
|
37983
38008
|
optional: parsed.optional,
|