@riboseinc/anafero-cli 0.0.46 → 0.0.48
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/bootstrap.js +34 -27
- package/bootstrap.js.map +3 -3
- package/build-site.mjs +450 -268
- package/dependencies.mts +326 -174
- package/generate-to-filesystem.tsx +57 -11
- package/package.json +1 -1
- package/riboseinc-anafero-cli-0.0.48.tgz +0 -0
- package/riboseinc-anafero-cli-0.0.46.tgz +0 -0
package/build-site.mjs
CHANGED
|
@@ -9378,7 +9378,7 @@ var require_isomorphic_git = __commonJS({
|
|
|
9378
9378
|
}
|
|
9379
9379
|
function flatFileListToDirectoryStructure(files) {
|
|
9380
9380
|
const inodes = /* @__PURE__ */ new Map();
|
|
9381
|
-
const
|
|
9381
|
+
const mkdir4 = function(name2) {
|
|
9382
9382
|
if (!inodes.has(name2)) {
|
|
9383
9383
|
const dir3 = {
|
|
9384
9384
|
type: "tree",
|
|
@@ -9388,7 +9388,7 @@ var require_isomorphic_git = __commonJS({
|
|
|
9388
9388
|
children: []
|
|
9389
9389
|
};
|
|
9390
9390
|
inodes.set(name2, dir3);
|
|
9391
|
-
dir3.parent =
|
|
9391
|
+
dir3.parent = mkdir4(dirname3(name2));
|
|
9392
9392
|
if (dir3.parent && dir3.parent !== dir3) dir3.parent.children.push(dir3);
|
|
9393
9393
|
}
|
|
9394
9394
|
return inodes.get(name2);
|
|
@@ -9401,7 +9401,7 @@ var require_isomorphic_git = __commonJS({
|
|
|
9401
9401
|
basename: basename2(name2),
|
|
9402
9402
|
metadata,
|
|
9403
9403
|
// This recursively generates any missing parent folders.
|
|
9404
|
-
parent:
|
|
9404
|
+
parent: mkdir4(dirname3(name2)),
|
|
9405
9405
|
children: []
|
|
9406
9406
|
};
|
|
9407
9407
|
if (file4.parent) file4.parent.children.push(file4);
|
|
@@ -9409,7 +9409,7 @@ var require_isomorphic_git = __commonJS({
|
|
|
9409
9409
|
}
|
|
9410
9410
|
return inodes.get(name2);
|
|
9411
9411
|
};
|
|
9412
|
-
|
|
9412
|
+
mkdir4(".");
|
|
9413
9413
|
for (const file4 of files) {
|
|
9414
9414
|
mkfile(file4.path, file4);
|
|
9415
9415
|
}
|
|
@@ -48933,8 +48933,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
48933
48933
|
lastRenderedState: initialState3
|
|
48934
48934
|
};
|
|
48935
48935
|
hook.queue = queue;
|
|
48936
|
-
var
|
|
48937
|
-
return [hook.memoizedState,
|
|
48936
|
+
var dispatch2 = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
|
|
48937
|
+
return [hook.memoizedState, dispatch2];
|
|
48938
48938
|
}
|
|
48939
48939
|
function updateReducer(reducer, initialArg, init) {
|
|
48940
48940
|
var hook = updateWorkInProgressHook();
|
|
@@ -49034,8 +49034,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
49034
49034
|
} else if (baseQueue === null) {
|
|
49035
49035
|
queue.lanes = NoLanes;
|
|
49036
49036
|
}
|
|
49037
|
-
var
|
|
49038
|
-
return [hook.memoizedState,
|
|
49037
|
+
var dispatch2 = queue.dispatch;
|
|
49038
|
+
return [hook.memoizedState, dispatch2];
|
|
49039
49039
|
}
|
|
49040
49040
|
function rerenderReducer(reducer, initialArg, init) {
|
|
49041
49041
|
var hook = updateWorkInProgressHook();
|
|
@@ -49044,7 +49044,7 @@ var require_react_reconciler_development = __commonJS({
|
|
|
49044
49044
|
throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
49045
49045
|
}
|
|
49046
49046
|
queue.lastRenderedReducer = reducer;
|
|
49047
|
-
var
|
|
49047
|
+
var dispatch2 = queue.dispatch;
|
|
49048
49048
|
var lastRenderPhaseUpdate = queue.pending;
|
|
49049
49049
|
var newState = hook.memoizedState;
|
|
49050
49050
|
if (lastRenderPhaseUpdate !== null) {
|
|
@@ -49065,7 +49065,7 @@ var require_react_reconciler_development = __commonJS({
|
|
|
49065
49065
|
}
|
|
49066
49066
|
queue.lastRenderedState = newState;
|
|
49067
49067
|
}
|
|
49068
|
-
return [newState,
|
|
49068
|
+
return [newState, dispatch2];
|
|
49069
49069
|
}
|
|
49070
49070
|
function mountMutableSource(source, getSnapshot, subscribe4) {
|
|
49071
49071
|
{
|
|
@@ -49227,8 +49227,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
49227
49227
|
lastRenderedState: initialState3
|
|
49228
49228
|
};
|
|
49229
49229
|
hook.queue = queue;
|
|
49230
|
-
var
|
|
49231
|
-
return [hook.memoizedState,
|
|
49230
|
+
var dispatch2 = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
|
|
49231
|
+
return [hook.memoizedState, dispatch2];
|
|
49232
49232
|
}
|
|
49233
49233
|
function updateState(initialState3) {
|
|
49234
49234
|
return updateReducer(basicStateReducer);
|
|
@@ -59385,7 +59385,7 @@ var require_stack_utils = __commonJS({
|
|
|
59385
59385
|
"use strict";
|
|
59386
59386
|
init_cjs_shim();
|
|
59387
59387
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
59388
|
-
var
|
|
59388
|
+
var cwd3 = typeof process === "object" && process && typeof process.cwd === "function" ? process.cwd() : ".";
|
|
59389
59389
|
var natives = [].concat(
|
|
59390
59390
|
__require("module").builtinModules,
|
|
59391
59391
|
"bootstrap_node",
|
|
@@ -59406,7 +59406,7 @@ var require_stack_utils = __commonJS({
|
|
|
59406
59406
|
opts.internals = _StackUtils.nodeInternals();
|
|
59407
59407
|
}
|
|
59408
59408
|
if ("cwd" in opts === false) {
|
|
59409
|
-
opts.cwd =
|
|
59409
|
+
opts.cwd = cwd3;
|
|
59410
59410
|
}
|
|
59411
59411
|
this._cwd = opts.cwd.replace(/\\/g, "/");
|
|
59412
59412
|
this._internals = [].concat(
|
|
@@ -59609,11 +59609,11 @@ var require_stack_utils = __commonJS({
|
|
|
59609
59609
|
return res;
|
|
59610
59610
|
}
|
|
59611
59611
|
};
|
|
59612
|
-
function setFile(result, filename,
|
|
59612
|
+
function setFile(result, filename, cwd4) {
|
|
59613
59613
|
if (filename) {
|
|
59614
59614
|
filename = filename.replace(/\\/g, "/");
|
|
59615
|
-
if (filename.startsWith(`${
|
|
59616
|
-
filename = filename.slice(
|
|
59615
|
+
if (filename.startsWith(`${cwd4}/`)) {
|
|
59616
|
+
filename = filename.slice(cwd4.length + 1);
|
|
59617
59617
|
}
|
|
59618
59618
|
result.file = filename;
|
|
59619
59619
|
}
|
|
@@ -201280,7 +201280,7 @@ var require_react_dom_server_legacy_node_development = __commonJS({
|
|
|
201280
201280
|
workInProgressHook = createWorkInProgressHook();
|
|
201281
201281
|
if (isReRender) {
|
|
201282
201282
|
var queue = workInProgressHook.queue;
|
|
201283
|
-
var
|
|
201283
|
+
var dispatch2 = queue.dispatch;
|
|
201284
201284
|
if (renderPhaseUpdates !== null) {
|
|
201285
201285
|
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
|
201286
201286
|
if (firstRenderPhaseUpdate !== void 0) {
|
|
@@ -201299,10 +201299,10 @@ var require_react_dom_server_legacy_node_development = __commonJS({
|
|
|
201299
201299
|
update5 = update5.next;
|
|
201300
201300
|
} while (update5 !== null);
|
|
201301
201301
|
workInProgressHook.memoizedState = newState;
|
|
201302
|
-
return [newState,
|
|
201302
|
+
return [newState, dispatch2];
|
|
201303
201303
|
}
|
|
201304
201304
|
}
|
|
201305
|
-
return [workInProgressHook.memoizedState,
|
|
201305
|
+
return [workInProgressHook.memoizedState, dispatch2];
|
|
201306
201306
|
} else {
|
|
201307
201307
|
{
|
|
201308
201308
|
isInHookUserCodeInDev = true;
|
|
@@ -206760,7 +206760,7 @@ var require_react_dom_server_node_development = __commonJS({
|
|
|
206760
206760
|
workInProgressHook = createWorkInProgressHook();
|
|
206761
206761
|
if (isReRender) {
|
|
206762
206762
|
var queue = workInProgressHook.queue;
|
|
206763
|
-
var
|
|
206763
|
+
var dispatch2 = queue.dispatch;
|
|
206764
206764
|
if (renderPhaseUpdates !== null) {
|
|
206765
206765
|
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
|
206766
206766
|
if (firstRenderPhaseUpdate !== void 0) {
|
|
@@ -206779,10 +206779,10 @@ var require_react_dom_server_node_development = __commonJS({
|
|
|
206779
206779
|
update5 = update5.next;
|
|
206780
206780
|
} while (update5 !== null);
|
|
206781
206781
|
workInProgressHook.memoizedState = newState;
|
|
206782
|
-
return [newState,
|
|
206782
|
+
return [newState, dispatch2];
|
|
206783
206783
|
}
|
|
206784
206784
|
}
|
|
206785
|
-
return [workInProgressHook.memoizedState,
|
|
206785
|
+
return [workInProgressHook.memoizedState, dispatch2];
|
|
206786
206786
|
} else {
|
|
206787
206787
|
{
|
|
206788
206788
|
isInHookUserCodeInDev = true;
|
|
@@ -228007,8 +228007,8 @@ var require_react_dom_development = __commonJS({
|
|
|
228007
228007
|
lastRenderedState: initialState3
|
|
228008
228008
|
};
|
|
228009
228009
|
hook.queue = queue;
|
|
228010
|
-
var
|
|
228011
|
-
return [hook.memoizedState,
|
|
228010
|
+
var dispatch2 = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
|
|
228011
|
+
return [hook.memoizedState, dispatch2];
|
|
228012
228012
|
}
|
|
228013
228013
|
function updateReducer(reducer, initialArg, init) {
|
|
228014
228014
|
var hook = updateWorkInProgressHook();
|
|
@@ -228108,8 +228108,8 @@ var require_react_dom_development = __commonJS({
|
|
|
228108
228108
|
} else if (baseQueue === null) {
|
|
228109
228109
|
queue.lanes = NoLanes;
|
|
228110
228110
|
}
|
|
228111
|
-
var
|
|
228112
|
-
return [hook.memoizedState,
|
|
228111
|
+
var dispatch2 = queue.dispatch;
|
|
228112
|
+
return [hook.memoizedState, dispatch2];
|
|
228113
228113
|
}
|
|
228114
228114
|
function rerenderReducer(reducer, initialArg, init) {
|
|
228115
228115
|
var hook = updateWorkInProgressHook();
|
|
@@ -228118,7 +228118,7 @@ var require_react_dom_development = __commonJS({
|
|
|
228118
228118
|
throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
228119
228119
|
}
|
|
228120
228120
|
queue.lastRenderedReducer = reducer;
|
|
228121
|
-
var
|
|
228121
|
+
var dispatch2 = queue.dispatch;
|
|
228122
228122
|
var lastRenderPhaseUpdate = queue.pending;
|
|
228123
228123
|
var newState = hook.memoizedState;
|
|
228124
228124
|
if (lastRenderPhaseUpdate !== null) {
|
|
@@ -228139,7 +228139,7 @@ var require_react_dom_development = __commonJS({
|
|
|
228139
228139
|
}
|
|
228140
228140
|
queue.lastRenderedState = newState;
|
|
228141
228141
|
}
|
|
228142
|
-
return [newState,
|
|
228142
|
+
return [newState, dispatch2];
|
|
228143
228143
|
}
|
|
228144
228144
|
function mountMutableSource(source, getSnapshot, subscribe4) {
|
|
228145
228145
|
{
|
|
@@ -228301,8 +228301,8 @@ var require_react_dom_development = __commonJS({
|
|
|
228301
228301
|
lastRenderedState: initialState3
|
|
228302
228302
|
};
|
|
228303
228303
|
hook.queue = queue;
|
|
228304
|
-
var
|
|
228305
|
-
return [hook.memoizedState,
|
|
228304
|
+
var dispatch2 = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
|
|
228305
|
+
return [hook.memoizedState, dispatch2];
|
|
228306
228306
|
}
|
|
228307
228307
|
function updateState(initialState3) {
|
|
228308
228308
|
return updateReducer(basicStateReducer);
|
|
@@ -246248,7 +246248,7 @@ var import_isomorphic_git2 = __toESM(require_isomorphic_git(), 1);
|
|
|
246248
246248
|
var import_util = __toESM(require_util(), 1);
|
|
246249
246249
|
var import_isogit_lfs = __toESM(require_isogit_lfs(), 1);
|
|
246250
246250
|
import { resolve as resolve3, dirname as dirname2, extname, join as join8 } from "node:path";
|
|
246251
|
-
import { readFile as readFile4, writeFile as
|
|
246251
|
+
import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir3, stat as stat5 } from "node:fs/promises";
|
|
246252
246252
|
import { parse as parseURL } from "node:url";
|
|
246253
246253
|
import { createServer } from "node:http";
|
|
246254
246254
|
import { watch as watch3 } from "node:fs/promises";
|
|
@@ -275838,17 +275838,17 @@ function fromFileUrl(url3) {
|
|
|
275838
275838
|
var resolve = function resolve2() {
|
|
275839
275839
|
let resolvedPath = "";
|
|
275840
275840
|
let resolvedAbsolute = false;
|
|
275841
|
-
let
|
|
275841
|
+
let cwd3 = void 0;
|
|
275842
275842
|
for (let i2 = arguments.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
|
|
275843
275843
|
let path3;
|
|
275844
275844
|
if (i2 >= 0) {
|
|
275845
275845
|
path3 = arguments[i2];
|
|
275846
275846
|
} else {
|
|
275847
275847
|
const process14 = globalThis.process;
|
|
275848
|
-
if (
|
|
275849
|
-
|
|
275848
|
+
if (cwd3 === void 0 && "process" in globalThis && typeof process14 === "object" && process14 !== null && typeof process14.cwd === "function") {
|
|
275849
|
+
cwd3 = process14.cwd();
|
|
275850
275850
|
}
|
|
275851
|
-
path3 =
|
|
275851
|
+
path3 = cwd3;
|
|
275852
275852
|
}
|
|
275853
275853
|
if (path3.length === 0) {
|
|
275854
275854
|
continue;
|
|
@@ -287269,7 +287269,7 @@ var image = (data, options3 = {}) => {
|
|
|
287269
287269
|
return returnValue + ":" + Buffer.from(data).toString("base64") + BEL2;
|
|
287270
287270
|
};
|
|
287271
287271
|
var iTerm = {
|
|
287272
|
-
setCwd: (
|
|
287272
|
+
setCwd: (cwd3 = cwdFunction()) => `${OSC}50;CurrentDir=${cwd3}${BEL2}`,
|
|
287273
287273
|
annotation(message, options3 = {}) {
|
|
287274
287274
|
let returnValue = `${OSC}1337;`;
|
|
287275
287275
|
const hasX = options3.x !== void 0;
|
|
@@ -316486,6 +316486,76 @@ function processAttributes(el, locateResource, reverseResource, onIntegrityViola
|
|
|
316486
316486
|
|
|
316487
316487
|
// ../anafero/ContentReader.mts
|
|
316488
316488
|
init_cjs_shim();
|
|
316489
|
+
|
|
316490
|
+
// ../anafero/util/normalizePath.mts
|
|
316491
|
+
init_cjs_shim();
|
|
316492
|
+
var CHAR_DOT = 46;
|
|
316493
|
+
var CHAR_FORWARD_SLASH2 = 47;
|
|
316494
|
+
function normalizeString(path3, allowAboveRoot = false, separator = "/", isPathSeparator = (c2) => c2 === CHAR_FORWARD_SLASH2) {
|
|
316495
|
+
let res = "";
|
|
316496
|
+
let lastSegmentLength = 0;
|
|
316497
|
+
let lastSlash = -1;
|
|
316498
|
+
let dots = 0;
|
|
316499
|
+
let code2 = 0;
|
|
316500
|
+
let isAbsolute = isPathSeparator(path3.charCodeAt(0));
|
|
316501
|
+
for (let i2 = 0; i2 <= path3.length; ++i2) {
|
|
316502
|
+
if (i2 < path3.length) {
|
|
316503
|
+
code2 = path3.charCodeAt(i2);
|
|
316504
|
+
} else if (isPathSeparator(code2)) {
|
|
316505
|
+
break;
|
|
316506
|
+
} else {
|
|
316507
|
+
code2 = CHAR_FORWARD_SLASH2;
|
|
316508
|
+
}
|
|
316509
|
+
if (isPathSeparator(code2)) {
|
|
316510
|
+
if (lastSlash === i2 - 1 || dots === 1) {
|
|
316511
|
+
} else if (dots === 2) {
|
|
316512
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) {
|
|
316513
|
+
if (res.length > 2) {
|
|
316514
|
+
const lastSlashIndex = res.lastIndexOf(separator);
|
|
316515
|
+
if (lastSlashIndex === -1) {
|
|
316516
|
+
res = "";
|
|
316517
|
+
lastSegmentLength = 0;
|
|
316518
|
+
} else {
|
|
316519
|
+
res = res.substring(0, lastSlashIndex);
|
|
316520
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf(separator);
|
|
316521
|
+
}
|
|
316522
|
+
lastSlash = i2;
|
|
316523
|
+
dots = 0;
|
|
316524
|
+
continue;
|
|
316525
|
+
} else if (res.length !== 0) {
|
|
316526
|
+
res = "";
|
|
316527
|
+
lastSegmentLength = 0;
|
|
316528
|
+
lastSlash = i2;
|
|
316529
|
+
dots = 0;
|
|
316530
|
+
continue;
|
|
316531
|
+
}
|
|
316532
|
+
}
|
|
316533
|
+
if (allowAboveRoot && !isAbsolute) {
|
|
316534
|
+
res += res.length > 0 ? `${separator}..` : "..";
|
|
316535
|
+
lastSegmentLength = 2;
|
|
316536
|
+
} else {
|
|
316537
|
+
throw new Error("Cannot step outside current directory or filesystem root");
|
|
316538
|
+
}
|
|
316539
|
+
} else {
|
|
316540
|
+
if (res.length > 0) {
|
|
316541
|
+
res += `${separator}${path3.substring(lastSlash + 1, i2)}`;
|
|
316542
|
+
} else {
|
|
316543
|
+
res = path3.substring(lastSlash + 1, i2);
|
|
316544
|
+
}
|
|
316545
|
+
lastSegmentLength = i2 - lastSlash - 1;
|
|
316546
|
+
}
|
|
316547
|
+
lastSlash = i2;
|
|
316548
|
+
dots = 0;
|
|
316549
|
+
} else if (code2 === CHAR_DOT && dots !== -1) {
|
|
316550
|
+
++dots;
|
|
316551
|
+
} else {
|
|
316552
|
+
dots = -1;
|
|
316553
|
+
}
|
|
316554
|
+
}
|
|
316555
|
+
return isAbsolute ? `/${res}` : res;
|
|
316556
|
+
}
|
|
316557
|
+
|
|
316558
|
+
// ../anafero/ContentReader.mts
|
|
316489
316559
|
var makeContentReader = async function(entryPointURI, storeAdapters, findContentAdapter, { fetchBlob, reportProgress, decodeXML, cache: cache3 }) {
|
|
316490
316560
|
const canonicalURIs = {};
|
|
316491
316561
|
const originalURIs = {};
|
|
@@ -316514,7 +316584,6 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
|
|
|
316514
316584
|
async function expandURI(uri) {
|
|
316515
316585
|
const originalURI2 = originalURIs[uri];
|
|
316516
316586
|
const isFileURI = (originalURI2 ?? uri).startsWith("file:");
|
|
316517
|
-
console.debug("Expanding URI", uri, originalURI2, entryPointURI2);
|
|
316518
316587
|
let expanded;
|
|
316519
316588
|
if (isFileURI) {
|
|
316520
316589
|
const normalizedFileURI = originalURI2 ?? normalizeFileURI(
|
|
@@ -316845,21 +316914,19 @@ var makeContentReader = async function(entryPointURI, storeAdapters, findContent
|
|
|
316845
316914
|
function isValidPathComponent(val) {
|
|
316846
316915
|
return val.indexOf("/") < 0 && val.indexOf(":") < 0 && val.indexOf("#") < 0;
|
|
316847
316916
|
}
|
|
316848
|
-
function normalizeFileURI(
|
|
316849
|
-
const
|
|
316850
|
-
|
|
316851
|
-
|
|
316852
|
-
}
|
|
316917
|
+
function normalizeFileURI(fileURI, baseFileURI) {
|
|
316918
|
+
const rawPath = fileURI.split("file:")[1];
|
|
316919
|
+
const normalizedPath = normalizeString(rawPath);
|
|
316920
|
+
const normalizedURI = `file:${normalizedPath}`;
|
|
316853
316921
|
if (baseFileURI === void 0) {
|
|
316854
|
-
return
|
|
316922
|
+
return normalizedURI;
|
|
316855
316923
|
}
|
|
316856
|
-
const
|
|
316857
|
-
if (!
|
|
316924
|
+
const normalizedBasePath = baseFileURI.startsWith("file:") ? normalizeString(baseFileURI.split("file:")[1]) : void 0;
|
|
316925
|
+
if (!normalizedBasePath) {
|
|
316858
316926
|
throw new Error("Trying to normalize a file: URI, but base URI is not using that scheme");
|
|
316859
316927
|
}
|
|
316860
|
-
const
|
|
316861
|
-
|
|
316862
|
-
return filePath.startsWith("/") ? fileURI : `file:${dirname3}${dirname3 ? "/" : ""}${filePath}`;
|
|
316928
|
+
const dirname3 = normalizedBasePath.indexOf("/") >= 1 ? normalizedBasePath.slice(0, normalizedBasePath.lastIndexOf("/")) : "";
|
|
316929
|
+
return normalizedPath.startsWith("/") ? normalizedURI : `file:${dirname3}${dirname3 ? "/" : ""}${normalizedPath}`;
|
|
316863
316930
|
}
|
|
316864
316931
|
|
|
316865
316932
|
// ../anafero/process.mts
|
|
@@ -317365,7 +317432,7 @@ init_cjs_shim();
|
|
|
317365
317432
|
var import_node = __toESM(require_node2(), 1);
|
|
317366
317433
|
var import_isomorphic_git = __toESM(require_isomorphic_git(), 1);
|
|
317367
317434
|
import { join as join7, basename } from "node:path";
|
|
317368
|
-
import { rmdir, readFile as readFile3, cp as cp2, mkdtemp as mkdtemp2, stat as stat4 } from "node:fs/promises";
|
|
317435
|
+
import { readdir, rmdir, readFile as readFile3, cp as cp2, mkdtemp as mkdtemp2, stat as stat4, mkdir as mkdir2, writeFile as writeFile3 } from "node:fs/promises";
|
|
317369
317436
|
import vm from "node:vm";
|
|
317370
317437
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
317371
317438
|
import fs3 from "node:fs";
|
|
@@ -319863,21 +319930,21 @@ function addColumn(tr, { map: map38, tableStart, table: table3 }, col) {
|
|
|
319863
319930
|
}
|
|
319864
319931
|
return tr;
|
|
319865
319932
|
}
|
|
319866
|
-
function addColumnBefore(state,
|
|
319933
|
+
function addColumnBefore(state, dispatch2) {
|
|
319867
319934
|
if (!isInTable(state))
|
|
319868
319935
|
return false;
|
|
319869
|
-
if (
|
|
319936
|
+
if (dispatch2) {
|
|
319870
319937
|
const rect = selectedRect(state);
|
|
319871
|
-
|
|
319938
|
+
dispatch2(addColumn(state.tr, rect, rect.left));
|
|
319872
319939
|
}
|
|
319873
319940
|
return true;
|
|
319874
319941
|
}
|
|
319875
|
-
function addColumnAfter(state,
|
|
319942
|
+
function addColumnAfter(state, dispatch2) {
|
|
319876
319943
|
if (!isInTable(state))
|
|
319877
319944
|
return false;
|
|
319878
|
-
if (
|
|
319945
|
+
if (dispatch2) {
|
|
319879
319946
|
const rect = selectedRect(state);
|
|
319880
|
-
|
|
319947
|
+
dispatch2(addColumn(state.tr, rect, rect.right));
|
|
319881
319948
|
}
|
|
319882
319949
|
return true;
|
|
319883
319950
|
}
|
|
@@ -319901,10 +319968,10 @@ function removeColumn(tr, { map: map38, table: table3, tableStart }, col) {
|
|
|
319901
319968
|
row += attrs.rowspan;
|
|
319902
319969
|
}
|
|
319903
319970
|
}
|
|
319904
|
-
function deleteColumn(state,
|
|
319971
|
+
function deleteColumn(state, dispatch2) {
|
|
319905
319972
|
if (!isInTable(state))
|
|
319906
319973
|
return false;
|
|
319907
|
-
if (
|
|
319974
|
+
if (dispatch2) {
|
|
319908
319975
|
const rect = selectedRect(state);
|
|
319909
319976
|
const tr = state.tr;
|
|
319910
319977
|
if (rect.left == 0 && rect.right == rect.map.width)
|
|
@@ -319920,7 +319987,7 @@ function deleteColumn(state, dispatch) {
|
|
|
319920
319987
|
rect.table = table3;
|
|
319921
319988
|
rect.map = TableMap.get(table3);
|
|
319922
319989
|
}
|
|
319923
|
-
|
|
319990
|
+
dispatch2(tr);
|
|
319924
319991
|
}
|
|
319925
319992
|
return true;
|
|
319926
319993
|
}
|
|
@@ -319960,21 +320027,21 @@ function addRow(tr, { map: map38, tableStart, table: table3 }, row) {
|
|
|
319960
320027
|
tr.insert(rowPos, tableNodeTypes(table3.type.schema).row.create(null, cells));
|
|
319961
320028
|
return tr;
|
|
319962
320029
|
}
|
|
319963
|
-
function addRowBefore(state,
|
|
320030
|
+
function addRowBefore(state, dispatch2) {
|
|
319964
320031
|
if (!isInTable(state))
|
|
319965
320032
|
return false;
|
|
319966
|
-
if (
|
|
320033
|
+
if (dispatch2) {
|
|
319967
320034
|
const rect = selectedRect(state);
|
|
319968
|
-
|
|
320035
|
+
dispatch2(addRow(state.tr, rect, rect.top));
|
|
319969
320036
|
}
|
|
319970
320037
|
return true;
|
|
319971
320038
|
}
|
|
319972
|
-
function addRowAfter(state,
|
|
320039
|
+
function addRowAfter(state, dispatch2) {
|
|
319973
320040
|
if (!isInTable(state))
|
|
319974
320041
|
return false;
|
|
319975
|
-
if (
|
|
320042
|
+
if (dispatch2) {
|
|
319976
320043
|
const rect = selectedRect(state);
|
|
319977
|
-
|
|
320044
|
+
dispatch2(addRow(state.tr, rect, rect.bottom));
|
|
319978
320045
|
}
|
|
319979
320046
|
return true;
|
|
319980
320047
|
}
|
|
@@ -320011,10 +320078,10 @@ function removeRow(tr, { map: map38, table: table3, tableStart }, row) {
|
|
|
320011
320078
|
}
|
|
320012
320079
|
}
|
|
320013
320080
|
}
|
|
320014
|
-
function deleteRow(state,
|
|
320081
|
+
function deleteRow(state, dispatch2) {
|
|
320015
320082
|
if (!isInTable(state))
|
|
320016
320083
|
return false;
|
|
320017
|
-
if (
|
|
320084
|
+
if (dispatch2) {
|
|
320018
320085
|
const rect = selectedRect(state), tr = state.tr;
|
|
320019
320086
|
if (rect.top == 0 && rect.bottom == rect.map.height)
|
|
320020
320087
|
return false;
|
|
@@ -320029,7 +320096,7 @@ function deleteRow(state, dispatch) {
|
|
|
320029
320096
|
rect.table = table3;
|
|
320030
320097
|
rect.map = TableMap.get(rect.table);
|
|
320031
320098
|
}
|
|
320032
|
-
|
|
320099
|
+
dispatch2(tr);
|
|
320033
320100
|
}
|
|
320034
320101
|
return true;
|
|
320035
320102
|
}
|
|
@@ -320054,14 +320121,14 @@ function cellsOverlapRectangle({ width: width3, height, map: map38 }, rect) {
|
|
|
320054
320121
|
}
|
|
320055
320122
|
return false;
|
|
320056
320123
|
}
|
|
320057
|
-
function mergeCells(state,
|
|
320124
|
+
function mergeCells(state, dispatch2) {
|
|
320058
320125
|
const sel = state.selection;
|
|
320059
320126
|
if (!(sel instanceof CellSelection) || sel.$anchorCell.pos == sel.$headCell.pos)
|
|
320060
320127
|
return false;
|
|
320061
320128
|
const rect = selectedRect(state), { map: map38 } = rect;
|
|
320062
320129
|
if (cellsOverlapRectangle(map38, rect))
|
|
320063
320130
|
return false;
|
|
320064
|
-
if (
|
|
320131
|
+
if (dispatch2) {
|
|
320065
320132
|
const tr = state.tr;
|
|
320066
320133
|
const seen = {};
|
|
320067
320134
|
let content = Fragment.empty;
|
|
@@ -320104,18 +320171,18 @@ function mergeCells(state, dispatch) {
|
|
|
320104
320171
|
tr.setSelection(
|
|
320105
320172
|
new CellSelection(tr.doc.resolve(mergedPos + rect.tableStart))
|
|
320106
320173
|
);
|
|
320107
|
-
|
|
320174
|
+
dispatch2(tr);
|
|
320108
320175
|
}
|
|
320109
320176
|
return true;
|
|
320110
320177
|
}
|
|
320111
|
-
function splitCell(state,
|
|
320178
|
+
function splitCell(state, dispatch2) {
|
|
320112
320179
|
const nodeTypes = tableNodeTypes(state.schema);
|
|
320113
320180
|
return splitCellWithType(({ node }) => {
|
|
320114
320181
|
return nodeTypes[node.type.spec.tableRole];
|
|
320115
|
-
})(state,
|
|
320182
|
+
})(state, dispatch2);
|
|
320116
320183
|
}
|
|
320117
320184
|
function splitCellWithType(getCellType) {
|
|
320118
|
-
return (state,
|
|
320185
|
+
return (state, dispatch2) => {
|
|
320119
320186
|
var _a;
|
|
320120
320187
|
const sel = state.selection;
|
|
320121
320188
|
let cellNode;
|
|
@@ -320137,7 +320204,7 @@ function splitCellWithType(getCellType) {
|
|
|
320137
320204
|
if (cellNode.attrs.colspan == 1 && cellNode.attrs.rowspan == 1) {
|
|
320138
320205
|
return false;
|
|
320139
320206
|
}
|
|
320140
|
-
if (
|
|
320207
|
+
if (dispatch2) {
|
|
320141
320208
|
let baseAttrs = cellNode.attrs;
|
|
320142
320209
|
const attrs = [];
|
|
320143
320210
|
const colwidth = baseAttrs.colwidth;
|
|
@@ -320179,19 +320246,19 @@ function splitCellWithType(getCellType) {
|
|
|
320179
320246
|
lastCell ? tr.doc.resolve(lastCell) : void 0
|
|
320180
320247
|
)
|
|
320181
320248
|
);
|
|
320182
|
-
|
|
320249
|
+
dispatch2(tr);
|
|
320183
320250
|
}
|
|
320184
320251
|
return true;
|
|
320185
320252
|
};
|
|
320186
320253
|
}
|
|
320187
320254
|
function setCellAttr(name2, value5) {
|
|
320188
|
-
return function(state,
|
|
320255
|
+
return function(state, dispatch2) {
|
|
320189
320256
|
if (!isInTable(state))
|
|
320190
320257
|
return false;
|
|
320191
320258
|
const $cell = selectionCell(state);
|
|
320192
320259
|
if ($cell.nodeAfter.attrs[name2] === value5)
|
|
320193
320260
|
return false;
|
|
320194
|
-
if (
|
|
320261
|
+
if (dispatch2) {
|
|
320195
320262
|
const tr = state.tr;
|
|
320196
320263
|
if (state.selection instanceof CellSelection)
|
|
320197
320264
|
state.selection.forEachCell((node, pos) => {
|
|
@@ -320206,16 +320273,16 @@ function setCellAttr(name2, value5) {
|
|
|
320206
320273
|
...$cell.nodeAfter.attrs,
|
|
320207
320274
|
[name2]: value5
|
|
320208
320275
|
});
|
|
320209
|
-
|
|
320276
|
+
dispatch2(tr);
|
|
320210
320277
|
}
|
|
320211
320278
|
return true;
|
|
320212
320279
|
};
|
|
320213
320280
|
}
|
|
320214
320281
|
function deprecated_toggleHeader(type2) {
|
|
320215
|
-
return function(state,
|
|
320282
|
+
return function(state, dispatch2) {
|
|
320216
320283
|
if (!isInTable(state))
|
|
320217
320284
|
return false;
|
|
320218
|
-
if (
|
|
320285
|
+
if (dispatch2) {
|
|
320219
320286
|
const types3 = tableNodeTypes(state.schema);
|
|
320220
320287
|
const rect = selectedRect(state), tr = state.tr;
|
|
320221
320288
|
const cells = rect.map.cellsInRect(
|
|
@@ -320246,7 +320313,7 @@ function deprecated_toggleHeader(type2) {
|
|
|
320246
320313
|
types3.header_cell,
|
|
320247
320314
|
nodes[i2].attrs
|
|
320248
320315
|
);
|
|
320249
|
-
|
|
320316
|
+
dispatch2(tr);
|
|
320250
320317
|
}
|
|
320251
320318
|
return true;
|
|
320252
320319
|
};
|
|
@@ -320270,10 +320337,10 @@ function toggleHeader(type2, options3) {
|
|
|
320270
320337
|
options3 = options3 || { useDeprecatedLogic: false };
|
|
320271
320338
|
if (options3.useDeprecatedLogic)
|
|
320272
320339
|
return deprecated_toggleHeader(type2);
|
|
320273
|
-
return function(state,
|
|
320340
|
+
return function(state, dispatch2) {
|
|
320274
320341
|
if (!isInTable(state))
|
|
320275
320342
|
return false;
|
|
320276
|
-
if (
|
|
320343
|
+
if (dispatch2) {
|
|
320277
320344
|
const types3 = tableNodeTypes(state.schema);
|
|
320278
320345
|
const rect = selectedRect(state), tr = state.tr;
|
|
320279
320346
|
const isHeaderRowEnabled = isHeaderEnabledByType("row", rect, types3);
|
|
@@ -320303,7 +320370,7 @@ function toggleHeader(type2, options3) {
|
|
|
320303
320370
|
tr.setNodeMarkup(cellPos, newType, cell.attrs);
|
|
320304
320371
|
}
|
|
320305
320372
|
});
|
|
320306
|
-
|
|
320373
|
+
dispatch2(tr);
|
|
320307
320374
|
}
|
|
320308
320375
|
return true;
|
|
320309
320376
|
};
|
|
@@ -320345,28 +320412,28 @@ function findNextCell($cell, dir3) {
|
|
|
320345
320412
|
return null;
|
|
320346
320413
|
}
|
|
320347
320414
|
function goToNextCell(direction) {
|
|
320348
|
-
return function(state,
|
|
320415
|
+
return function(state, dispatch2) {
|
|
320349
320416
|
if (!isInTable(state))
|
|
320350
320417
|
return false;
|
|
320351
320418
|
const cell = findNextCell(selectionCell(state), direction);
|
|
320352
320419
|
if (cell == null)
|
|
320353
320420
|
return false;
|
|
320354
|
-
if (
|
|
320421
|
+
if (dispatch2) {
|
|
320355
320422
|
const $cell = state.doc.resolve(cell);
|
|
320356
|
-
|
|
320423
|
+
dispatch2(
|
|
320357
320424
|
state.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView()
|
|
320358
320425
|
);
|
|
320359
320426
|
}
|
|
320360
320427
|
return true;
|
|
320361
320428
|
};
|
|
320362
320429
|
}
|
|
320363
|
-
function deleteTable(state,
|
|
320430
|
+
function deleteTable(state, dispatch2) {
|
|
320364
320431
|
const $pos = state.selection.$anchor;
|
|
320365
320432
|
for (let d = $pos.depth; d > 0; d--) {
|
|
320366
320433
|
const node = $pos.node(d);
|
|
320367
320434
|
if (node.type.spec.tableRole == "table") {
|
|
320368
|
-
if (
|
|
320369
|
-
|
|
320435
|
+
if (dispatch2)
|
|
320436
|
+
dispatch2(
|
|
320370
320437
|
state.tr.delete($pos.before(d), $pos.after(d)).scrollIntoView()
|
|
320371
320438
|
);
|
|
320372
320439
|
return true;
|
|
@@ -320374,11 +320441,11 @@ function deleteTable(state, dispatch) {
|
|
|
320374
320441
|
}
|
|
320375
320442
|
return false;
|
|
320376
320443
|
}
|
|
320377
|
-
function deleteCellSelection(state,
|
|
320444
|
+
function deleteCellSelection(state, dispatch2) {
|
|
320378
320445
|
const sel = state.selection;
|
|
320379
320446
|
if (!(sel instanceof CellSelection))
|
|
320380
320447
|
return false;
|
|
320381
|
-
if (
|
|
320448
|
+
if (dispatch2) {
|
|
320382
320449
|
const tr = state.tr;
|
|
320383
320450
|
const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content;
|
|
320384
320451
|
sel.forEachCell((cell, pos) => {
|
|
@@ -320390,7 +320457,7 @@ function deleteCellSelection(state, dispatch) {
|
|
|
320390
320457
|
);
|
|
320391
320458
|
});
|
|
320392
320459
|
if (tr.docChanged)
|
|
320393
|
-
|
|
320460
|
+
dispatch2(tr);
|
|
320394
320461
|
}
|
|
320395
320462
|
return true;
|
|
320396
320463
|
}
|
|
@@ -320604,7 +320671,7 @@ function isolateVertical(tr, map38, table3, start4, top, bottom, left3, mapFrom)
|
|
|
320604
320671
|
}
|
|
320605
320672
|
return found2;
|
|
320606
320673
|
}
|
|
320607
|
-
function insertCells(state,
|
|
320674
|
+
function insertCells(state, dispatch2, tableStart, rect, cells) {
|
|
320608
320675
|
let table3 = tableStart ? state.doc.nodeAt(tableStart - 1) : state.doc;
|
|
320609
320676
|
if (!table3) {
|
|
320610
320677
|
throw new Error("No table found");
|
|
@@ -320647,7 +320714,7 @@ function insertCells(state, dispatch, tableStart, rect, cells) {
|
|
|
320647
320714
|
tr.doc.resolve(tableStart + map38.positionAt(bottom - 1, right3 - 1, table3))
|
|
320648
320715
|
)
|
|
320649
320716
|
);
|
|
320650
|
-
|
|
320717
|
+
dispatch2(tr);
|
|
320651
320718
|
}
|
|
320652
320719
|
var handleKeyDown = keydownHandler({
|
|
320653
320720
|
ArrowLeft: arrow("horiz", -1),
|
|
@@ -320663,22 +320730,22 @@ var handleKeyDown = keydownHandler({
|
|
|
320663
320730
|
Delete: deleteCellSelection,
|
|
320664
320731
|
"Mod-Delete": deleteCellSelection
|
|
320665
320732
|
});
|
|
320666
|
-
function maybeSetSelection(state,
|
|
320733
|
+
function maybeSetSelection(state, dispatch2, selection) {
|
|
320667
320734
|
if (selection.eq(state.selection))
|
|
320668
320735
|
return false;
|
|
320669
|
-
if (
|
|
320670
|
-
|
|
320736
|
+
if (dispatch2)
|
|
320737
|
+
dispatch2(state.tr.setSelection(selection).scrollIntoView());
|
|
320671
320738
|
return true;
|
|
320672
320739
|
}
|
|
320673
320740
|
function arrow(axis, dir3) {
|
|
320674
|
-
return (state,
|
|
320741
|
+
return (state, dispatch2, view) => {
|
|
320675
320742
|
if (!view)
|
|
320676
320743
|
return false;
|
|
320677
320744
|
const sel = state.selection;
|
|
320678
320745
|
if (sel instanceof CellSelection) {
|
|
320679
320746
|
return maybeSetSelection(
|
|
320680
320747
|
state,
|
|
320681
|
-
|
|
320748
|
+
dispatch2,
|
|
320682
320749
|
Selection.near(sel.$headCell, dir3)
|
|
320683
320750
|
);
|
|
320684
320751
|
}
|
|
@@ -320690,7 +320757,7 @@ function arrow(axis, dir3) {
|
|
|
320690
320757
|
if (axis == "horiz") {
|
|
320691
320758
|
return maybeSetSelection(
|
|
320692
320759
|
state,
|
|
320693
|
-
|
|
320760
|
+
dispatch2,
|
|
320694
320761
|
Selection.near(state.doc.resolve(sel.head + dir3), dir3)
|
|
320695
320762
|
);
|
|
320696
320763
|
} else {
|
|
@@ -320703,12 +320770,12 @@ function arrow(axis, dir3) {
|
|
|
320703
320770
|
newSel = Selection.near(state.doc.resolve($cell.before(-1)), -1);
|
|
320704
320771
|
else
|
|
320705
320772
|
newSel = Selection.near(state.doc.resolve($cell.after(-1)), 1);
|
|
320706
|
-
return maybeSetSelection(state,
|
|
320773
|
+
return maybeSetSelection(state, dispatch2, newSel);
|
|
320707
320774
|
}
|
|
320708
320775
|
};
|
|
320709
320776
|
}
|
|
320710
320777
|
function shiftArrow(axis, dir3) {
|
|
320711
|
-
return (state,
|
|
320778
|
+
return (state, dispatch2, view) => {
|
|
320712
320779
|
if (!view)
|
|
320713
320780
|
return false;
|
|
320714
320781
|
const sel = state.selection;
|
|
@@ -320726,7 +320793,7 @@ function shiftArrow(axis, dir3) {
|
|
|
320726
320793
|
return false;
|
|
320727
320794
|
return maybeSetSelection(
|
|
320728
320795
|
state,
|
|
320729
|
-
|
|
320796
|
+
dispatch2,
|
|
320730
320797
|
new CellSelection(cellSel.$anchorCell, $head)
|
|
320731
320798
|
);
|
|
320732
320799
|
};
|
|
@@ -321300,7 +321367,7 @@ function addListNodes(nodes, itemContent, listGroup) {
|
|
|
321300
321367
|
});
|
|
321301
321368
|
}
|
|
321302
321369
|
function wrapInList(listType, attrs = null) {
|
|
321303
|
-
return function(state,
|
|
321370
|
+
return function(state, dispatch2) {
|
|
321304
321371
|
let { $from, $to } = state.selection;
|
|
321305
321372
|
let range4 = $from.blockRange($to), doJoin = false, outerRange = range4;
|
|
321306
321373
|
if (!range4)
|
|
@@ -321317,8 +321384,8 @@ function wrapInList(listType, attrs = null) {
|
|
|
321317
321384
|
let wrap2 = findWrapping(outerRange, listType, attrs, range4);
|
|
321318
321385
|
if (!wrap2)
|
|
321319
321386
|
return false;
|
|
321320
|
-
if (
|
|
321321
|
-
|
|
321387
|
+
if (dispatch2)
|
|
321388
|
+
dispatch2(doWrapInList(state.tr, range4, wrap2, doJoin, listType).scrollIntoView());
|
|
321322
321389
|
return true;
|
|
321323
321390
|
};
|
|
321324
321391
|
}
|
|
@@ -321343,7 +321410,7 @@ function doWrapInList(tr, range4, wrappers, joinBefore, listType) {
|
|
|
321343
321410
|
return tr;
|
|
321344
321411
|
}
|
|
321345
321412
|
function splitListItem(itemType, itemAttrs) {
|
|
321346
|
-
return function(state,
|
|
321413
|
+
return function(state, dispatch2) {
|
|
321347
321414
|
let { $from, $to, node } = state.selection;
|
|
321348
321415
|
if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to))
|
|
321349
321416
|
return false;
|
|
@@ -321353,7 +321420,7 @@ function splitListItem(itemType, itemAttrs) {
|
|
|
321353
321420
|
if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {
|
|
321354
321421
|
if ($from.depth == 3 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1)
|
|
321355
321422
|
return false;
|
|
321356
|
-
if (
|
|
321423
|
+
if (dispatch2) {
|
|
321357
321424
|
let wrap2 = Fragment.empty;
|
|
321358
321425
|
let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
|
|
321359
321426
|
for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)
|
|
@@ -321371,7 +321438,7 @@ function splitListItem(itemType, itemAttrs) {
|
|
|
321371
321438
|
});
|
|
321372
321439
|
if (sel > -1)
|
|
321373
321440
|
tr2.setSelection(Selection.near(tr2.doc.resolve(sel)));
|
|
321374
|
-
|
|
321441
|
+
dispatch2(tr2.scrollIntoView());
|
|
321375
321442
|
}
|
|
321376
321443
|
return true;
|
|
321377
321444
|
}
|
|
@@ -321380,37 +321447,37 @@ function splitListItem(itemType, itemAttrs) {
|
|
|
321380
321447
|
let types3 = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : void 0;
|
|
321381
321448
|
if (!canSplit(tr.doc, $from.pos, 2, types3))
|
|
321382
321449
|
return false;
|
|
321383
|
-
if (
|
|
321384
|
-
|
|
321450
|
+
if (dispatch2)
|
|
321451
|
+
dispatch2(tr.split($from.pos, 2, types3).scrollIntoView());
|
|
321385
321452
|
return true;
|
|
321386
321453
|
};
|
|
321387
321454
|
}
|
|
321388
321455
|
function splitListItemKeepMarks(itemType, itemAttrs) {
|
|
321389
321456
|
let split4 = splitListItem(itemType, itemAttrs);
|
|
321390
|
-
return (state,
|
|
321391
|
-
return split4(state,
|
|
321457
|
+
return (state, dispatch2) => {
|
|
321458
|
+
return split4(state, dispatch2 && ((tr) => {
|
|
321392
321459
|
let marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
|
|
321393
321460
|
if (marks)
|
|
321394
321461
|
tr.ensureMarks(marks);
|
|
321395
|
-
|
|
321462
|
+
dispatch2(tr);
|
|
321396
321463
|
}));
|
|
321397
321464
|
};
|
|
321398
321465
|
}
|
|
321399
321466
|
function liftListItem(itemType) {
|
|
321400
|
-
return function(state,
|
|
321467
|
+
return function(state, dispatch2) {
|
|
321401
321468
|
let { $from, $to } = state.selection;
|
|
321402
321469
|
let range4 = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
|
|
321403
321470
|
if (!range4)
|
|
321404
321471
|
return false;
|
|
321405
|
-
if (!
|
|
321472
|
+
if (!dispatch2)
|
|
321406
321473
|
return true;
|
|
321407
321474
|
if ($from.node(range4.depth - 1).type == itemType)
|
|
321408
|
-
return liftToOuterList(state,
|
|
321475
|
+
return liftToOuterList(state, dispatch2, itemType, range4);
|
|
321409
321476
|
else
|
|
321410
|
-
return liftOutOfList(state,
|
|
321477
|
+
return liftOutOfList(state, dispatch2, range4);
|
|
321411
321478
|
};
|
|
321412
321479
|
}
|
|
321413
|
-
function liftToOuterList(state,
|
|
321480
|
+
function liftToOuterList(state, dispatch2, itemType, range4) {
|
|
321414
321481
|
let tr = state.tr, end6 = range4.end, endOfList = range4.$to.end(range4.depth);
|
|
321415
321482
|
if (end6 < endOfList) {
|
|
321416
321483
|
tr.step(new ReplaceAroundStep(end6 - 1, endOfList, end6, endOfList, new Slice(Fragment.from(itemType.create(null, range4.parent.copy())), 1, 0), 1, true));
|
|
@@ -321423,10 +321490,10 @@ function liftToOuterList(state, dispatch, itemType, range4) {
|
|
|
321423
321490
|
let after3 = tr.mapping.map(end6, -1) - 1;
|
|
321424
321491
|
if (canJoin(tr.doc, after3))
|
|
321425
321492
|
tr.join(after3);
|
|
321426
|
-
|
|
321493
|
+
dispatch2(tr.scrollIntoView());
|
|
321427
321494
|
return true;
|
|
321428
321495
|
}
|
|
321429
|
-
function liftOutOfList(state,
|
|
321496
|
+
function liftOutOfList(state, dispatch2, range4) {
|
|
321430
321497
|
let tr = state.tr, list4 = range4.parent;
|
|
321431
321498
|
for (let pos = range4.end, i2 = range4.endIndex - 1, e3 = range4.startIndex; i2 > e3; i2--) {
|
|
321432
321499
|
pos -= list4.child(i2).nodeSize;
|
|
@@ -321441,11 +321508,11 @@ function liftOutOfList(state, dispatch, range4) {
|
|
|
321441
321508
|
return false;
|
|
321442
321509
|
let start4 = $start.pos, end6 = start4 + item.nodeSize;
|
|
321443
321510
|
tr.step(new ReplaceAroundStep(start4 - (atStart ? 1 : 0), end6 + (atEnd ? 1 : 0), start4 + 1, end6 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list4.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list4.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
321444
|
-
|
|
321511
|
+
dispatch2(tr.scrollIntoView());
|
|
321445
321512
|
return true;
|
|
321446
321513
|
}
|
|
321447
321514
|
function sinkListItem(itemType) {
|
|
321448
|
-
return function(state,
|
|
321515
|
+
return function(state, dispatch2) {
|
|
321449
321516
|
let { $from, $to } = state.selection;
|
|
321450
321517
|
let range4 = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
|
|
321451
321518
|
if (!range4)
|
|
@@ -321456,12 +321523,12 @@ function sinkListItem(itemType) {
|
|
|
321456
321523
|
let parent = range4.parent, nodeBefore = parent.child(startIndex - 1);
|
|
321457
321524
|
if (nodeBefore.type != itemType)
|
|
321458
321525
|
return false;
|
|
321459
|
-
if (
|
|
321526
|
+
if (dispatch2) {
|
|
321460
321527
|
let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
|
|
321461
321528
|
let inner = Fragment.from(nestedBefore ? itemType.create() : null);
|
|
321462
321529
|
let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
|
|
321463
321530
|
let before2 = range4.start, after3 = range4.end;
|
|
321464
|
-
|
|
321531
|
+
dispatch2(state.tr.step(new ReplaceAroundStep(before2 - (nestedBefore ? 3 : 1), after3, before2, after3, slice, 1, true)).scrollIntoView());
|
|
321465
321532
|
}
|
|
321466
321533
|
return true;
|
|
321467
321534
|
};
|
|
@@ -321537,140 +321604,220 @@ function getDependencySupportingFiles() {
|
|
|
321537
321604
|
}
|
|
321538
321605
|
var decoder2 = new TextDecoder();
|
|
321539
321606
|
var fetchDependency = async function fetchDependency2(moduleRef, onProgress) {
|
|
321540
|
-
if (depRegistry[moduleRef]) {
|
|
321541
|
-
|
|
321542
|
-
|
|
321543
|
-
|
|
321544
|
-
|
|
321545
|
-
|
|
321546
|
-
|
|
321547
|
-
onProgress({ state: `fetching ${moduleRef} to ${localPath}` });
|
|
321548
|
-
sourceDir = await fetchSourceFromGit(moduleRef, onProgress);
|
|
321549
|
-
} else {
|
|
321550
|
-
sourceDir = localPath;
|
|
321551
|
-
}
|
|
321552
|
-
const buildDir = await mkdtemp2(join7(
|
|
321553
|
-
tmpRoot,
|
|
321554
|
-
`anafero-dist-${moduleRef.replace(/[^a-z0-9]/gi, "_")}-`
|
|
321555
|
-
));
|
|
321556
|
-
onProgress({ state: `copying into build dir ${buildDir}` });
|
|
321557
|
-
await cp2(sourceDir, buildDir, { recursive: true });
|
|
321558
|
-
onProgress({ state: "compiling" });
|
|
321559
|
-
const result = await esbuild({
|
|
321560
|
-
//entryPoints: [join(buildDir, 'index.mts')],
|
|
321561
|
-
stdin: {
|
|
321562
|
-
contents: await readFile3(join7(buildDir, "index.mts")),
|
|
321563
|
-
loader: "ts",
|
|
321564
|
-
// TODO: This means we use filesystem when resolving
|
|
321565
|
-
// imports in the entry point. That’s not great, if we
|
|
321566
|
-
// want to build e.g. in the browser.
|
|
321567
|
-
// It may be possible to avoid this by writing a custom
|
|
321568
|
-
// resolver plugin for esbuild. See
|
|
321569
|
-
// - https://github.com/evanw/esbuild/issues/591#issuecomment-742962090
|
|
321570
|
-
// - https://esbuild.github.io/plugins/#on-resolve-arguments
|
|
321571
|
-
resolveDir: buildDir,
|
|
321572
|
-
sourcefile: "index.mts"
|
|
321573
|
-
},
|
|
321574
|
-
loader: {
|
|
321575
|
-
".mts": "ts",
|
|
321576
|
-
".css": "local-css"
|
|
321577
|
-
},
|
|
321578
|
-
entryNames: "[dir]/[name]",
|
|
321579
|
-
assetNames: "[dir]/[name]",
|
|
321580
|
-
format: "esm",
|
|
321581
|
-
target: ["es2022"],
|
|
321582
|
-
tsconfigRaw: "{}",
|
|
321583
|
-
//external: [],
|
|
321584
|
-
packages: "external",
|
|
321585
|
-
//plugins: [{
|
|
321586
|
-
// name: 'plugin-resolver',
|
|
321587
|
-
// setup(build) {
|
|
321588
|
-
// build.onLoad({ filter: /^prosemirror-model-metanorma/ }, args => {
|
|
321589
|
-
// return import(args.path);
|
|
321590
|
-
// });
|
|
321591
|
-
// },
|
|
321592
|
-
//}],
|
|
321593
|
-
minify: false,
|
|
321594
|
-
platform: "browser",
|
|
321595
|
-
write: false,
|
|
321596
|
-
logLevel: "silent",
|
|
321597
|
-
//logLevel: 'info',
|
|
321598
|
-
sourcemap: true,
|
|
321599
|
-
bundle: true,
|
|
321600
|
-
outfile: "index.js",
|
|
321601
|
-
treeShaking: true
|
|
321602
|
-
//outfile,
|
|
321603
|
-
});
|
|
321604
|
-
const otherFiles = {};
|
|
321605
|
-
const mainOutput = result.outputFiles.find(({ path: path3 }) => basename(path3) === "index.js")?.contents;
|
|
321606
|
-
if (!mainOutput) {
|
|
321607
|
-
throw new Error("Fetching dependency: no main output after building");
|
|
321608
|
-
} else if (result.outputFiles.length > 1) {
|
|
321609
|
-
for (const { path: path3, contents } of result.outputFiles) {
|
|
321610
|
-
if (!path3.endsWith("/index.js")) {
|
|
321611
|
-
otherFiles[basename(path3)] = contents;
|
|
321612
|
-
}
|
|
321613
|
-
}
|
|
321614
|
-
}
|
|
321615
|
-
const code2 = decoder2.decode(mainOutput);
|
|
321616
|
-
onProgress({ state: "instantiating module" });
|
|
321617
|
-
const context9 = vm.createContext({
|
|
321618
|
-
Array,
|
|
321619
|
-
Object,
|
|
321620
|
-
crypto,
|
|
321621
|
-
XPathResult,
|
|
321622
|
-
document: getDoc(),
|
|
321623
|
-
console,
|
|
321624
|
-
Function,
|
|
321625
|
-
setTimeout,
|
|
321626
|
-
setInterval,
|
|
321627
|
-
TextEncoder
|
|
321628
|
-
});
|
|
321629
|
-
const mod = new vm.SourceTextModule(code2, {
|
|
321630
|
-
// TODO: Try moduleRef as VM module identifier?
|
|
321631
|
-
// Take care of special characters, though.
|
|
321632
|
-
identifier: "anafero-dependency",
|
|
321633
|
-
context: context9
|
|
321634
|
-
});
|
|
321635
|
-
async function link4(specifier, referencingModule) {
|
|
321636
|
-
if (specifier.startsWith("https://")) {
|
|
321637
|
-
const url3 = new URL(
|
|
321638
|
-
specifier,
|
|
321639
|
-
referencingModule.identifier
|
|
321640
|
-
).toString();
|
|
321641
|
-
const source = await (await fetch(url3)).text();
|
|
321642
|
-
return new vm.SourceTextModule(source, {
|
|
321643
|
-
identifier: url3,
|
|
321644
|
-
context: referencingModule.context
|
|
321645
|
-
});
|
|
321607
|
+
if (!depRegistry[moduleRef]) {
|
|
321608
|
+
depRegistry[moduleRef] = async function resolveDep() {
|
|
321609
|
+
let sourceDir;
|
|
321610
|
+
const localPath = moduleRef.split("file:")[1];
|
|
321611
|
+
if (!localPath) {
|
|
321612
|
+
onProgress({ state: `fetching ${moduleRef} to ${localPath}` });
|
|
321613
|
+
sourceDir = await fetchSourceFromGit(moduleRef, onProgress);
|
|
321646
321614
|
} else {
|
|
321647
|
-
|
|
321648
|
-
|
|
321649
|
-
|
|
321650
|
-
|
|
321651
|
-
|
|
321652
|
-
|
|
321653
|
-
|
|
321654
|
-
|
|
321655
|
-
|
|
321656
|
-
|
|
321657
|
-
|
|
321615
|
+
sourceDir = localPath;
|
|
321616
|
+
}
|
|
321617
|
+
const [bundledCode, otherFiles] = await getDependencyAssets(
|
|
321618
|
+
moduleRef,
|
|
321619
|
+
sourceDir,
|
|
321620
|
+
onProgress
|
|
321621
|
+
);
|
|
321622
|
+
const code2 = decoder2.decode(bundledCode);
|
|
321623
|
+
onProgress({ state: "instantiating module" });
|
|
321624
|
+
const context9 = vm.createContext({
|
|
321625
|
+
Array,
|
|
321626
|
+
Object,
|
|
321627
|
+
crypto,
|
|
321628
|
+
XPathResult,
|
|
321629
|
+
document: getDoc(),
|
|
321630
|
+
console,
|
|
321631
|
+
Function,
|
|
321632
|
+
setTimeout,
|
|
321633
|
+
clearTimeout,
|
|
321634
|
+
setInterval,
|
|
321635
|
+
TextEncoder,
|
|
321636
|
+
TextDecoder,
|
|
321637
|
+
Blob,
|
|
321638
|
+
btoa,
|
|
321639
|
+
atob
|
|
321640
|
+
});
|
|
321641
|
+
const mod = new vm.SourceTextModule(code2, {
|
|
321642
|
+
// TODO: Try moduleRef as VM module identifier?
|
|
321643
|
+
// Take care of special characters, though.
|
|
321644
|
+
identifier: "anafero-dependency",
|
|
321645
|
+
context: context9
|
|
321646
|
+
});
|
|
321647
|
+
async function link4(specifier, referencingModule) {
|
|
321648
|
+
const isAbsoluteURL = specifier.startsWith("https://");
|
|
321649
|
+
let base2;
|
|
321650
|
+
try {
|
|
321651
|
+
new URL(referencingModule.identifier);
|
|
321652
|
+
base2 = referencingModule.identifier;
|
|
321653
|
+
} catch (e3) {
|
|
321654
|
+
base2 = void 0;
|
|
321655
|
+
}
|
|
321656
|
+
const isRelativePath = specifier.startsWith("/") || specifier.startsWith("./") || specifier.startsWith("../");
|
|
321657
|
+
const isRelativeURL = isRelativePath && base2 !== void 0;
|
|
321658
|
+
if (isAbsoluteURL || isRelativeURL) {
|
|
321659
|
+
if (isRelativeURL && base2 === void 0) {
|
|
321660
|
+
throw new Error("Unable to resolve relative specifier without a base");
|
|
321661
|
+
}
|
|
321662
|
+
const url3 = new URL(specifier, base2).toString();
|
|
321663
|
+
const source = await (await fetch(url3)).text();
|
|
321664
|
+
return new vm.SourceTextModule(source, {
|
|
321665
|
+
identifier: url3,
|
|
321658
321666
|
context: referencingModule.context
|
|
321659
|
-
}
|
|
321660
|
-
|
|
321667
|
+
});
|
|
321668
|
+
} else {
|
|
321669
|
+
const madeAvailable = preloaded[specifier] ? preloaded[specifier] : await import(specifier);
|
|
321670
|
+
const exportNames = Object.keys(madeAvailable);
|
|
321671
|
+
return new vm.SyntheticModule(
|
|
321672
|
+
exportNames,
|
|
321673
|
+
function() {
|
|
321674
|
+
for (const name2 of exportNames) {
|
|
321675
|
+
this.setExport(name2, madeAvailable[name2]);
|
|
321676
|
+
}
|
|
321677
|
+
},
|
|
321678
|
+
{
|
|
321679
|
+
identifier: specifier,
|
|
321680
|
+
context: referencingModule.context
|
|
321681
|
+
}
|
|
321682
|
+
);
|
|
321683
|
+
}
|
|
321661
321684
|
}
|
|
321662
|
-
|
|
321663
|
-
|
|
321664
|
-
|
|
321665
|
-
|
|
321666
|
-
|
|
321667
|
-
|
|
321668
|
-
|
|
321669
|
-
|
|
321670
|
-
return defaultExport;
|
|
321671
|
-
}();
|
|
321685
|
+
await mod.link(link4);
|
|
321686
|
+
await mod.evaluate();
|
|
321687
|
+
const defaultExport = mod.namespace.default;
|
|
321688
|
+
dependencySources[moduleRef] = code2;
|
|
321689
|
+
dependencySupportingFiles[moduleRef] = otherFiles;
|
|
321690
|
+
return defaultExport;
|
|
321691
|
+
}();
|
|
321692
|
+
}
|
|
321672
321693
|
return await depRegistry[moduleRef];
|
|
321673
321694
|
};
|
|
321695
|
+
async function getDependencyAssets(moduleRef, sourceDirPath, onProgress) {
|
|
321696
|
+
if (await isPreBuilt(sourceDirPath)) {
|
|
321697
|
+
console.debug("Using pre-built", moduleRef);
|
|
321698
|
+
return await readPreBuiltDependency(sourceDirPath);
|
|
321699
|
+
} else {
|
|
321700
|
+
return await buildDependency(moduleRef, sourceDirPath, onProgress);
|
|
321701
|
+
}
|
|
321702
|
+
}
|
|
321703
|
+
function getPreBuiltRoot(sourceDirPath) {
|
|
321704
|
+
return join7(sourceDirPath, "dist");
|
|
321705
|
+
}
|
|
321706
|
+
async function readPreBuiltJSBundle(sourceDirPath) {
|
|
321707
|
+
const bundlePath = join7(
|
|
321708
|
+
getPreBuiltRoot(sourceDirPath),
|
|
321709
|
+
PRE_BUILT_JS_BUNDLE_FILENAME
|
|
321710
|
+
);
|
|
321711
|
+
const bundleStat = await stat4(bundlePath);
|
|
321712
|
+
if (bundleStat.isFile()) {
|
|
321713
|
+
return readFile3(bundlePath);
|
|
321714
|
+
} else {
|
|
321715
|
+
throw new Error("Pre-built entry point is not a file");
|
|
321716
|
+
}
|
|
321717
|
+
}
|
|
321718
|
+
var PRE_BUILT_JS_BUNDLE_FILENAME = "index.js";
|
|
321719
|
+
async function readPreBuiltAssets(sourceDirPath) {
|
|
321720
|
+
const distroot = getPreBuiltRoot(sourceDirPath);
|
|
321721
|
+
const filenames = await readdir(distroot);
|
|
321722
|
+
const assets = filenames.filter((fn3) => fn3 !== PRE_BUILT_JS_BUNDLE_FILENAME);
|
|
321723
|
+
return (await Promise.all(
|
|
321724
|
+
assets.map(async (fn3) => ({ [fn3]: await readFile3(join7(distroot, fn3)) }))
|
|
321725
|
+
)).reduce((prev, curr) => ({ ...prev, ...curr }), {});
|
|
321726
|
+
}
|
|
321727
|
+
async function writePreBuiltAssets(sourceDirPath, bundledCode, assets) {
|
|
321728
|
+
const distDir = getPreBuiltRoot(sourceDirPath);
|
|
321729
|
+
await mkdir2(distDir);
|
|
321730
|
+
console.debug("Writing index.js");
|
|
321731
|
+
await writeFile3(join7(distDir, PRE_BUILT_JS_BUNDLE_FILENAME), bundledCode);
|
|
321732
|
+
for (const [fn3, blob] of Object.entries(assets)) {
|
|
321733
|
+
console.debug("Writing asset", fn3);
|
|
321734
|
+
await writeFile3(join7(distDir, fn3), blob);
|
|
321735
|
+
}
|
|
321736
|
+
}
|
|
321737
|
+
async function isPreBuilt(sourceDirPath) {
|
|
321738
|
+
try {
|
|
321739
|
+
await readPreBuiltJSBundle(sourceDirPath);
|
|
321740
|
+
await readPreBuiltAssets(sourceDirPath);
|
|
321741
|
+
return true;
|
|
321742
|
+
} catch (e3) {
|
|
321743
|
+
console.error(e3);
|
|
321744
|
+
return false;
|
|
321745
|
+
}
|
|
321746
|
+
}
|
|
321747
|
+
async function readPreBuiltDependency(sourceDirPath) {
|
|
321748
|
+
return [
|
|
321749
|
+
await readPreBuiltJSBundle(sourceDirPath),
|
|
321750
|
+
await readPreBuiltAssets(sourceDirPath)
|
|
321751
|
+
];
|
|
321752
|
+
}
|
|
321753
|
+
async function buildDependency(moduleRef, sourceDir, onProgress) {
|
|
321754
|
+
const buildDir = await mkdtemp2(join7(
|
|
321755
|
+
tmpRoot,
|
|
321756
|
+
`anafero-dist-${moduleRef.replace(/[^a-z0-9]/gi, "_")}-`
|
|
321757
|
+
));
|
|
321758
|
+
onProgress({ state: `copying into build dir ${buildDir}` });
|
|
321759
|
+
await cp2(sourceDir, buildDir, { recursive: true });
|
|
321760
|
+
onProgress({ state: "compiling" });
|
|
321761
|
+
const result = await esbuild({
|
|
321762
|
+
//entryPoints: [join(buildDir, 'index.mts')],
|
|
321763
|
+
stdin: {
|
|
321764
|
+
contents: await readFile3(join7(buildDir, "index.mts")),
|
|
321765
|
+
loader: "ts",
|
|
321766
|
+
// TODO: This means we use filesystem when resolving
|
|
321767
|
+
// imports in the entry point. That’s not great, if we
|
|
321768
|
+
// want to build e.g. in the browser.
|
|
321769
|
+
// It may be possible to avoid this by writing a custom
|
|
321770
|
+
// resolver plugin for esbuild. See
|
|
321771
|
+
// - https://github.com/evanw/esbuild/issues/591#issuecomment-742962090
|
|
321772
|
+
// - https://esbuild.github.io/plugins/#on-resolve-arguments
|
|
321773
|
+
resolveDir: buildDir,
|
|
321774
|
+
sourcefile: "index.mts"
|
|
321775
|
+
},
|
|
321776
|
+
loader: {
|
|
321777
|
+
".mts": "ts",
|
|
321778
|
+
".css": "local-css"
|
|
321779
|
+
},
|
|
321780
|
+
entryNames: "[dir]/[name]",
|
|
321781
|
+
assetNames: "[dir]/[name]",
|
|
321782
|
+
format: "esm",
|
|
321783
|
+
target: ["es2022"],
|
|
321784
|
+
tsconfigRaw: "{}",
|
|
321785
|
+
//external: [],
|
|
321786
|
+
packages: "external",
|
|
321787
|
+
//plugins: [{
|
|
321788
|
+
// name: 'plugin-resolver',
|
|
321789
|
+
// setup(build) {
|
|
321790
|
+
// build.onLoad({ filter: /^prosemirror-model-metanorma/ }, args => {
|
|
321791
|
+
// return import(args.path);
|
|
321792
|
+
// });
|
|
321793
|
+
// },
|
|
321794
|
+
//}],
|
|
321795
|
+
minify: false,
|
|
321796
|
+
platform: "browser",
|
|
321797
|
+
write: false,
|
|
321798
|
+
logLevel: "silent",
|
|
321799
|
+
//logLevel: 'info',
|
|
321800
|
+
sourcemap: true,
|
|
321801
|
+
bundle: true,
|
|
321802
|
+
outfile: "index.js",
|
|
321803
|
+
treeShaking: true
|
|
321804
|
+
//outfile,
|
|
321805
|
+
});
|
|
321806
|
+
onProgress({ state: `removing build dir ${buildDir}` });
|
|
321807
|
+
await rmdir(buildDir, { recursive: true });
|
|
321808
|
+
const otherFiles = {};
|
|
321809
|
+
const mainOutput = result.outputFiles.find(({ path: path3 }) => basename(path3) === "index.js")?.contents;
|
|
321810
|
+
if (!mainOutput) {
|
|
321811
|
+
throw new Error("Fetching dependency: no main output after building");
|
|
321812
|
+
} else if (result.outputFiles.length > 1) {
|
|
321813
|
+
for (const { path: path3, contents } of result.outputFiles) {
|
|
321814
|
+
if (!path3.endsWith("/index.js")) {
|
|
321815
|
+
otherFiles[basename(path3)] = contents;
|
|
321816
|
+
}
|
|
321817
|
+
}
|
|
321818
|
+
}
|
|
321819
|
+
return [mainOutput, otherFiles];
|
|
321820
|
+
}
|
|
321674
321821
|
|
|
321675
321822
|
// util.mts
|
|
321676
321823
|
init_cjs_shim();
|
|
@@ -321699,6 +321846,8 @@ global.window = { location: { host: "" } };
|
|
|
321699
321846
|
var PACKAGE_ROOT = resolve3(join8(import.meta.url.split("file://")[1], ".."));
|
|
321700
321847
|
console.debug("Package root", PACKAGE_ROOT);
|
|
321701
321848
|
var decoder3 = new TextDecoder();
|
|
321849
|
+
var cwd2 = process.cwd();
|
|
321850
|
+
console.debug("Current working directory", cwd2);
|
|
321702
321851
|
Effect_exports.suspend(() => main(process.argv)).pipe(
|
|
321703
321852
|
Effect_exports.provide(NodeContext_exports.layer),
|
|
321704
321853
|
NodeRuntime_exports.runMain
|
|
@@ -321706,8 +321855,38 @@ Effect_exports.suspend(() => main(process.argv)).pipe(
|
|
|
321706
321855
|
function unpackOption(opt, df) {
|
|
321707
321856
|
return Option_exports.isNone(opt) ? df : opt.value;
|
|
321708
321857
|
}
|
|
321709
|
-
var
|
|
321710
|
-
"
|
|
321858
|
+
var dispatch = Command_exports2.make(
|
|
321859
|
+
"npx --node-options='--experimental-vm-modules' -y @riboseinc/anafero-cli",
|
|
321860
|
+
{},
|
|
321861
|
+
() => Effect_exports.log("Pass --help for usage instructions")
|
|
321862
|
+
).pipe(
|
|
321863
|
+
Command_exports2.withDescription("Anafero builder. Use with a subcommand.")
|
|
321864
|
+
);
|
|
321865
|
+
var buildPackage = Command_exports2.make("build-package", reportingOptions, () => Effect_exports.gen(function* (_) {
|
|
321866
|
+
const moduleRef = yield* _(
|
|
321867
|
+
Effect_exports.tryPromise(() => readFile4(join8(cwd2, "package.json"))),
|
|
321868
|
+
Effect_exports.flatMap((blob) => Effect_exports.try(() => decoder3.decode(blob))),
|
|
321869
|
+
Effect_exports.flatMap((pkgRaw) => Effect_exports.try(() => JSON.parse(pkgRaw))),
|
|
321870
|
+
Effect_exports.flatMap((pkg) => Effect_exports.succeed(pkg["name"]))
|
|
321871
|
+
);
|
|
321872
|
+
yield* _(Effect_exports.log(`Building package ${moduleRef}`));
|
|
321873
|
+
const [bundledCode, assets] = yield* _(Effect_exports.tryPromise(() => {
|
|
321874
|
+
return buildDependency(
|
|
321875
|
+
moduleRef,
|
|
321876
|
+
cwd2,
|
|
321877
|
+
(progress) => console.debug(JSON.stringify(progress))
|
|
321878
|
+
);
|
|
321879
|
+
}));
|
|
321880
|
+
yield* _(Effect_exports.tryPromise(() => writePreBuiltAssets(
|
|
321881
|
+
cwd2,
|
|
321882
|
+
bundledCode,
|
|
321883
|
+
assets
|
|
321884
|
+
)));
|
|
321885
|
+
})).pipe(
|
|
321886
|
+
Command_exports2.withDescription("For developers: builds adapter in current directory into `./dist`.")
|
|
321887
|
+
);
|
|
321888
|
+
var buildSite = Command_exports2.make(
|
|
321889
|
+
"build-site",
|
|
321711
321890
|
{
|
|
321712
321891
|
targetDirectoryPath: Options_exports.directory("target-dir"),
|
|
321713
321892
|
pathPrefix: Options_exports.directory("path-prefix").pipe(Options_exports.optional),
|
|
@@ -321795,9 +321974,9 @@ var build2 = Command_exports2.make(
|
|
|
321795
321974
|
))
|
|
321796
321975
|
)
|
|
321797
321976
|
).pipe(
|
|
321798
|
-
Command_exports2.withDescription("
|
|
321977
|
+
Command_exports2.withDescription("Builds a website using current directory as source.")
|
|
321799
321978
|
);
|
|
321800
|
-
var
|
|
321979
|
+
var devSite = Command_exports2.make(
|
|
321801
321980
|
"develop",
|
|
321802
321981
|
{
|
|
321803
321982
|
pkg: Options_exports.directory("package").pipe(Options_exports.optional),
|
|
@@ -321810,10 +321989,10 @@ var dev = Command_exports2.make(
|
|
|
321810
321989
|
// Options.withDefault(8080)),
|
|
321811
321990
|
},
|
|
321812
321991
|
({ pkg, skipBuild }) => Effect_exports.gen(function* (_) {
|
|
321813
|
-
const buildCfg = yield* _(
|
|
321992
|
+
const buildCfg = yield* _(buildSite);
|
|
321814
321993
|
const { targetDirectoryPath } = buildCfg;
|
|
321815
321994
|
if (!skipBuild) {
|
|
321816
|
-
yield*
|
|
321995
|
+
yield* buildSite.handler(buildCfg);
|
|
321817
321996
|
}
|
|
321818
321997
|
const packageDir = unpackOption(pkg);
|
|
321819
321998
|
if (packageDir) {
|
|
@@ -321839,16 +322018,19 @@ var dev = Command_exports2.make(
|
|
|
321839
322018
|
}
|
|
321840
322019
|
})
|
|
321841
322020
|
).pipe(
|
|
321842
|
-
Command_exports2.withDescription("dev mode (watching for changes & copying client-side JS)")
|
|
322021
|
+
Command_exports2.withDescription("Build site in dev mode (watching for changes & copying client-side JS).")
|
|
321843
322022
|
);
|
|
321844
|
-
var main =
|
|
321845
|
-
Command_exports2.withSubcommands([
|
|
322023
|
+
var main = dispatch.pipe(
|
|
322024
|
+
Command_exports2.withSubcommands([
|
|
322025
|
+
buildSite.pipe(Command_exports2.withSubcommands([devSite])),
|
|
322026
|
+
buildPackage
|
|
322027
|
+
]),
|
|
321846
322028
|
Command_exports2.run({
|
|
321847
322029
|
name: "Anafero builder",
|
|
321848
322030
|
version: "N/A"
|
|
321849
322031
|
})
|
|
321850
322032
|
);
|
|
321851
|
-
var gitdir = join8(
|
|
322033
|
+
var gitdir = join8(cwd2, ".git");
|
|
321852
322034
|
async function areWeInGitRepoRoot() {
|
|
321853
322035
|
const gitRepoStat = await stat5(gitdir);
|
|
321854
322036
|
if (gitRepoStat.isDirectory()) {
|
|
@@ -322010,8 +322192,8 @@ async function* generateSite(revisionsToBuild, onProgress, cache3, opts) {
|
|
|
322010
322192
|
async function writeBlobs(root, blobs) {
|
|
322011
322193
|
await Promise.all(Object.entries(blobs).map(async ([filePath, fileBlob]) => {
|
|
322012
322194
|
const fullPath = join8(root, filePath);
|
|
322013
|
-
await
|
|
322014
|
-
await
|
|
322195
|
+
await mkdir3(dirname2(fullPath), { recursive: true });
|
|
322196
|
+
await writeFile4(join8(root, filePath), fileBlob);
|
|
322015
322197
|
}));
|
|
322016
322198
|
}
|
|
322017
322199
|
var copyBootstrapScript = (packagePath, outdir) => Effect_exports.gen(function* (_) {
|