@powerlines/nx 0.10.10 → 0.10.11
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/CHANGELOG.md +12 -0
- package/dist/{chunk-MCZLD3NY.js → chunk-32RH3DSY.js} +1022 -906
- package/dist/{chunk-OUNXRMS7.js → chunk-7SWNXVZN.js} +2 -2
- package/dist/{chunk-EOLGFIVC.js → chunk-DKRIOFPB.js} +2 -2
- package/dist/{chunk-DVGRVHRD.mjs → chunk-FMYWKI25.mjs} +2 -14
- package/dist/{chunk-UMVPNWWR.js → chunk-FZWXH2M7.js} +2 -2
- package/dist/{chunk-L5RBARDS.js → chunk-HAP4APOA.js} +3 -3
- package/dist/{chunk-Y4AEEMCT.mjs → chunk-IWLY4VEK.mjs} +1 -1
- package/dist/{chunk-XO3MCKAF.mjs → chunk-K7X3KSVW.mjs} +1 -1
- package/dist/{chunk-NXUUFBCT.js → chunk-KJAIPQKC.js} +2 -2
- package/dist/{chunk-ODVN2Q6Y.mjs → chunk-KNIZUAS5.mjs} +1 -1
- package/dist/{chunk-UOTRU26N.js → chunk-LTCZN4I4.js} +1 -19
- package/dist/{chunk-AO7OQ26C.mjs → chunk-NSFCCGL7.mjs} +1 -1
- package/dist/{chunk-QWEMU3V4.mjs → chunk-NSLIDWKJ.mjs} +1 -1
- package/dist/{chunk-CYH2EFG7.js → chunk-QJLAFC2D.js} +2 -2
- package/dist/{chunk-RJP4IZYY.mjs → chunk-RIB65IPA.mjs} +1 -1
- package/dist/{chunk-72SMJRRS.mjs → chunk-WMZ45WVV.mjs} +1049 -933
- package/dist/executors.js +12 -12
- package/dist/executors.mjs +7 -7
- package/dist/index.js +14 -14
- package/dist/index.mjs +8 -8
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +2 -2
- package/dist/src/executors/build/executor.js +5 -5
- package/dist/src/executors/build/executor.mjs +3 -3
- package/dist/src/executors/clean/executor.js +5 -5
- package/dist/src/executors/clean/executor.mjs +3 -3
- package/dist/src/executors/docs/executor.js +5 -5
- package/dist/src/executors/docs/executor.mjs +3 -3
- package/dist/src/executors/lint/executor.js +5 -5
- package/dist/src/executors/lint/executor.mjs +3 -3
- package/dist/src/executors/prepare/executor.js +5 -5
- package/dist/src/executors/prepare/executor.mjs +3 -3
- package/dist/src/plugin/index.js +3 -3
- package/dist/src/plugin/index.mjs +2 -2
- package/package.json +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLTCZN4I4_js = require('./chunk-LTCZN4I4.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
var logger = require('@storm-software/config-tools/logger');
|
|
6
6
|
var baseExecutor = require('@storm-software/workspace-tools/base/base-executor');
|
|
7
7
|
var isError = require('@stryke/type-checks/is-error');
|
|
8
|
-
var
|
|
8
|
+
var defu2 = require('defu');
|
|
9
9
|
var core = require('@babel/core');
|
|
10
10
|
var console = require('@storm-software/config-tools/logger/console');
|
|
11
11
|
var types = require('@storm-software/config-tools/types');
|
|
@@ -47,19 +47,21 @@ var uuid = require('@stryke/unique-id/uuid');
|
|
|
47
47
|
var oxcParser = require('oxc-parser');
|
|
48
48
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
49
49
|
var isFile = require('@stryke/fs/is-file');
|
|
50
|
-
var
|
|
51
|
-
var noop = require('@stryke/helpers/noop');
|
|
52
|
-
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
53
|
-
var jiti = require('jiti');
|
|
50
|
+
var $ = require('@stryke/capnp');
|
|
54
51
|
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
55
|
-
var
|
|
52
|
+
var buffer = require('@stryke/fs/buffer');
|
|
56
53
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
57
54
|
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
58
|
-
var
|
|
59
|
-
var buffer = require('buffer');
|
|
55
|
+
var buffer$1 = require('buffer');
|
|
60
56
|
var fs = require('fs');
|
|
61
57
|
var prettier = require('prettier');
|
|
58
|
+
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
59
|
+
var noop = require('@stryke/helpers/noop');
|
|
60
|
+
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
61
|
+
var isParentPath = require('@stryke/path/is-parent-path');
|
|
62
|
+
var volume = require('memfs/lib/node/volume');
|
|
62
63
|
var unionfs = require('unionfs');
|
|
64
|
+
var jiti = require('jiti');
|
|
63
65
|
var isObject = require('@stryke/type-checks/is-object');
|
|
64
66
|
var ts2 = require('typescript');
|
|
65
67
|
var _package = require('@stryke/string-format/package');
|
|
@@ -74,7 +76,6 @@ require('@stryke/fs/read-file');
|
|
|
74
76
|
require('magic-string');
|
|
75
77
|
var kit = require('@nuxt/kit');
|
|
76
78
|
require('@nuxt/schema');
|
|
77
|
-
var $ = require('@stryke/capnp');
|
|
78
79
|
|
|
79
80
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
80
81
|
|
|
@@ -96,13 +97,13 @@ function _interopNamespace(e) {
|
|
|
96
97
|
return Object.freeze(n);
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
var
|
|
100
|
+
var defu2__default = /*#__PURE__*/_interopDefault(defu2);
|
|
100
101
|
var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
|
|
101
102
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
102
103
|
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
104
|
+
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
103
105
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
104
106
|
var ts2__default = /*#__PURE__*/_interopDefault(ts2);
|
|
105
|
-
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
106
107
|
|
|
107
108
|
function resolveModulePath(nodePath, state) {
|
|
108
109
|
if (!t__namespace.isStringLiteral(nodePath.node)) {
|
|
@@ -207,7 +208,7 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkSHUYVCID_js.__name((context
|
|
|
207
208
|
}, "moduleResolverBabelPlugin");
|
|
208
209
|
var DEFAULT_ENVIRONMENT = "default";
|
|
209
210
|
function createEnvironment(name, userConfig) {
|
|
210
|
-
return
|
|
211
|
+
return defu2__default.default(userConfig.environments?.[name] ?? {}, {
|
|
211
212
|
name,
|
|
212
213
|
title: userConfig.title || titleCase.titleCase(userConfig.name),
|
|
213
214
|
ssr: false,
|
|
@@ -250,6 +251,15 @@ function createDefaultEnvironment(userConfig) {
|
|
|
250
251
|
return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
|
|
251
252
|
}
|
|
252
253
|
chunkSHUYVCID_js.__name(createDefaultEnvironment, "createDefaultEnvironment");
|
|
254
|
+
function replacePathTokens(context, path) {
|
|
255
|
+
if (!path) {
|
|
256
|
+
return path;
|
|
257
|
+
}
|
|
258
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
259
|
+
}
|
|
260
|
+
chunkSHUYVCID_js.__name(replacePathTokens, "replacePathTokens");
|
|
261
|
+
|
|
262
|
+
// ../powerlines/src/lib/entry.ts
|
|
253
263
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
254
264
|
return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
255
265
|
}
|
|
@@ -275,7 +285,7 @@ function resolveEntry(context, typeDefinition) {
|
|
|
275
285
|
}
|
|
276
286
|
chunkSHUYVCID_js.__name(resolveEntry, "resolveEntry");
|
|
277
287
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
278
|
-
return typeDefinitions.map((typeDefinition) => {
|
|
288
|
+
return typeDefinitions.map((entry) => isString.isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file)).map((typeDefinition) => {
|
|
279
289
|
const parsed = parseTypeDefinition.parseTypeDefinition(typeDefinition);
|
|
280
290
|
const filePath = append.appendPath(parsed.file, context.config.projectRoot);
|
|
281
291
|
if (isFile.isFile(filePath)) {
|
|
@@ -297,6 +307,232 @@ function getUniqueEntries(entries = []) {
|
|
|
297
307
|
}));
|
|
298
308
|
}
|
|
299
309
|
chunkSHUYVCID_js.__name(getUniqueEntries, "getUniqueEntries");
|
|
310
|
+
BigInt("0xa56c61324b9d6e49");
|
|
311
|
+
var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
312
|
+
static {
|
|
313
|
+
chunkSHUYVCID_js.__name(this, "FileMetadata_KeyValuePair");
|
|
314
|
+
}
|
|
315
|
+
static _capnp = {
|
|
316
|
+
displayName: "KeyValuePair",
|
|
317
|
+
id: "eabb26cf58b2a14c",
|
|
318
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
319
|
+
};
|
|
320
|
+
get key() {
|
|
321
|
+
return $__namespace.utils.getText(0, this);
|
|
322
|
+
}
|
|
323
|
+
set key(value) {
|
|
324
|
+
$__namespace.utils.setText(0, value, this);
|
|
325
|
+
}
|
|
326
|
+
get value() {
|
|
327
|
+
return $__namespace.utils.getText(1, this);
|
|
328
|
+
}
|
|
329
|
+
set value(value) {
|
|
330
|
+
$__namespace.utils.setText(1, value, this);
|
|
331
|
+
}
|
|
332
|
+
toString() {
|
|
333
|
+
return "FileMetadata_KeyValuePair_" + super.toString();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
337
|
+
static {
|
|
338
|
+
chunkSHUYVCID_js.__name(this, "FileMetadata");
|
|
339
|
+
}
|
|
340
|
+
static KeyValuePair = FileMetadata_KeyValuePair;
|
|
341
|
+
static _capnp = {
|
|
342
|
+
displayName: "FileMetadata",
|
|
343
|
+
id: "8e2cab5d7e28c7b3",
|
|
344
|
+
size: new $__namespace.ObjectSize(0, 4),
|
|
345
|
+
defaultVariant: "normal"
|
|
346
|
+
};
|
|
347
|
+
static _Properties;
|
|
348
|
+
/**
|
|
349
|
+
* The variant of the file.
|
|
350
|
+
*
|
|
351
|
+
*/
|
|
352
|
+
get id() {
|
|
353
|
+
return $__namespace.utils.getText(0, this);
|
|
354
|
+
}
|
|
355
|
+
set id(value) {
|
|
356
|
+
$__namespace.utils.setText(0, value, this);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The output mode of the file.
|
|
360
|
+
*
|
|
361
|
+
*/
|
|
362
|
+
get variant() {
|
|
363
|
+
return $__namespace.utils.getText(1, this, _FileMetadata._capnp.defaultVariant);
|
|
364
|
+
}
|
|
365
|
+
set variant(value) {
|
|
366
|
+
$__namespace.utils.setText(1, value, this);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Additional metadata associated with the file.
|
|
370
|
+
*
|
|
371
|
+
*/
|
|
372
|
+
get mode() {
|
|
373
|
+
return $__namespace.utils.getText(2, this);
|
|
374
|
+
}
|
|
375
|
+
set mode(value) {
|
|
376
|
+
$__namespace.utils.setText(2, value, this);
|
|
377
|
+
}
|
|
378
|
+
_adoptProperties(value) {
|
|
379
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
|
|
380
|
+
}
|
|
381
|
+
_disownProperties() {
|
|
382
|
+
return $__namespace.utils.disown(this.properties);
|
|
383
|
+
}
|
|
384
|
+
get properties() {
|
|
385
|
+
return $__namespace.utils.getList(3, _FileMetadata._Properties, this);
|
|
386
|
+
}
|
|
387
|
+
_hasProperties() {
|
|
388
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
|
|
389
|
+
}
|
|
390
|
+
_initProperties(length) {
|
|
391
|
+
return $__namespace.utils.initList(3, _FileMetadata._Properties, length, this);
|
|
392
|
+
}
|
|
393
|
+
set properties(value) {
|
|
394
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
|
|
395
|
+
}
|
|
396
|
+
toString() {
|
|
397
|
+
return "FileMetadata_" + super.toString();
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
var FileIdentifier = class extends $__namespace.Struct {
|
|
401
|
+
static {
|
|
402
|
+
chunkSHUYVCID_js.__name(this, "FileIdentifier");
|
|
403
|
+
}
|
|
404
|
+
static _capnp = {
|
|
405
|
+
displayName: "FileIdentifier",
|
|
406
|
+
id: "e12b8732389d7406",
|
|
407
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* An additional identifier for the file.
|
|
411
|
+
*
|
|
412
|
+
*/
|
|
413
|
+
get path() {
|
|
414
|
+
return $__namespace.utils.getText(0, this);
|
|
415
|
+
}
|
|
416
|
+
set path(value) {
|
|
417
|
+
$__namespace.utils.setText(0, value, this);
|
|
418
|
+
}
|
|
419
|
+
get id() {
|
|
420
|
+
return $__namespace.utils.getText(1, this);
|
|
421
|
+
}
|
|
422
|
+
set id(value) {
|
|
423
|
+
$__namespace.utils.setText(1, value, this);
|
|
424
|
+
}
|
|
425
|
+
toString() {
|
|
426
|
+
return "FileIdentifier_" + super.toString();
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
var FileData = class extends $__namespace.Struct {
|
|
430
|
+
static {
|
|
431
|
+
chunkSHUYVCID_js.__name(this, "FileData");
|
|
432
|
+
}
|
|
433
|
+
static _capnp = {
|
|
434
|
+
displayName: "FileData",
|
|
435
|
+
id: "fa6725c8a360f9a2",
|
|
436
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* The contents of the file.
|
|
440
|
+
*
|
|
441
|
+
*/
|
|
442
|
+
get path() {
|
|
443
|
+
return $__namespace.utils.getText(0, this);
|
|
444
|
+
}
|
|
445
|
+
set path(value) {
|
|
446
|
+
$__namespace.utils.setText(0, value, this);
|
|
447
|
+
}
|
|
448
|
+
get content() {
|
|
449
|
+
return $__namespace.utils.getText(1, this);
|
|
450
|
+
}
|
|
451
|
+
set content(value) {
|
|
452
|
+
$__namespace.utils.setText(1, value, this);
|
|
453
|
+
}
|
|
454
|
+
toString() {
|
|
455
|
+
return "FileData_" + super.toString();
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
var FileSystemData = class _FileSystemData extends $__namespace.Struct {
|
|
459
|
+
static {
|
|
460
|
+
chunkSHUYVCID_js.__name(this, "FileSystemData");
|
|
461
|
+
}
|
|
462
|
+
static _capnp = {
|
|
463
|
+
displayName: "FileSystemData",
|
|
464
|
+
id: "aaa72a672ac0732f",
|
|
465
|
+
size: new $__namespace.ObjectSize(0, 3)
|
|
466
|
+
};
|
|
467
|
+
static _Ids;
|
|
468
|
+
static _Metadata;
|
|
469
|
+
static _Files;
|
|
470
|
+
_adoptIds(value) {
|
|
471
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
|
|
472
|
+
}
|
|
473
|
+
_disownIds() {
|
|
474
|
+
return $__namespace.utils.disown(this.ids);
|
|
475
|
+
}
|
|
476
|
+
get ids() {
|
|
477
|
+
return $__namespace.utils.getList(0, _FileSystemData._Ids, this);
|
|
478
|
+
}
|
|
479
|
+
_hasIds() {
|
|
480
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(0, this));
|
|
481
|
+
}
|
|
482
|
+
_initIds(length) {
|
|
483
|
+
return $__namespace.utils.initList(0, _FileSystemData._Ids, length, this);
|
|
484
|
+
}
|
|
485
|
+
set ids(value) {
|
|
486
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
|
|
487
|
+
}
|
|
488
|
+
_adoptMetadata(value) {
|
|
489
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
|
|
490
|
+
}
|
|
491
|
+
_disownMetadata() {
|
|
492
|
+
return $__namespace.utils.disown(this.metadata);
|
|
493
|
+
}
|
|
494
|
+
get metadata() {
|
|
495
|
+
return $__namespace.utils.getList(1, _FileSystemData._Metadata, this);
|
|
496
|
+
}
|
|
497
|
+
_hasMetadata() {
|
|
498
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
|
|
499
|
+
}
|
|
500
|
+
_initMetadata(length) {
|
|
501
|
+
return $__namespace.utils.initList(1, _FileSystemData._Metadata, length, this);
|
|
502
|
+
}
|
|
503
|
+
set metadata(value) {
|
|
504
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
|
|
505
|
+
}
|
|
506
|
+
_adoptFiles(value) {
|
|
507
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
508
|
+
}
|
|
509
|
+
_disownFiles() {
|
|
510
|
+
return $__namespace.utils.disown(this.files);
|
|
511
|
+
}
|
|
512
|
+
get files() {
|
|
513
|
+
return $__namespace.utils.getList(2, _FileSystemData._Files, this);
|
|
514
|
+
}
|
|
515
|
+
_hasFiles() {
|
|
516
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
517
|
+
}
|
|
518
|
+
_initFiles(length) {
|
|
519
|
+
return $__namespace.utils.initList(2, _FileSystemData._Files, length, this);
|
|
520
|
+
}
|
|
521
|
+
set files(value) {
|
|
522
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
523
|
+
}
|
|
524
|
+
toString() {
|
|
525
|
+
return "FileSystemData_" + super.toString();
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
|
|
529
|
+
FileSystemData._Ids = $__namespace.CompositeList(FileIdentifier);
|
|
530
|
+
FileSystemData._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
531
|
+
FileSystemData._Files = $__namespace.CompositeList(FileData);
|
|
532
|
+
|
|
533
|
+
// ../powerlines/src/types/vfs.ts
|
|
534
|
+
var __VFS_PATCH__ = Symbol("__VFS_PATCH__");
|
|
535
|
+
var __VFS_REVERT__ = Symbol("__VFS_REVERT__");
|
|
300
536
|
var createLog = /* @__PURE__ */ chunkSHUYVCID_js.__name((name, options = {}) => {
|
|
301
537
|
const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
|
|
302
538
|
if (logLevel === types.LogLevelLabel.SILENT) {
|
|
@@ -335,94 +571,6 @@ var BADGE_COLORS = [
|
|
|
335
571
|
var extendLog = /* @__PURE__ */ chunkSHUYVCID_js.__name((logFn, name) => {
|
|
336
572
|
return (type, ...args) => logFn(type, ` ${chalk5__default.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase.titleCase(name)} `)} ${args.join(" ")} `);
|
|
337
573
|
}, "extendLog");
|
|
338
|
-
|
|
339
|
-
// ../powerlines/src/types/commands.ts
|
|
340
|
-
var SUPPORTED_COMMANDS = [
|
|
341
|
-
"new",
|
|
342
|
-
"clean",
|
|
343
|
-
"prepare",
|
|
344
|
-
"lint",
|
|
345
|
-
"test",
|
|
346
|
-
"build",
|
|
347
|
-
"docs",
|
|
348
|
-
"release",
|
|
349
|
-
"finalize"
|
|
350
|
-
];
|
|
351
|
-
|
|
352
|
-
// ../powerlines/src/plugin-utils/helpers.ts
|
|
353
|
-
function isPlugin(value) {
|
|
354
|
-
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
|
|
355
|
-
}
|
|
356
|
-
chunkSHUYVCID_js.__name(isPlugin, "isPlugin");
|
|
357
|
-
function isPluginConfigObject(value) {
|
|
358
|
-
return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
|
|
359
|
-
}
|
|
360
|
-
chunkSHUYVCID_js.__name(isPluginConfigObject, "isPluginConfigObject");
|
|
361
|
-
function isPluginConfigTuple(value) {
|
|
362
|
-
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
|
|
363
|
-
}
|
|
364
|
-
chunkSHUYVCID_js.__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
365
|
-
function isPluginConfig(value) {
|
|
366
|
-
return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
367
|
-
}
|
|
368
|
-
chunkSHUYVCID_js.__name(isPluginConfig, "isPluginConfig");
|
|
369
|
-
function isPluginHookFunction(value) {
|
|
370
|
-
return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
371
|
-
}
|
|
372
|
-
chunkSHUYVCID_js.__name(isPluginHookFunction, "isPluginHookFunction");
|
|
373
|
-
function isPluginHookObject(value) {
|
|
374
|
-
return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
375
|
-
}
|
|
376
|
-
chunkSHUYVCID_js.__name(isPluginHookObject, "isPluginHookObject");
|
|
377
|
-
function isPluginHook(value) {
|
|
378
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
379
|
-
}
|
|
380
|
-
chunkSHUYVCID_js.__name(isPluginHook, "isPluginHook");
|
|
381
|
-
function getHookHandler(pluginHook) {
|
|
382
|
-
return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
383
|
-
}
|
|
384
|
-
chunkSHUYVCID_js.__name(getHookHandler, "getHookHandler");
|
|
385
|
-
function isHookExternal(hook) {
|
|
386
|
-
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
387
|
-
}
|
|
388
|
-
chunkSHUYVCID_js.__name(isHookExternal, "isHookExternal");
|
|
389
|
-
function checkDedupe(plugin, plugins2) {
|
|
390
|
-
return plugin.dedupe === false || plugins2.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
391
|
-
}
|
|
392
|
-
chunkSHUYVCID_js.__name(checkDedupe, "checkDedupe");
|
|
393
|
-
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
394
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
395
|
-
hooksList.push(isFunction.isFunction(pluginHook) ? {
|
|
396
|
-
plugin,
|
|
397
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
398
|
-
} : {
|
|
399
|
-
plugin,
|
|
400
|
-
...pluginHook,
|
|
401
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
chunkSHUYVCID_js.__name(addPluginHook, "addPluginHook");
|
|
406
|
-
function resolveOptions(options) {
|
|
407
|
-
return defu3__default.default(options, {
|
|
408
|
-
interopDefault: true,
|
|
409
|
-
fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
|
|
410
|
-
moduleCache: options.mode !== "development"
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
chunkSHUYVCID_js.__name(resolveOptions, "resolveOptions");
|
|
414
|
-
function createPluginResolver(options) {
|
|
415
|
-
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
416
|
-
...options
|
|
417
|
-
}));
|
|
418
|
-
}
|
|
419
|
-
chunkSHUYVCID_js.__name(createPluginResolver, "createPluginResolver");
|
|
420
|
-
function createResolver(options) {
|
|
421
|
-
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
|
|
422
|
-
baseResolver.plugin = createPluginResolver(options);
|
|
423
|
-
return baseResolver;
|
|
424
|
-
}
|
|
425
|
-
chunkSHUYVCID_js.__name(createResolver, "createResolver");
|
|
426
574
|
function isBufferEncoding(options) {
|
|
427
575
|
return isSetString.isSetString(options) || options === null;
|
|
428
576
|
}
|
|
@@ -571,160 +719,71 @@ function patchFS(originalFS, vfs) {
|
|
|
571
719
|
};
|
|
572
720
|
}
|
|
573
721
|
chunkSHUYVCID_js.__name(patchFS, "patchFS");
|
|
574
|
-
var
|
|
722
|
+
var UnifiedFS = class _UnifiedFS extends unionfs.Union {
|
|
575
723
|
static {
|
|
576
|
-
chunkSHUYVCID_js.__name(this, "
|
|
724
|
+
chunkSHUYVCID_js.__name(this, "UnifiedFS");
|
|
577
725
|
}
|
|
578
726
|
/**
|
|
579
727
|
* The internal map of virtual files.
|
|
580
728
|
*/
|
|
581
|
-
#
|
|
582
|
-
/**
|
|
583
|
-
* A map of unique identifiers to their virtual file paths.
|
|
584
|
-
*/
|
|
585
|
-
#ids = {};
|
|
586
|
-
/**
|
|
587
|
-
* A map of virtual file paths to their underlying file content.
|
|
588
|
-
*/
|
|
589
|
-
#cachedFS = /* @__PURE__ */ new Map();
|
|
590
|
-
/**
|
|
591
|
-
* A map of virtual file paths to their underlying file content.
|
|
592
|
-
*/
|
|
593
|
-
#cachedResolver = /* @__PURE__ */ new Map();
|
|
594
|
-
/**
|
|
595
|
-
* The internal map of virtual files.
|
|
596
|
-
*/
|
|
597
|
-
#virtualFS = new memfs.Volume();
|
|
729
|
+
#virtualFS = new volume.Volume();
|
|
598
730
|
/**
|
|
599
731
|
* The physical file system.
|
|
600
732
|
*/
|
|
601
|
-
#
|
|
602
|
-
/**
|
|
603
|
-
* The unified volume that combines the virtual file system with the real file system.
|
|
604
|
-
*
|
|
605
|
-
* @remarks
|
|
606
|
-
* This volume allows for seamless access to both virtual and real files.
|
|
607
|
-
*/
|
|
608
|
-
#unifiedFS = new unionfs.Union();
|
|
609
|
-
/**
|
|
610
|
-
* Indicator specifying if the file system module is patched
|
|
611
|
-
*/
|
|
612
|
-
#isPatched = false;
|
|
613
|
-
/**
|
|
614
|
-
* Function to revert require patch
|
|
615
|
-
*/
|
|
616
|
-
#revert;
|
|
733
|
+
#physicalFS = cloneFS(fs__default.default);
|
|
617
734
|
/**
|
|
618
|
-
* The context of the
|
|
735
|
+
* The context of the unified file system.
|
|
619
736
|
*/
|
|
620
737
|
#context;
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
* @param path - The path to check.
|
|
629
|
-
* @returns `true` if the path exists, otherwise `false`.
|
|
630
|
-
*/
|
|
631
|
-
#existsSync(path) {
|
|
632
|
-
const formattedPath = this.formatPath(path);
|
|
633
|
-
return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Exposes the internal VFS map for advanced usage.
|
|
637
|
-
*/
|
|
638
|
-
get [chunkUOTRU26N_js.__VFS_CACHE__]() {
|
|
639
|
-
return this.#cachedFS;
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Exposes the internal VFS resolver cache for advanced usage.
|
|
643
|
-
*/
|
|
644
|
-
get [chunkUOTRU26N_js.__VFS_RESOLVER__]() {
|
|
645
|
-
return this.#cachedResolver;
|
|
738
|
+
static create(context, data) {
|
|
739
|
+
let result = new _UnifiedFS(context, data);
|
|
740
|
+
result = result.use(result.#physicalFS);
|
|
741
|
+
if (result.#context.config.output.mode !== "fs") {
|
|
742
|
+
result = result.use(result.#virtualFS);
|
|
743
|
+
}
|
|
744
|
+
return result;
|
|
646
745
|
}
|
|
647
746
|
/**
|
|
648
|
-
*
|
|
747
|
+
* Gets the virtual file system (VFS).
|
|
649
748
|
*/
|
|
650
|
-
get
|
|
749
|
+
get virtual() {
|
|
651
750
|
return this.#virtualFS;
|
|
652
751
|
}
|
|
653
752
|
/**
|
|
654
|
-
*
|
|
655
|
-
*/
|
|
656
|
-
get [chunkUOTRU26N_js.__VFS_UNIFIED__]() {
|
|
657
|
-
return this.#unifiedFS;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* A proxy to access the underlying file metadata.
|
|
661
|
-
*/
|
|
662
|
-
get meta() {
|
|
663
|
-
return new Proxy(this.#meta, {
|
|
664
|
-
get: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop) => {
|
|
665
|
-
if (target[prop]) {
|
|
666
|
-
return {
|
|
667
|
-
id: prop,
|
|
668
|
-
mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
|
|
669
|
-
details: {},
|
|
670
|
-
variant: "normal",
|
|
671
|
-
...target[prop]
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
return void 0;
|
|
675
|
-
}, "get"),
|
|
676
|
-
set: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop, value) => {
|
|
677
|
-
target[prop] = value;
|
|
678
|
-
this.#ids[value.id || prop] = prop;
|
|
679
|
-
return true;
|
|
680
|
-
}, "set"),
|
|
681
|
-
deleteProperty: /* @__PURE__ */ chunkSHUYVCID_js.__name((target, prop) => {
|
|
682
|
-
delete this.#ids[target[prop]?.id || prop];
|
|
683
|
-
delete target[prop];
|
|
684
|
-
return true;
|
|
685
|
-
}, "deleteProperty")
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* A map of module ids to their file paths.
|
|
753
|
+
* Gets the physical file system (FS).
|
|
690
754
|
*/
|
|
691
|
-
get
|
|
692
|
-
return this.#
|
|
755
|
+
get physical() {
|
|
756
|
+
return this.#physicalFS;
|
|
693
757
|
}
|
|
694
758
|
/**
|
|
695
759
|
* Creates a new instance of the VirtualFileSystem.
|
|
696
760
|
*
|
|
697
761
|
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
698
|
-
* @param
|
|
762
|
+
* @param data - A buffer containing the serialized virtual file system data.
|
|
699
763
|
*/
|
|
700
|
-
constructor(context,
|
|
764
|
+
constructor(context, data) {
|
|
765
|
+
super();
|
|
701
766
|
this.#context = context;
|
|
702
|
-
this.#
|
|
703
|
-
|
|
704
|
-
this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
|
|
705
|
-
data.id || path,
|
|
706
|
-
path
|
|
707
|
-
]));
|
|
708
|
-
if (!this.#fs.existsSync(this.#context.dataPath)) {
|
|
709
|
-
this.#fs.mkdirSync(this.#context.dataPath, {
|
|
767
|
+
if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
|
|
768
|
+
this.#physicalFS.mkdirSync(this.#context.dataPath, {
|
|
710
769
|
recursive: true
|
|
711
770
|
});
|
|
712
771
|
}
|
|
713
|
-
if (!this.#
|
|
714
|
-
this.#
|
|
772
|
+
if (!this.#physicalFS.existsSync(this.#context.cachePath)) {
|
|
773
|
+
this.#physicalFS.mkdirSync(this.#context.cachePath, {
|
|
715
774
|
recursive: true
|
|
716
775
|
});
|
|
717
776
|
}
|
|
718
|
-
if (!this.#
|
|
719
|
-
this.#
|
|
777
|
+
if (!this.#physicalFS.existsSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
778
|
+
this.#physicalFS.mkdirSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
|
|
720
779
|
recursive: true
|
|
721
780
|
});
|
|
722
781
|
}
|
|
723
|
-
this.#unifiedFS = this.#unifiedFS.use(this.#fs);
|
|
724
782
|
if (this.#context.config.output.mode !== "fs") {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
783
|
+
this.#virtualFS = volume.Volume.fromJSON(data._hasFiles() && data.files.length > 0 ? data.files.values().reduce((ret, file) => {
|
|
784
|
+
ret[file.path] = file.content;
|
|
785
|
+
return ret;
|
|
786
|
+
}, {}) : {});
|
|
728
787
|
if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
|
|
729
788
|
this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
|
|
730
789
|
recursive: true
|
|
@@ -745,181 +804,531 @@ var VirtualFileSystem = class {
|
|
|
745
804
|
recursive: true
|
|
746
805
|
});
|
|
747
806
|
}
|
|
748
|
-
this.#unifiedFS = this.#unifiedFS.use(this.#virtualFS);
|
|
749
807
|
} else if (this.#context.config.projectType === "application") {
|
|
750
|
-
if (!this.#
|
|
751
|
-
this.#
|
|
808
|
+
if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
|
|
809
|
+
this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
|
|
752
810
|
recursive: true
|
|
753
811
|
});
|
|
754
812
|
}
|
|
755
|
-
if (!this.#
|
|
756
|
-
this.#
|
|
813
|
+
if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
|
|
814
|
+
this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
|
|
757
815
|
recursive: true
|
|
758
816
|
});
|
|
759
817
|
}
|
|
760
|
-
if (!this.#
|
|
761
|
-
this.#
|
|
818
|
+
if (!this.#physicalFS.existsSync(this.#context.entryPath)) {
|
|
819
|
+
this.#physicalFS.mkdirSync(this.#context.entryPath, {
|
|
762
820
|
recursive: true
|
|
763
821
|
});
|
|
764
822
|
}
|
|
765
|
-
if (!this.#
|
|
766
|
-
this.#
|
|
823
|
+
if (!this.#physicalFS.existsSync(this.#context.dtsPath)) {
|
|
824
|
+
this.#physicalFS.mkdirSync(this.#context.dtsPath, {
|
|
767
825
|
recursive: true
|
|
768
826
|
});
|
|
769
827
|
}
|
|
770
828
|
}
|
|
771
|
-
this.#log = extendLog(this.#context.log, "virtual-file-system");
|
|
772
|
-
}
|
|
773
|
-
[chunkUOTRU26N_js.__VFS_INIT__]() {
|
|
774
|
-
if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
775
|
-
this.#revert = patchFS(fs__default.default, this);
|
|
776
|
-
this.#isPatched = true;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
[chunkUOTRU26N_js.__VFS_REVERT__]() {
|
|
780
|
-
if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
781
|
-
if (!this.#revert) {
|
|
782
|
-
throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
|
|
783
|
-
}
|
|
784
|
-
this.#revert?.();
|
|
785
|
-
this.#isPatched = false;
|
|
786
|
-
}
|
|
787
829
|
}
|
|
788
830
|
/**
|
|
789
|
-
*
|
|
831
|
+
* Select the file system module to use for the operation based on the path or URL.
|
|
790
832
|
*
|
|
791
|
-
* @param
|
|
792
|
-
* @param options -
|
|
793
|
-
* @returns
|
|
833
|
+
* @param pathOrUrl - The path to perform the file system operation on.
|
|
834
|
+
* @param options - Options for the operation, such as output mode.
|
|
835
|
+
* @returns The file system module used for the operation.
|
|
794
836
|
*/
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
})
|
|
803
|
-
|
|
804
|
-
|
|
837
|
+
resolveFS(pathOrUrl, options = {}) {
|
|
838
|
+
const mode = this.resolveMode(pathOrUrl, options);
|
|
839
|
+
if (mode === "virtual") {
|
|
840
|
+
return {
|
|
841
|
+
...this.#virtualFS,
|
|
842
|
+
mode: "virtual"
|
|
843
|
+
};
|
|
844
|
+
} else if (mode === "fs") {
|
|
845
|
+
return {
|
|
846
|
+
...this.#physicalFS,
|
|
847
|
+
mode: "fs"
|
|
848
|
+
};
|
|
805
849
|
}
|
|
806
|
-
return
|
|
850
|
+
return {
|
|
851
|
+
...this,
|
|
852
|
+
mode: this.#context.config.output.mode
|
|
853
|
+
};
|
|
807
854
|
}
|
|
808
855
|
/**
|
|
809
|
-
*
|
|
856
|
+
* Select the file system module to use for the operation based on the path or URL.
|
|
810
857
|
*
|
|
811
|
-
* @param
|
|
812
|
-
* @param options -
|
|
813
|
-
* @returns
|
|
858
|
+
* @param pathOrUrl - The path to perform the file system operation on.
|
|
859
|
+
* @param options - Options for the operation, such as output mode.
|
|
860
|
+
* @returns The file system module used for the operation.
|
|
814
861
|
*/
|
|
815
|
-
|
|
816
|
-
if (
|
|
817
|
-
return
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
...options,
|
|
821
|
-
type: "file"
|
|
822
|
-
});
|
|
823
|
-
if (!resolvedPath) {
|
|
824
|
-
return false;
|
|
862
|
+
resolveMode(pathOrUrl, options = {}) {
|
|
863
|
+
if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
|
|
864
|
+
return "virtual";
|
|
865
|
+
} else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
866
|
+
return "fs";
|
|
825
867
|
}
|
|
826
|
-
return
|
|
868
|
+
return void 0;
|
|
827
869
|
}
|
|
828
870
|
/**
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
871
|
+
* Serializes the virtual file system (VFS) to a JSON object.
|
|
832
872
|
*
|
|
833
|
-
* @
|
|
834
|
-
* @returns Whether the path or ID corresponds to a virtual file.
|
|
873
|
+
* @returns A JSON representation of the virtual file system.
|
|
835
874
|
*/
|
|
836
|
-
|
|
837
|
-
return
|
|
875
|
+
toJSON() {
|
|
876
|
+
return this.#virtualFS.toJSON();
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// ../powerlines/src/lib/fs/vfs.ts
|
|
881
|
+
var VirtualFileSystem = class _VirtualFileSystem {
|
|
882
|
+
static {
|
|
883
|
+
chunkSHUYVCID_js.__name(this, "VirtualFileSystem");
|
|
838
884
|
}
|
|
839
885
|
/**
|
|
840
|
-
*
|
|
841
|
-
*
|
|
842
|
-
* @param path - The path to list files from.
|
|
843
|
-
* @param options - Options for listing files, such as encoding and recursion.
|
|
844
|
-
* @returns An array of file names in the specified path.
|
|
886
|
+
* A map of virtual file IDs to their associated metadata.
|
|
845
887
|
*/
|
|
846
|
-
|
|
847
|
-
return this.resolveFS(path).readdirSync(toFilePath(path), options);
|
|
848
|
-
}
|
|
888
|
+
#metadata;
|
|
849
889
|
/**
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
* @param path - The path to create the directory at.
|
|
890
|
+
* A map of virtual file IDs to their underlying file paths.
|
|
853
891
|
*/
|
|
854
|
-
|
|
855
|
-
const formattedPath = toFilePath(path);
|
|
856
|
-
if (!this.isFile(formattedPath)) {
|
|
857
|
-
return;
|
|
858
|
-
}
|
|
859
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
|
|
860
|
-
this.resolveFS(path, options).unlinkSync(formattedPath);
|
|
861
|
-
this.#cachedFS.delete(formattedPath);
|
|
862
|
-
this.clearResolverCache(formattedPath);
|
|
863
|
-
}
|
|
892
|
+
#ids;
|
|
864
893
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
* @param path - The path to create the directory at.
|
|
894
|
+
* A map of underlying file paths to their virtual file IDs.
|
|
868
895
|
*/
|
|
869
|
-
|
|
870
|
-
const formattedPath = toFilePath(path);
|
|
871
|
-
if (!this.isFile(formattedPath)) {
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
|
|
875
|
-
if (isFunction.isFunction(this.resolveFS(path, options).promises.unlink)) {
|
|
876
|
-
await this.resolveFS(path, options).promises.unlink(formattedPath);
|
|
877
|
-
this.#cachedFS.delete(formattedPath);
|
|
878
|
-
this.clearResolverCache(formattedPath);
|
|
879
|
-
} else {
|
|
880
|
-
this.unlinkSync(formattedPath, options);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
896
|
+
#paths;
|
|
883
897
|
/**
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
* @param path - The path to create the directory at.
|
|
887
|
-
* @param options - Options for creating the directory.
|
|
898
|
+
* A map of virtual file paths to their underlying file content.
|
|
888
899
|
*/
|
|
889
|
-
|
|
890
|
-
const formattedPath = toFilePath(path);
|
|
891
|
-
if (!this.isDirectory(formattedPath)) {
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
|
|
895
|
-
this.resolveFS(path, options).rmdirSync(formattedPath, defu3__default.default(options, {
|
|
896
|
-
recursive: true
|
|
897
|
-
}));
|
|
898
|
-
this.#cachedFS.delete(formattedPath);
|
|
899
|
-
this.clearResolverCache(formattedPath);
|
|
900
|
-
}
|
|
900
|
+
#cachedResolver = /* @__PURE__ */ new Map();
|
|
901
901
|
/**
|
|
902
|
-
*
|
|
902
|
+
* The unified volume that combines the virtual file system with the real file system.
|
|
903
903
|
*
|
|
904
|
-
* @
|
|
905
|
-
*
|
|
906
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
904
|
+
* @remarks
|
|
905
|
+
* This volume allows for seamless access to both virtual and real files.
|
|
907
906
|
*/
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
907
|
+
#unifiedFS;
|
|
908
|
+
/**
|
|
909
|
+
* Indicator specifying if the file system module is patched
|
|
910
|
+
*/
|
|
911
|
+
#isPatched = false;
|
|
912
|
+
/**
|
|
913
|
+
* Indicator specifying if the virtual file system (VFS) is disposed
|
|
914
|
+
*/
|
|
915
|
+
#isDisposed = false;
|
|
916
|
+
/**
|
|
917
|
+
* Function to revert require patch
|
|
918
|
+
*/
|
|
919
|
+
#revert;
|
|
920
|
+
/**
|
|
921
|
+
* The context of the virtual file system.
|
|
922
|
+
*/
|
|
923
|
+
#context;
|
|
924
|
+
/**
|
|
925
|
+
* The file system's logging function.
|
|
926
|
+
*/
|
|
927
|
+
#log;
|
|
928
|
+
/**
|
|
929
|
+
* Checks if a path exists in the virtual file system (VFS).
|
|
930
|
+
*
|
|
931
|
+
* @param path - The path to check.
|
|
932
|
+
* @returns `true` if the path exists, otherwise `false`.
|
|
933
|
+
*/
|
|
934
|
+
#existsSync(path) {
|
|
935
|
+
const formattedPath = this.formatPath(path);
|
|
936
|
+
return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Builds a regular expression from a string pattern for path matching.
|
|
940
|
+
*
|
|
941
|
+
* @param strPattern - The string pattern to convert.
|
|
942
|
+
* @returns A regular expression for matching paths.
|
|
943
|
+
*/
|
|
944
|
+
#buildRegex(strPattern) {
|
|
945
|
+
const token = "::GLOBSTAR::";
|
|
946
|
+
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Formats a file id by removing the file extension and prepending the runtime prefix.
|
|
950
|
+
*
|
|
951
|
+
* @param id - The file ID to format.
|
|
952
|
+
* @returns The formatted file ID.
|
|
953
|
+
*/
|
|
954
|
+
#formatId(id) {
|
|
955
|
+
const formattedId = toFilePath(id);
|
|
956
|
+
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
960
|
+
*
|
|
961
|
+
* @param id - The id to resolve.
|
|
962
|
+
* @returns The resolved file id if it exists, otherwise undefined.
|
|
963
|
+
*/
|
|
964
|
+
#resolveId(id) {
|
|
965
|
+
if (this.#ids[this.#formatId(id)]) {
|
|
966
|
+
return this.#ids[this.#formatId(id)] || false;
|
|
967
|
+
}
|
|
968
|
+
return false;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
972
|
+
*
|
|
973
|
+
* @param path - The path to resolve.
|
|
974
|
+
* @param options - Optional parameters for resolving the path.
|
|
975
|
+
* @returns The resolved file path if it exists, otherwise undefined.
|
|
976
|
+
*/
|
|
977
|
+
#resolvePath(path, options = {}) {
|
|
978
|
+
if (isType.isAbsolutePath(path)) {
|
|
979
|
+
if (this.#existsSync(path)) {
|
|
980
|
+
return path;
|
|
981
|
+
}
|
|
982
|
+
const result = this.#checkVariants(path);
|
|
983
|
+
if (result) {
|
|
984
|
+
return result;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
|
|
988
|
+
const request = joinPaths.joinPaths(parentPath, path);
|
|
989
|
+
if (this.#existsSync(request)) {
|
|
990
|
+
return request;
|
|
991
|
+
}
|
|
992
|
+
const result = this.#checkVariants(request);
|
|
993
|
+
if (result) {
|
|
994
|
+
return result;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
return false;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Resolves parent paths for a given request.
|
|
1001
|
+
*
|
|
1002
|
+
* @param request - The request path to resolve parent paths for.
|
|
1003
|
+
* @param parents - An optional array of parent paths to consider.
|
|
1004
|
+
* @returns An array of resolved parent paths.
|
|
1005
|
+
*/
|
|
1006
|
+
#resolveParentPaths(request, parents = []) {
|
|
1007
|
+
let paths = [
|
|
1008
|
+
this.#context.workspaceConfig.workspaceRoot,
|
|
1009
|
+
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1010
|
+
];
|
|
1011
|
+
if (this.#context.tsconfig.options.paths) {
|
|
1012
|
+
paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
|
|
1013
|
+
if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1014
|
+
ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1015
|
+
}
|
|
1016
|
+
return ret;
|
|
1017
|
+
}, paths) : paths;
|
|
1018
|
+
}
|
|
1019
|
+
return paths.reduce((ret, path) => {
|
|
1020
|
+
if (!ret.includes(path)) {
|
|
1021
|
+
ret.push(path);
|
|
1022
|
+
}
|
|
1023
|
+
return ret;
|
|
1024
|
+
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Clears the resolver cache for a given path.
|
|
1028
|
+
*
|
|
1029
|
+
* @param path - The path to clear the resolver cache for.
|
|
1030
|
+
*/
|
|
1031
|
+
#clearResolverCache(path) {
|
|
1032
|
+
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Check if the file exists with different variants (index, extensions).
|
|
1036
|
+
*
|
|
1037
|
+
* @param request - The request path to check.
|
|
1038
|
+
* @param parentPath - An optional parent path to prepend to the request.
|
|
1039
|
+
* @returns The file path if it exists, otherwise false.
|
|
1040
|
+
*/
|
|
1041
|
+
#checkVariants(request, parentPath) {
|
|
1042
|
+
const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
|
|
1043
|
+
let file = this.#checkExtensions(path);
|
|
1044
|
+
if (file) {
|
|
1045
|
+
return file;
|
|
1046
|
+
}
|
|
1047
|
+
file = this.#checkIndex(path);
|
|
1048
|
+
if (file) {
|
|
1049
|
+
return file;
|
|
1050
|
+
}
|
|
1051
|
+
return false;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Check if the index file exists in the given request path.
|
|
1055
|
+
*
|
|
1056
|
+
* @param request - The request path to check.
|
|
1057
|
+
* @returns The index file path if it exists, otherwise false.
|
|
1058
|
+
*/
|
|
1059
|
+
#checkIndex(request) {
|
|
1060
|
+
let file = joinPaths.joinPaths(request, "index");
|
|
1061
|
+
if (this.#existsSync(file)) {
|
|
1062
|
+
return file;
|
|
1063
|
+
}
|
|
1064
|
+
file = this.#checkExtensions(file);
|
|
1065
|
+
if (file) {
|
|
1066
|
+
return file;
|
|
1067
|
+
}
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Check if the file exists with different extensions.
|
|
1072
|
+
*
|
|
1073
|
+
* @param request - The request path to check.
|
|
1074
|
+
* @returns The file path if it exists with any of the checked extensions, otherwise false.
|
|
1075
|
+
*/
|
|
1076
|
+
#checkExtensions(request) {
|
|
1077
|
+
let file = `${request}.ts`;
|
|
1078
|
+
if (this.#existsSync(file)) {
|
|
1079
|
+
return file;
|
|
1080
|
+
}
|
|
1081
|
+
file = `${request}.mts`;
|
|
1082
|
+
if (this.#existsSync(file)) {
|
|
1083
|
+
return file;
|
|
1084
|
+
}
|
|
1085
|
+
file = `${request}.cts`;
|
|
1086
|
+
if (this.#existsSync(file)) {
|
|
1087
|
+
return file;
|
|
1088
|
+
}
|
|
1089
|
+
file = `${request}.tsx`;
|
|
1090
|
+
if (this.#existsSync(file)) {
|
|
1091
|
+
return file;
|
|
1092
|
+
}
|
|
1093
|
+
file = `${request}.js`;
|
|
1094
|
+
if (this.#existsSync(file)) {
|
|
1095
|
+
return file;
|
|
1096
|
+
}
|
|
1097
|
+
file = `${request}.mjs`;
|
|
1098
|
+
if (this.#existsSync(file)) {
|
|
1099
|
+
return file;
|
|
1100
|
+
}
|
|
1101
|
+
file = `${request}.cjs`;
|
|
1102
|
+
if (this.#existsSync(file)) {
|
|
1103
|
+
return file;
|
|
1104
|
+
}
|
|
1105
|
+
file = `${request}.jsx`;
|
|
1106
|
+
if (this.#existsSync(file)) {
|
|
1107
|
+
return file;
|
|
1108
|
+
}
|
|
1109
|
+
file = `${request}.json`;
|
|
1110
|
+
if (this.#existsSync(file)) {
|
|
1111
|
+
return file;
|
|
1112
|
+
}
|
|
1113
|
+
file = `${request}.d.ts`;
|
|
1114
|
+
if (this.#existsSync(file)) {
|
|
1115
|
+
return file;
|
|
1116
|
+
}
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
1121
|
+
*
|
|
1122
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1123
|
+
* @returns A promise that resolves to a new virtual file system instance.
|
|
1124
|
+
*/
|
|
1125
|
+
static async create(context) {
|
|
1126
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
|
|
1127
|
+
const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.cachePath, "fs.bin"));
|
|
1128
|
+
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1129
|
+
return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
|
|
1130
|
+
}
|
|
1131
|
+
const message = new $__namespace.Message();
|
|
1132
|
+
return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
1136
|
+
*
|
|
1137
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1138
|
+
* @returns A new virtual file system instance.
|
|
1139
|
+
*/
|
|
1140
|
+
static createSync(context) {
|
|
1141
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
|
|
1142
|
+
const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.cachePath, "fs.bin"));
|
|
1143
|
+
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1144
|
+
return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
|
|
1145
|
+
}
|
|
1146
|
+
const message = new $__namespace.Message();
|
|
1147
|
+
return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* A map of file ids to their metadata.
|
|
1151
|
+
*/
|
|
1152
|
+
get metadata() {
|
|
1153
|
+
return this.#metadata;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* A map of module ids to their file paths.
|
|
1157
|
+
*/
|
|
1158
|
+
get ids() {
|
|
1159
|
+
return this.#ids;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* A map of virtual file paths to their IDs.
|
|
1163
|
+
*/
|
|
1164
|
+
get paths() {
|
|
1165
|
+
return this.#paths;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
1169
|
+
*
|
|
1170
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1171
|
+
* @param data - A buffer containing the serialized virtual file system data.
|
|
1172
|
+
*/
|
|
1173
|
+
constructor(context, data) {
|
|
1174
|
+
this.#context = context;
|
|
1175
|
+
this.#unifiedFS = UnifiedFS.create(context, data);
|
|
1176
|
+
this.#metadata = {};
|
|
1177
|
+
if (data._hasMetadata()) {
|
|
1178
|
+
this.#metadata = data.metadata.values().reduce((ret, data2) => {
|
|
1179
|
+
ret[data2.id] = {
|
|
1180
|
+
id: data2.id,
|
|
1181
|
+
variant: data2.variant,
|
|
1182
|
+
mode: data2.mode,
|
|
1183
|
+
properties: data2._hasProperties() ? data2.properties.values().reduce((ret2, item) => {
|
|
1184
|
+
ret2[item.key] = item.value;
|
|
1185
|
+
return ret2;
|
|
1186
|
+
}, {}) : {}
|
|
1187
|
+
};
|
|
1188
|
+
return ret;
|
|
1189
|
+
}, {});
|
|
1190
|
+
}
|
|
1191
|
+
this.#ids = {};
|
|
1192
|
+
this.#paths = {};
|
|
1193
|
+
if (data._hasIds()) {
|
|
1194
|
+
this.#ids = data.ids.values().reduce((ret, data2) => {
|
|
1195
|
+
ret[data2.id] ??= data2.path;
|
|
1196
|
+
ret[data2.path] ??= data2.path;
|
|
1197
|
+
return ret;
|
|
1198
|
+
}, {});
|
|
1199
|
+
this.#paths = data.ids.values().reduce((ret, data2) => {
|
|
1200
|
+
ret[data2.path] ??= data2.id;
|
|
1201
|
+
return ret;
|
|
1202
|
+
}, {});
|
|
1203
|
+
}
|
|
1204
|
+
this.#log = extendLog(this.#context.log, "file-system");
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
1208
|
+
*
|
|
1209
|
+
* @param pathOrId - The path or id to check.
|
|
1210
|
+
* @param options - Optional parameters for resolving the path.
|
|
1211
|
+
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
1212
|
+
*/
|
|
1213
|
+
isVirtual(pathOrId, options = {}) {
|
|
1214
|
+
if (!pathOrId) {
|
|
1215
|
+
return false;
|
|
1216
|
+
}
|
|
1217
|
+
const resolvedPath = this.resolve(pathOrId, {
|
|
1218
|
+
...options,
|
|
1219
|
+
type: "file"
|
|
1220
|
+
});
|
|
1221
|
+
if (!resolvedPath) {
|
|
1222
|
+
return false;
|
|
1223
|
+
}
|
|
1224
|
+
return this.metadata[resolvedPath]?.mode === "virtual";
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1228
|
+
*
|
|
1229
|
+
* @param pathOrId - The path or id to check.
|
|
1230
|
+
* @param options - Optional parameters for resolving the path.
|
|
1231
|
+
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1232
|
+
*/
|
|
1233
|
+
isPhysical(pathOrId, options = {}) {
|
|
1234
|
+
if (!pathOrId) {
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
const resolvedPath = this.resolve(pathOrId, {
|
|
1238
|
+
...options,
|
|
1239
|
+
type: "file"
|
|
1240
|
+
});
|
|
1241
|
+
if (!resolvedPath) {
|
|
1242
|
+
return false;
|
|
1243
|
+
}
|
|
1244
|
+
return this.metadata[resolvedPath]?.mode === "fs";
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Lists files in a given path.
|
|
1248
|
+
*
|
|
1249
|
+
* @param path - The path to list files from.
|
|
1250
|
+
* @param options - Options for listing files, such as encoding and recursion.
|
|
1251
|
+
* @returns An array of file names in the specified path.
|
|
1252
|
+
*/
|
|
1253
|
+
readdirSync(path, options = "utf8") {
|
|
1254
|
+
return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Removes a file in the virtual file system (VFS).
|
|
1258
|
+
*
|
|
1259
|
+
* @param path - The path to create the directory at.
|
|
1260
|
+
*/
|
|
1261
|
+
unlinkSync(path, options) {
|
|
1262
|
+
const formattedPath = toFilePath(path);
|
|
1263
|
+
if (!this.isFile(formattedPath)) {
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
|
|
1267
|
+
this.#unifiedFS.resolveFS(path, options).unlinkSync(formattedPath);
|
|
1268
|
+
if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
|
|
1269
|
+
delete this.metadata[this.paths[formattedPath]];
|
|
1270
|
+
}
|
|
1271
|
+
this.#clearResolverCache(formattedPath);
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Removes a file in the virtual file system (VFS).
|
|
1275
|
+
*
|
|
1276
|
+
* @param path - The path to create the directory at.
|
|
1277
|
+
*/
|
|
1278
|
+
async unlink(path, options) {
|
|
1279
|
+
const formattedPath = toFilePath(path);
|
|
1280
|
+
if (!this.isFile(formattedPath)) {
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
|
|
1284
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
|
|
1285
|
+
await this.#unifiedFS.resolveFS(path, options).promises.unlink(formattedPath);
|
|
1286
|
+
if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
|
|
1287
|
+
delete this.metadata[this.paths[formattedPath]];
|
|
1288
|
+
}
|
|
1289
|
+
this.#clearResolverCache(formattedPath);
|
|
1290
|
+
} else {
|
|
1291
|
+
this.unlinkSync(formattedPath, options);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Removes a directory in the virtual file system (VFS).
|
|
1296
|
+
*
|
|
1297
|
+
* @param path - The path to create the directory at.
|
|
1298
|
+
* @param options - Options for creating the directory.
|
|
1299
|
+
*/
|
|
1300
|
+
rmdirSync(path, options = {}) {
|
|
1301
|
+
const formattedPath = toFilePath(path);
|
|
1302
|
+
if (!this.isDirectory(formattedPath)) {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
|
|
1306
|
+
this.#unifiedFS.resolveFS(path, options).rmdirSync(formattedPath, defu2__default.default(options, {
|
|
1307
|
+
recursive: true
|
|
1308
|
+
}));
|
|
1309
|
+
this.#clearResolverCache(formattedPath);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Removes a directory in the virtual file system (VFS).
|
|
1313
|
+
*
|
|
1314
|
+
* @param path - The path to create the directory at.
|
|
1315
|
+
* @param options - Options for creating the directory.
|
|
1316
|
+
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
1317
|
+
*/
|
|
1318
|
+
async rmdir(path, options = {}) {
|
|
1319
|
+
const formattedPath = toFilePath(path);
|
|
1320
|
+
if (!this.isDirectory(formattedPath)) {
|
|
911
1321
|
return;
|
|
912
1322
|
}
|
|
913
1323
|
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
|
|
914
|
-
if (isFunction.isFunction(this.resolveFS(path, options).promises.rm)) {
|
|
915
|
-
await this.resolveFS(path, options).promises.rm(formattedPath,
|
|
1324
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
|
|
1325
|
+
await this.#unifiedFS.resolveFS(path, options).promises.rm(formattedPath, defu2__default.default(options, {
|
|
916
1326
|
force: true,
|
|
917
1327
|
recursive: true
|
|
918
1328
|
}));
|
|
919
|
-
this.#
|
|
920
|
-
this.clearResolverCache(formattedPath);
|
|
1329
|
+
this.#clearResolverCache(formattedPath);
|
|
921
1330
|
} else {
|
|
922
|
-
this.rmdirSync(formattedPath,
|
|
1331
|
+
this.rmdirSync(formattedPath, defu2__default.default(options ?? {}, {
|
|
923
1332
|
force: true,
|
|
924
1333
|
recursive: true
|
|
925
1334
|
}));
|
|
@@ -961,8 +1370,8 @@ var VirtualFileSystem = class {
|
|
|
961
1370
|
*/
|
|
962
1371
|
mkdirSync(path, options = {}) {
|
|
963
1372
|
const filePath = toFilePath(path);
|
|
964
|
-
this
|
|
965
|
-
return this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
1373
|
+
this.#clearResolverCache(filePath);
|
|
1374
|
+
return this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu2__default.default(options ?? {}, {
|
|
966
1375
|
recursive: true
|
|
967
1376
|
}));
|
|
968
1377
|
}
|
|
@@ -976,16 +1385,16 @@ var VirtualFileSystem = class {
|
|
|
976
1385
|
async mkdir(path, options = {}) {
|
|
977
1386
|
let result;
|
|
978
1387
|
const filePath = toFilePath(path);
|
|
979
|
-
if (isFunction.isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
|
|
980
|
-
result = await this.resolveFS(filePath, options).promises.mkdir(filePath,
|
|
1388
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath, options).promises.mkdir)) {
|
|
1389
|
+
result = await this.#unifiedFS.resolveFS(filePath, options).promises.mkdir(filePath, defu2__default.default(options ?? {}, {
|
|
981
1390
|
recursive: true
|
|
982
1391
|
}));
|
|
983
1392
|
} else {
|
|
984
|
-
result = this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
1393
|
+
result = this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu2__default.default(options ?? {}, {
|
|
985
1394
|
recursive: true
|
|
986
1395
|
}));
|
|
987
1396
|
}
|
|
988
|
-
this
|
|
1397
|
+
this.#clearResolverCache(filePath);
|
|
989
1398
|
return result;
|
|
990
1399
|
}
|
|
991
1400
|
/**
|
|
@@ -1033,7 +1442,7 @@ var VirtualFileSystem = class {
|
|
|
1033
1442
|
if (stats.isDirectory()) {
|
|
1034
1443
|
stack.push(full);
|
|
1035
1444
|
} else if (stats.isFile()) {
|
|
1036
|
-
if (this
|
|
1445
|
+
if (this.#buildRegex(absPattern).test(full)) {
|
|
1037
1446
|
const resolved = this.resolve(full, {
|
|
1038
1447
|
type: "file"
|
|
1039
1448
|
});
|
|
@@ -1092,7 +1501,7 @@ var VirtualFileSystem = class {
|
|
|
1092
1501
|
if (stats.isDirectory()) {
|
|
1093
1502
|
stack.push(full);
|
|
1094
1503
|
} else if (stats.isFile()) {
|
|
1095
|
-
if (this
|
|
1504
|
+
if (this.#buildRegex(absPattern).test(full)) {
|
|
1096
1505
|
const resolved = this.resolve(full, {
|
|
1097
1506
|
type: "file"
|
|
1098
1507
|
});
|
|
@@ -1156,7 +1565,7 @@ var VirtualFileSystem = class {
|
|
|
1156
1565
|
* @returns An array of file names in the specified path.
|
|
1157
1566
|
*/
|
|
1158
1567
|
async readdir(pathOrId, options = "utf8") {
|
|
1159
|
-
return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
|
|
1568
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
|
|
1160
1569
|
}
|
|
1161
1570
|
/**
|
|
1162
1571
|
* Asynchronously reads a file from the virtual file system (VFS).
|
|
@@ -1172,17 +1581,13 @@ var VirtualFileSystem = class {
|
|
|
1172
1581
|
type: "file"
|
|
1173
1582
|
});
|
|
1174
1583
|
if (filePath) {
|
|
1175
|
-
if (this.#cachedFS.has(filePath)) {
|
|
1176
|
-
return this.#cachedFS.get(filePath);
|
|
1177
|
-
}
|
|
1178
1584
|
let result;
|
|
1179
|
-
if (isFunction.isFunction(this.resolveFS(filePath).promises.readFile)) {
|
|
1180
|
-
result = (await this.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
1585
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
|
|
1586
|
+
result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
1181
1587
|
} else {
|
|
1182
|
-
result = this.resolveFS(filePath).readFileSync(filePath, options);
|
|
1588
|
+
result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
1183
1589
|
}
|
|
1184
1590
|
const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
1185
|
-
this.#cachedFS.set(filePath, content);
|
|
1186
1591
|
return content;
|
|
1187
1592
|
}
|
|
1188
1593
|
return void 0;
|
|
@@ -1201,12 +1606,8 @@ var VirtualFileSystem = class {
|
|
|
1201
1606
|
type: "file"
|
|
1202
1607
|
});
|
|
1203
1608
|
if (filePath) {
|
|
1204
|
-
|
|
1205
|
-
return this.#cachedFS.get(filePath);
|
|
1206
|
-
}
|
|
1207
|
-
const result = this.resolveFS(filePath).readFileSync(filePath, options);
|
|
1609
|
+
const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
1208
1610
|
const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
1209
|
-
this.#cachedFS.set(filePath, content);
|
|
1210
1611
|
return content;
|
|
1211
1612
|
}
|
|
1212
1613
|
return void 0;
|
|
@@ -1234,17 +1635,15 @@ var VirtualFileSystem = class {
|
|
|
1234
1635
|
});
|
|
1235
1636
|
}
|
|
1236
1637
|
}
|
|
1237
|
-
const outputMode = this.
|
|
1238
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
|
|
1239
|
-
this.
|
|
1240
|
-
path: formattedPath,
|
|
1241
|
-
code,
|
|
1638
|
+
const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1639
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
1640
|
+
this.metadata[formattedPath] = {
|
|
1242
1641
|
mode: outputMode,
|
|
1243
1642
|
variant: "normal",
|
|
1244
1643
|
...isPowerLinesWriteFileData(data) ? data : {}
|
|
1245
1644
|
};
|
|
1246
|
-
this
|
|
1247
|
-
const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1645
|
+
this.#clearResolverCache(formattedPath);
|
|
1646
|
+
const ifs = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1248
1647
|
if (isFunction.isFunction(ifs.promises.writeFile)) {
|
|
1249
1648
|
return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
|
|
1250
1649
|
}
|
|
@@ -1263,17 +1662,15 @@ var VirtualFileSystem = class {
|
|
|
1263
1662
|
this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1264
1663
|
}
|
|
1265
1664
|
const code = isPowerLinesWriteFileData(data) ? data.code : data;
|
|
1266
|
-
const outputMode = this.
|
|
1267
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
|
|
1268
|
-
this.
|
|
1269
|
-
path: formattedPath,
|
|
1270
|
-
code,
|
|
1665
|
+
const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1666
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
1667
|
+
this.metadata[formattedPath] = {
|
|
1271
1668
|
mode: outputMode,
|
|
1272
1669
|
variant: "normal",
|
|
1273
1670
|
...isPowerLinesWriteFileData(data) ? data : {}
|
|
1274
1671
|
};
|
|
1275
|
-
this
|
|
1276
|
-
const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
|
|
1672
|
+
this.#clearResolverCache(formattedPath);
|
|
1673
|
+
const writeStream = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
|
|
1277
1674
|
try {
|
|
1278
1675
|
writeStream.write(code);
|
|
1279
1676
|
} finally {
|
|
@@ -1297,8 +1694,8 @@ var VirtualFileSystem = class {
|
|
|
1297
1694
|
*/
|
|
1298
1695
|
getMetadata(pathOrId) {
|
|
1299
1696
|
const resolved = this.resolve(pathOrId);
|
|
1300
|
-
if (resolved && this.
|
|
1301
|
-
return this.
|
|
1697
|
+
if (resolved && this.metadata[resolved]) {
|
|
1698
|
+
return this.metadata[resolved];
|
|
1302
1699
|
}
|
|
1303
1700
|
return void 0;
|
|
1304
1701
|
}
|
|
@@ -1313,7 +1710,7 @@ var VirtualFileSystem = class {
|
|
|
1313
1710
|
*/
|
|
1314
1711
|
isFile(pathOrId) {
|
|
1315
1712
|
const resolved = this.resolve(pathOrId);
|
|
1316
|
-
return !!(resolved && (this.#
|
|
1713
|
+
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
|
|
1317
1714
|
}
|
|
1318
1715
|
/**
|
|
1319
1716
|
* Checks if a directory exists in the virtual file system (VFS).
|
|
@@ -1323,7 +1720,7 @@ var VirtualFileSystem = class {
|
|
|
1323
1720
|
*/
|
|
1324
1721
|
isDirectory(pathOrId) {
|
|
1325
1722
|
const resolved = this.resolve(pathOrId);
|
|
1326
|
-
return !!(resolved && (this.#
|
|
1723
|
+
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
|
|
1327
1724
|
}
|
|
1328
1725
|
/**
|
|
1329
1726
|
* Retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -1332,7 +1729,7 @@ var VirtualFileSystem = class {
|
|
|
1332
1729
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
1333
1730
|
*/
|
|
1334
1731
|
async stat(pathOrId, options) {
|
|
1335
|
-
return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1732
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1336
1733
|
}
|
|
1337
1734
|
/**
|
|
1338
1735
|
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -1341,7 +1738,7 @@ var VirtualFileSystem = class {
|
|
|
1341
1738
|
* @returns The file's status information, or false if the file does not exist.
|
|
1342
1739
|
*/
|
|
1343
1740
|
statSync(pathOrId) {
|
|
1344
|
-
return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
|
|
1741
|
+
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
|
|
1345
1742
|
}
|
|
1346
1743
|
/**
|
|
1347
1744
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -1350,7 +1747,7 @@ var VirtualFileSystem = class {
|
|
|
1350
1747
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
1351
1748
|
*/
|
|
1352
1749
|
async lstat(pathOrId, options) {
|
|
1353
|
-
return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1750
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1354
1751
|
}
|
|
1355
1752
|
/**
|
|
1356
1753
|
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -1358,44 +1755,8 @@ var VirtualFileSystem = class {
|
|
|
1358
1755
|
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
1359
1756
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
1360
1757
|
*/
|
|
1361
|
-
lstatSync(pathOrId, options) {
|
|
1362
|
-
return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1363
|
-
}
|
|
1364
|
-
/**
|
|
1365
|
-
* Resolves a path based on TypeScript's `tsconfig.json` paths.
|
|
1366
|
-
*
|
|
1367
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
1368
|
-
*
|
|
1369
|
-
* @param path - The path to check.
|
|
1370
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1371
|
-
*/
|
|
1372
|
-
resolveTsconfigPath(path) {
|
|
1373
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1374
|
-
for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
|
|
1375
|
-
const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
|
|
1376
|
-
if (resolvedPath) {
|
|
1377
|
-
return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
return false;
|
|
1382
|
-
}
|
|
1383
|
-
/**
|
|
1384
|
-
* Resolves a path based on TypeScript's `tsconfig.json` paths.
|
|
1385
|
-
*
|
|
1386
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
1387
|
-
*
|
|
1388
|
-
* @param path - The path to check.
|
|
1389
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1390
|
-
*/
|
|
1391
|
-
resolveTsconfigPathPackage(path) {
|
|
1392
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1393
|
-
const tsconfigPathKeys = Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")));
|
|
1394
|
-
if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
|
|
1395
|
-
return tsconfigPathKeys[0].replace(/\/\*$/, "");
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
return false;
|
|
1758
|
+
lstatSync(pathOrId, options) {
|
|
1759
|
+
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1399
1760
|
}
|
|
1400
1761
|
/**
|
|
1401
1762
|
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
@@ -1423,9 +1784,9 @@ var VirtualFileSystem = class {
|
|
|
1423
1784
|
if (this.#cachedResolver.has(resolverKey)) {
|
|
1424
1785
|
return this.#cachedResolver.get(resolverKey);
|
|
1425
1786
|
}
|
|
1426
|
-
let result = this
|
|
1787
|
+
let result = this.#resolveId(formattedPathOrId);
|
|
1427
1788
|
if (!result) {
|
|
1428
|
-
result = this
|
|
1789
|
+
result = this.#resolvePath(formattedPathOrId, options);
|
|
1429
1790
|
}
|
|
1430
1791
|
if (!result) {
|
|
1431
1792
|
result = false;
|
|
@@ -1437,18 +1798,6 @@ var VirtualFileSystem = class {
|
|
|
1437
1798
|
return result;
|
|
1438
1799
|
}
|
|
1439
1800
|
/**
|
|
1440
|
-
* Retrieves the partial metadata for all files in the virtual file system (VFS).
|
|
1441
|
-
*
|
|
1442
|
-
* @returns A record containing the partial metadata for all files.
|
|
1443
|
-
*/
|
|
1444
|
-
getPartialMeta() {
|
|
1445
|
-
return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
|
|
1446
|
-
}
|
|
1447
|
-
buildRegex(strPattern) {
|
|
1448
|
-
const token = "::GLOBSTAR::";
|
|
1449
|
-
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1450
|
-
}
|
|
1451
|
-
/**
|
|
1452
1801
|
* Converts a relative path to an absolute path based on the workspace and project root.
|
|
1453
1802
|
*
|
|
1454
1803
|
* @param path - The relative path to convert.
|
|
@@ -1464,207 +1813,159 @@ var VirtualFileSystem = class {
|
|
|
1464
1813
|
return formattedPath;
|
|
1465
1814
|
}
|
|
1466
1815
|
/**
|
|
1467
|
-
*
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
return result;
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
for (const parentPath of this.resolveParentPaths(path, options.paths)) {
|
|
1506
|
-
const request = joinPaths.joinPaths(parentPath, path);
|
|
1507
|
-
if (this.#existsSync(request)) {
|
|
1508
|
-
return request;
|
|
1509
|
-
}
|
|
1510
|
-
const result = this.checkVariants(request);
|
|
1511
|
-
if (result) {
|
|
1512
|
-
return result;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
return false;
|
|
1516
|
-
}
|
|
1517
|
-
resolveParentPaths(request, parents = []) {
|
|
1518
|
-
let paths = [
|
|
1519
|
-
this.#context.workspaceConfig.workspaceRoot,
|
|
1520
|
-
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1521
|
-
];
|
|
1522
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1523
|
-
paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
|
|
1524
|
-
if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1525
|
-
ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1816
|
+
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
1817
|
+
*/
|
|
1818
|
+
async dispose() {
|
|
1819
|
+
if (!this.#isDisposed) {
|
|
1820
|
+
this.#isDisposed = true;
|
|
1821
|
+
this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
1822
|
+
await this.unlink(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"));
|
|
1823
|
+
const message = new $__namespace.Message();
|
|
1824
|
+
const data = message.initRoot(FileSystemData);
|
|
1825
|
+
const virtualFS = this.#unifiedFS.toJSON();
|
|
1826
|
+
const files = data._initFiles(Object.keys(virtualFS).length);
|
|
1827
|
+
Object.entries(virtualFS).filter(([_, content]) => content).forEach(([path, content], index) => {
|
|
1828
|
+
const fileData = files.get(index);
|
|
1829
|
+
fileData.path = path;
|
|
1830
|
+
fileData.content = content;
|
|
1831
|
+
});
|
|
1832
|
+
const ids = data._initIds(Object.keys(this.ids).length);
|
|
1833
|
+
Object.entries(this.ids).forEach(([id, path], index) => {
|
|
1834
|
+
const fileId = ids.get(index);
|
|
1835
|
+
fileId.id = id;
|
|
1836
|
+
fileId.path = path;
|
|
1837
|
+
});
|
|
1838
|
+
const metadata = data._initMetadata(Object.keys(this.metadata).length);
|
|
1839
|
+
Object.entries(this.metadata).forEach(([id, value], index) => {
|
|
1840
|
+
const fileMetadata = metadata.get(index);
|
|
1841
|
+
fileMetadata.id = id;
|
|
1842
|
+
fileMetadata.mode = value.mode;
|
|
1843
|
+
fileMetadata.variant = value.variant;
|
|
1844
|
+
if (value.properties) {
|
|
1845
|
+
const props = fileMetadata._initProperties(Object.keys(value.properties).length);
|
|
1846
|
+
Object.entries(value.properties).forEach(([key, val], propIndex) => {
|
|
1847
|
+
const propData = props.get(propIndex);
|
|
1848
|
+
propData.key = key;
|
|
1849
|
+
propData.value = val;
|
|
1850
|
+
});
|
|
1526
1851
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
}
|
|
1530
|
-
return paths.reduce((ret, path) => {
|
|
1531
|
-
if (!ret.includes(path)) {
|
|
1532
|
-
ret.push(path);
|
|
1533
|
-
}
|
|
1534
|
-
return ret;
|
|
1535
|
-
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1536
|
-
}
|
|
1537
|
-
/**
|
|
1538
|
-
* Select the file system module to use for the operation based on the path or URL.
|
|
1539
|
-
*
|
|
1540
|
-
* @param pathOrUrl - The path to perform the file system operation on.
|
|
1541
|
-
* @param options - Options for the operation, such as output mode.
|
|
1542
|
-
* @returns The file system module used for the operation.
|
|
1543
|
-
*/
|
|
1544
|
-
resolveFS(pathOrUrl, options = {}) {
|
|
1545
|
-
const mode = this.resolveOutputMode(pathOrUrl, options);
|
|
1546
|
-
if (mode === "virtual") {
|
|
1547
|
-
return this.#virtualFS;
|
|
1548
|
-
} else if (mode === "fs") {
|
|
1549
|
-
return this.#fs;
|
|
1550
|
-
}
|
|
1551
|
-
return this.#unifiedFS;
|
|
1552
|
-
}
|
|
1553
|
-
/**
|
|
1554
|
-
* Select the file system module to use for the operation based on the path or URL.
|
|
1555
|
-
*
|
|
1556
|
-
* @param pathOrUrl - The path to perform the file system operation on.
|
|
1557
|
-
* @param options - Options for the operation, such as output mode.
|
|
1558
|
-
* @returns The file system module used for the operation.
|
|
1559
|
-
*/
|
|
1560
|
-
resolveOutputMode(pathOrUrl, options = {}) {
|
|
1561
|
-
if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
|
|
1562
|
-
return "virtual";
|
|
1563
|
-
} else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
1564
|
-
return "fs";
|
|
1852
|
+
});
|
|
1853
|
+
await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"), message.toArrayBuffer());
|
|
1565
1854
|
}
|
|
1566
|
-
return void 0;
|
|
1567
|
-
}
|
|
1568
|
-
/**
|
|
1569
|
-
* Clears the resolver cache for a given path.
|
|
1570
|
-
*
|
|
1571
|
-
* @param path - The path to clear the resolver cache for.
|
|
1572
|
-
*/
|
|
1573
|
-
clearResolverCache(path) {
|
|
1574
|
-
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1575
1855
|
}
|
|
1576
1856
|
/**
|
|
1577
|
-
*
|
|
1578
|
-
*
|
|
1579
|
-
* @param request - The request path to check.
|
|
1580
|
-
* @param parentPath - An optional parent path to prepend to the request.
|
|
1581
|
-
* @returns The file path if it exists, otherwise false.
|
|
1857
|
+
* Initializes the virtual file system (VFS) by patching the file system module if necessary.
|
|
1582
1858
|
*/
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
return file;
|
|
1588
|
-
}
|
|
1589
|
-
file = this.checkIndex(path);
|
|
1590
|
-
if (file) {
|
|
1591
|
-
return file;
|
|
1859
|
+
[__VFS_PATCH__]() {
|
|
1860
|
+
if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
1861
|
+
this.#revert = patchFS(fs__default.default, this);
|
|
1862
|
+
this.#isPatched = true;
|
|
1592
1863
|
}
|
|
1593
|
-
return false;
|
|
1594
1864
|
}
|
|
1595
1865
|
/**
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
1598
|
-
* @param request - The request path to check.
|
|
1599
|
-
* @returns The index file path if it exists, otherwise false.
|
|
1866
|
+
* Reverts the file system module to its original state if it was previously patched.
|
|
1600
1867
|
*/
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
return file;
|
|
1868
|
+
[__VFS_REVERT__]() {
|
|
1869
|
+
if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
1870
|
+
if (!this.#revert) {
|
|
1871
|
+
throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
|
|
1872
|
+
}
|
|
1873
|
+
this.#revert?.();
|
|
1874
|
+
this.#isPatched = false;
|
|
1609
1875
|
}
|
|
1610
|
-
return false;
|
|
1611
1876
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
*
|
|
1615
|
-
* @param request - The request path to check.
|
|
1616
|
-
* @param vfs - The file system module to use for checking file existence.
|
|
1617
|
-
* @returns The file path if it exists with any of the checked extensions, otherwise false.
|
|
1618
|
-
*/
|
|
1619
|
-
checkExtensions(request) {
|
|
1620
|
-
let file = `${request}.ts`;
|
|
1621
|
-
if (this.#existsSync(file)) {
|
|
1622
|
-
return file;
|
|
1623
|
-
}
|
|
1624
|
-
file = `${request}.mts`;
|
|
1625
|
-
if (this.#existsSync(file)) {
|
|
1626
|
-
return file;
|
|
1627
|
-
}
|
|
1628
|
-
file = `${request}.cts`;
|
|
1629
|
-
if (this.#existsSync(file)) {
|
|
1630
|
-
return file;
|
|
1631
|
-
}
|
|
1632
|
-
file = `${request}.tsx`;
|
|
1633
|
-
if (this.#existsSync(file)) {
|
|
1634
|
-
return file;
|
|
1635
|
-
}
|
|
1636
|
-
file = `${request}.js`;
|
|
1637
|
-
if (this.#existsSync(file)) {
|
|
1638
|
-
return file;
|
|
1639
|
-
}
|
|
1640
|
-
file = `${request}.mjs`;
|
|
1641
|
-
if (this.#existsSync(file)) {
|
|
1642
|
-
return file;
|
|
1643
|
-
}
|
|
1644
|
-
file = `${request}.cjs`;
|
|
1645
|
-
if (this.#existsSync(file)) {
|
|
1646
|
-
return file;
|
|
1647
|
-
}
|
|
1648
|
-
file = `${request}.jsx`;
|
|
1649
|
-
if (this.#existsSync(file)) {
|
|
1650
|
-
return file;
|
|
1651
|
-
}
|
|
1652
|
-
file = `${request}.json`;
|
|
1653
|
-
if (this.#existsSync(file)) {
|
|
1654
|
-
return file;
|
|
1655
|
-
}
|
|
1656
|
-
file = `${request}.d.ts`;
|
|
1657
|
-
if (this.#existsSync(file)) {
|
|
1658
|
-
return file;
|
|
1659
|
-
}
|
|
1660
|
-
return false;
|
|
1877
|
+
async [Symbol.asyncDispose]() {
|
|
1878
|
+
return this.dispose();
|
|
1661
1879
|
}
|
|
1662
1880
|
};
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1881
|
+
|
|
1882
|
+
// ../powerlines/src/types/commands.ts
|
|
1883
|
+
var SUPPORTED_COMMANDS = [
|
|
1884
|
+
"new",
|
|
1885
|
+
"clean",
|
|
1886
|
+
"prepare",
|
|
1887
|
+
"lint",
|
|
1888
|
+
"test",
|
|
1889
|
+
"build",
|
|
1890
|
+
"docs",
|
|
1891
|
+
"deploy",
|
|
1892
|
+
"finalize"
|
|
1893
|
+
];
|
|
1894
|
+
|
|
1895
|
+
// ../powerlines/src/plugin-utils/helpers.ts
|
|
1896
|
+
function isPlugin(value) {
|
|
1897
|
+
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
|
|
1898
|
+
}
|
|
1899
|
+
chunkSHUYVCID_js.__name(isPlugin, "isPlugin");
|
|
1900
|
+
function isPluginConfigObject(value) {
|
|
1901
|
+
return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
|
|
1902
|
+
}
|
|
1903
|
+
chunkSHUYVCID_js.__name(isPluginConfigObject, "isPluginConfigObject");
|
|
1904
|
+
function isPluginConfigTuple(value) {
|
|
1905
|
+
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
|
|
1906
|
+
}
|
|
1907
|
+
chunkSHUYVCID_js.__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
1908
|
+
function isPluginConfig(value) {
|
|
1909
|
+
return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
1910
|
+
}
|
|
1911
|
+
chunkSHUYVCID_js.__name(isPluginConfig, "isPluginConfig");
|
|
1912
|
+
function isPluginHookFunction(value) {
|
|
1913
|
+
return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
1914
|
+
}
|
|
1915
|
+
chunkSHUYVCID_js.__name(isPluginHookFunction, "isPluginHookFunction");
|
|
1916
|
+
function isPluginHookObject(value) {
|
|
1917
|
+
return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
1918
|
+
}
|
|
1919
|
+
chunkSHUYVCID_js.__name(isPluginHookObject, "isPluginHookObject");
|
|
1920
|
+
function isPluginHook(value) {
|
|
1921
|
+
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
1922
|
+
}
|
|
1923
|
+
chunkSHUYVCID_js.__name(isPluginHook, "isPluginHook");
|
|
1924
|
+
function getHookHandler(pluginHook) {
|
|
1925
|
+
return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
1926
|
+
}
|
|
1927
|
+
chunkSHUYVCID_js.__name(getHookHandler, "getHookHandler");
|
|
1928
|
+
function isHookExternal(hook) {
|
|
1929
|
+
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
1930
|
+
}
|
|
1931
|
+
chunkSHUYVCID_js.__name(isHookExternal, "isHookExternal");
|
|
1932
|
+
function checkDedupe(plugin, plugins2) {
|
|
1933
|
+
return plugin.dedupe === false || plugins2.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
1934
|
+
}
|
|
1935
|
+
chunkSHUYVCID_js.__name(checkDedupe, "checkDedupe");
|
|
1936
|
+
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
1937
|
+
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
1938
|
+
hooksList.push(isFunction.isFunction(pluginHook) ? {
|
|
1939
|
+
plugin,
|
|
1940
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
1941
|
+
} : {
|
|
1942
|
+
plugin,
|
|
1943
|
+
...pluginHook,
|
|
1944
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
chunkSHUYVCID_js.__name(addPluginHook, "addPluginHook");
|
|
1949
|
+
function resolveOptions(options) {
|
|
1950
|
+
return defu2__default.default(options, {
|
|
1951
|
+
interopDefault: true,
|
|
1952
|
+
fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
|
|
1953
|
+
moduleCache: options.mode !== "development"
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
chunkSHUYVCID_js.__name(resolveOptions, "resolveOptions");
|
|
1957
|
+
function createPluginResolver(options) {
|
|
1958
|
+
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
1959
|
+
...options
|
|
1960
|
+
}));
|
|
1961
|
+
}
|
|
1962
|
+
chunkSHUYVCID_js.__name(createPluginResolver, "createPluginResolver");
|
|
1963
|
+
function createResolver(options) {
|
|
1964
|
+
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
|
|
1965
|
+
baseResolver.plugin = createPluginResolver(options);
|
|
1966
|
+
return baseResolver;
|
|
1666
1967
|
}
|
|
1667
|
-
chunkSHUYVCID_js.__name(
|
|
1968
|
+
chunkSHUYVCID_js.__name(createResolver, "createResolver");
|
|
1668
1969
|
|
|
1669
1970
|
// ../powerlines/src/internal/contexts/context.ts
|
|
1670
1971
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1715,7 +2016,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1715
2016
|
* @returns A promise that resolves to the new context.
|
|
1716
2017
|
*/
|
|
1717
2018
|
static async from(workspaceRoot, config) {
|
|
1718
|
-
const context = new _PowerlinesContext(await
|
|
2019
|
+
const context = new _PowerlinesContext(await chunkLTCZN4I4_js.loadWorkspaceConfig(workspaceRoot, config.root));
|
|
1719
2020
|
await context.withUserConfig(config);
|
|
1720
2021
|
context.powerlinesPath = await resolve.resolvePackage("powerlines");
|
|
1721
2022
|
if (!context.powerlinesPath) {
|
|
@@ -1779,7 +2080,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1779
2080
|
*/
|
|
1780
2081
|
get fs() {
|
|
1781
2082
|
if (!this.#fs) {
|
|
1782
|
-
this.#fs =
|
|
2083
|
+
this.#fs = VirtualFileSystem.createSync(this);
|
|
1783
2084
|
}
|
|
1784
2085
|
return this.#fs;
|
|
1785
2086
|
}
|
|
@@ -1802,13 +2103,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1802
2103
|
workspaceRoot: this.workspaceConfig?.workspaceRoot,
|
|
1803
2104
|
projectRoot: this.config?.projectRoot
|
|
1804
2105
|
}, {
|
|
1805
|
-
maxLength:
|
|
2106
|
+
maxLength: chunkLTCZN4I4_js.PROJECT_ROOT_HASH_LENGTH
|
|
1806
2107
|
}),
|
|
1807
2108
|
configHash: murmurhash.murmurhash(this.config, {
|
|
1808
|
-
maxLength:
|
|
1809
|
-
})
|
|
1810
|
-
builtinIdMap: {},
|
|
1811
|
-
virtualFiles: {}
|
|
2109
|
+
maxLength: chunkLTCZN4I4_js.CACHE_HASH_LENGTH
|
|
2110
|
+
})
|
|
1812
2111
|
};
|
|
1813
2112
|
}
|
|
1814
2113
|
/**
|
|
@@ -1867,7 +2166,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1867
2166
|
* Get the path to the data directory for the project
|
|
1868
2167
|
*/
|
|
1869
2168
|
get dataPath() {
|
|
1870
|
-
return join.joinPaths(this.envPaths.data, "projects",
|
|
2169
|
+
return join.joinPaths(this.envPaths.data, "projects", chunkLTCZN4I4_js.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
|
|
1871
2170
|
}
|
|
1872
2171
|
/**
|
|
1873
2172
|
* Get the path to the cache directory for the project
|
|
@@ -1877,7 +2176,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1877
2176
|
checksum: this.#checksum,
|
|
1878
2177
|
config: this.meta.configHash
|
|
1879
2178
|
}, {
|
|
1880
|
-
maxLength:
|
|
2179
|
+
maxLength: chunkLTCZN4I4_js.CACHE_HASH_LENGTH
|
|
1881
2180
|
}));
|
|
1882
2181
|
}
|
|
1883
2182
|
/**
|
|
@@ -1896,13 +2195,13 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1896
2195
|
* The builtin module id that exist in the Powerlines virtual file system
|
|
1897
2196
|
*/
|
|
1898
2197
|
get builtins() {
|
|
1899
|
-
return Object.values(this.fs.
|
|
2198
|
+
return Object.values(this.fs.metadata).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
|
|
1900
2199
|
}
|
|
1901
2200
|
/**
|
|
1902
|
-
* Get the
|
|
2201
|
+
* Get the builtin virtual files that exist in the Powerlines virtual file system
|
|
1903
2202
|
*/
|
|
1904
2203
|
async getBuiltins() {
|
|
1905
|
-
return Promise.all(Object.entries(this.fs.
|
|
2204
|
+
return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
|
|
1906
2205
|
const code = await this.fs.readFile(path);
|
|
1907
2206
|
return {
|
|
1908
2207
|
...meta,
|
|
@@ -1922,7 +2221,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1922
2221
|
return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
|
|
1923
2222
|
code,
|
|
1924
2223
|
variant: "entry"
|
|
1925
|
-
},
|
|
2224
|
+
}, defu2__default.default(options, {
|
|
1926
2225
|
mode: this.config.output.mode
|
|
1927
2226
|
}));
|
|
1928
2227
|
}
|
|
@@ -1939,7 +2238,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1939
2238
|
id,
|
|
1940
2239
|
code,
|
|
1941
2240
|
variant: "builtin"
|
|
1942
|
-
},
|
|
2241
|
+
}, defu2__default.default(options, {
|
|
1943
2242
|
mode: this.config.output.mode
|
|
1944
2243
|
}));
|
|
1945
2244
|
}
|
|
@@ -1961,7 +2260,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1961
2260
|
options
|
|
1962
2261
|
});
|
|
1963
2262
|
}
|
|
1964
|
-
const result = await oxcParser.parseAsync(id, code,
|
|
2263
|
+
const result = await oxcParser.parseAsync(id, code, defu2__default.default(options ?? {}, {
|
|
1965
2264
|
lang: filePathFns.hasFileExtension(id) ? void 0 : "ts",
|
|
1966
2265
|
astType: filePathFns.hasFileExtension(id) ? void 0 : "ts",
|
|
1967
2266
|
sourceType: "module",
|
|
@@ -2130,7 +2429,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2130
2429
|
if (exists.existsSync(packageJsonPath)) {
|
|
2131
2430
|
this.packageJson = await json.readJsonFile(packageJsonPath);
|
|
2132
2431
|
}
|
|
2133
|
-
this.#checksum = await
|
|
2432
|
+
this.#checksum = await chunkLTCZN4I4_js.getChecksum(cacheKey.projectRoot);
|
|
2134
2433
|
this.resolver = createResolver({
|
|
2135
2434
|
workspaceRoot: this.workspaceConfig.workspaceRoot,
|
|
2136
2435
|
projectRoot: cacheKey.projectRoot,
|
|
@@ -2138,7 +2437,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2138
2437
|
mode: cacheKey.mode,
|
|
2139
2438
|
skipCache: cacheKey.skipCache
|
|
2140
2439
|
});
|
|
2141
|
-
const userConfig = await
|
|
2440
|
+
const userConfig = await chunkLTCZN4I4_js.loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
2142
2441
|
this.mergeUserConfig(userConfig.config);
|
|
2143
2442
|
configCache.set(cacheKey, {
|
|
2144
2443
|
projectJson: this.projectJson,
|
|
@@ -2149,7 +2448,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2149
2448
|
});
|
|
2150
2449
|
}
|
|
2151
2450
|
if (isSetObject.isSetObject(config)) {
|
|
2152
|
-
this.resolvedConfig =
|
|
2451
|
+
this.resolvedConfig = defu2__default.default({
|
|
2153
2452
|
inlineConfig: this.config.inlineConfig,
|
|
2154
2453
|
userConfig: this.config.userConfig
|
|
2155
2454
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
@@ -2243,9 +2542,10 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2243
2542
|
ret.push(plugin);
|
|
2244
2543
|
return ret;
|
|
2245
2544
|
}, []);
|
|
2545
|
+
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2246
2546
|
}
|
|
2247
2547
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
2248
|
-
this.config.userConfig =
|
|
2548
|
+
this.config.userConfig = defu2__default.default({
|
|
2249
2549
|
entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
|
|
2250
2550
|
}, omit.omit(from ?? {}, [
|
|
2251
2551
|
"entry"
|
|
@@ -2300,7 +2600,7 @@ async function callHook(context, hook, options, ...args) {
|
|
|
2300
2600
|
if (definedResults.length > 0) {
|
|
2301
2601
|
let mergedResult = void 0;
|
|
2302
2602
|
for (const result of definedResults) {
|
|
2303
|
-
mergedResult =
|
|
2603
|
+
mergedResult = defu2.defu(result, mergedResult ?? {});
|
|
2304
2604
|
}
|
|
2305
2605
|
return mergedResult;
|
|
2306
2606
|
}
|
|
@@ -2502,7 +2802,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
2502
2802
|
* @returns A promise that resolves to the new context.
|
|
2503
2803
|
*/
|
|
2504
2804
|
static async from(workspaceRoot, config) {
|
|
2505
|
-
const context = new _PowerlinesAPIContext(await
|
|
2805
|
+
const context = new _PowerlinesAPIContext(await chunkLTCZN4I4_js.loadWorkspaceConfig(workspaceRoot, config.root));
|
|
2506
2806
|
await context.withUserConfig(config);
|
|
2507
2807
|
context.powerlinesPath = await resolve.resolvePackage("powerlines");
|
|
2508
2808
|
if (!context.powerlinesPath) {
|
|
@@ -2610,7 +2910,7 @@ async function emitTypes(context, tsconfig, files) {
|
|
|
2610
2910
|
const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
|
|
2611
2911
|
const sourceFile = sourceFiles?.[0];
|
|
2612
2912
|
if (sourceFile?.fileName && !fileName.endsWith(".map")) {
|
|
2613
|
-
if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.
|
|
2913
|
+
if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.metadata[file]?.id && context.fs.metadata[file]?.id === sourceFile.fileName)) {
|
|
2614
2914
|
builtinModules += `
|
|
2615
2915
|
declare module "${context.fs.resolve(sourceFile.fileName)}" {
|
|
2616
2916
|
${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
@@ -2759,7 +3059,7 @@ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfi
|
|
|
2759
3059
|
if (!tsconfigJson) {
|
|
2760
3060
|
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths.joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
2761
3061
|
}
|
|
2762
|
-
const parsedCommandLine = ts2__default.default.parseJsonConfigFileContent(
|
|
3062
|
+
const parsedCommandLine = ts2__default.default.parseJsonConfigFileContent(defu2__default.default(tsconfigRaw ?? {}, tsconfigJson), host, append.appendPath(projectRoot, workspaceRoot));
|
|
2763
3063
|
if (parsedCommandLine.errors.length > 0) {
|
|
2764
3064
|
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
2765
3065
|
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
@@ -3051,11 +3351,14 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
|
|
|
3051
3351
|
await resolveTsconfig(context);
|
|
3052
3352
|
await installDependencies(context);
|
|
3053
3353
|
await this.callPostHook(context, "configResolved");
|
|
3354
|
+
if (context.config.build.polyfill) {
|
|
3355
|
+
context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
|
|
3356
|
+
}
|
|
3054
3357
|
context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
|
|
3055
3358
|
|
|
3056
3359
|
${console.formatLogMessage(context.config)}`);
|
|
3057
|
-
context.fs[
|
|
3058
|
-
await
|
|
3360
|
+
context.fs[__VFS_PATCH__]();
|
|
3361
|
+
await chunkLTCZN4I4_js.writeMetaFile(context);
|
|
3059
3362
|
context.persistedMeta = context.meta;
|
|
3060
3363
|
if (!exists.existsSync(context.cachePath)) {
|
|
3061
3364
|
await helpers.createDirectory(context.cachePath);
|
|
@@ -3114,7 +3417,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3114
3417
|
joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
|
|
3115
3418
|
]);
|
|
3116
3419
|
context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3117
|
-
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath,
|
|
3420
|
+
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu2__default.default({
|
|
3118
3421
|
compilerOptions: {
|
|
3119
3422
|
strict: false,
|
|
3120
3423
|
noEmit: false,
|
|
@@ -3185,8 +3488,8 @@ ${formatTypes(generatedTypes)}
|
|
|
3185
3488
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
3186
3489
|
}
|
|
3187
3490
|
await this.callPostHook(context, "prepare");
|
|
3188
|
-
await
|
|
3189
|
-
context.fs[
|
|
3491
|
+
await chunkLTCZN4I4_js.writeMetaFile(context);
|
|
3492
|
+
context.fs[__VFS_REVERT__]();
|
|
3190
3493
|
});
|
|
3191
3494
|
this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
|
|
3192
3495
|
}
|
|
@@ -3316,22 +3619,22 @@ ${formatTypes(generatedTypes)}
|
|
|
3316
3619
|
this.#context.log(types.LogLevelLabel.TRACE, "Powerlines documentation generation completed");
|
|
3317
3620
|
}
|
|
3318
3621
|
/**
|
|
3319
|
-
*
|
|
3622
|
+
* Deploy the project source code
|
|
3320
3623
|
*
|
|
3321
3624
|
* @remarks
|
|
3322
|
-
* This method will prepare and build the Powerlines project, generating the necessary artifacts for
|
|
3625
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
3323
3626
|
*
|
|
3324
|
-
* @param inlineConfig - The inline configuration for the
|
|
3627
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
3325
3628
|
*/
|
|
3326
|
-
async
|
|
3327
|
-
command: "
|
|
3629
|
+
async deploy(inlineConfig = {
|
|
3630
|
+
command: "deploy"
|
|
3328
3631
|
}) {
|
|
3329
|
-
this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6}
|
|
3632
|
+
this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Deploying the Powerlines project");
|
|
3330
3633
|
await this.prepare(inlineConfig);
|
|
3331
3634
|
await this.#executeEnvironments(async (context) => {
|
|
3332
|
-
await this.callHook(context, "
|
|
3635
|
+
await this.callHook(context, "deploy");
|
|
3333
3636
|
});
|
|
3334
|
-
this.context.log(types.LogLevelLabel.TRACE, "Powerlines
|
|
3637
|
+
this.context.log(types.LogLevelLabel.TRACE, "Powerlines deploy completed");
|
|
3335
3638
|
}
|
|
3336
3639
|
/**
|
|
3337
3640
|
* Finalization process
|
|
@@ -3345,7 +3648,8 @@ ${formatTypes(generatedTypes)}
|
|
|
3345
3648
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
|
|
3346
3649
|
await this.#executeEnvironments(async (context) => {
|
|
3347
3650
|
await this.callHook(context, "finalize");
|
|
3348
|
-
context.fs[
|
|
3651
|
+
context.fs[__VFS_REVERT__]();
|
|
3652
|
+
await context.fs.dispose();
|
|
3349
3653
|
});
|
|
3350
3654
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
|
|
3351
3655
|
}
|
|
@@ -3654,14 +3958,21 @@ export { ${key} };`;
|
|
|
3654
3958
|
return "";
|
|
3655
3959
|
}).join("\n"));
|
|
3656
3960
|
}
|
|
3657
|
-
return
|
|
3961
|
+
return defu2__default.default({
|
|
3658
3962
|
alias: context.builtins.reduce((ret, id) => {
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3963
|
+
if (!ret[id]) {
|
|
3964
|
+
const path = context.fs.ids[id];
|
|
3965
|
+
if (path) {
|
|
3966
|
+
ret[id] = path;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
return ret;
|
|
3970
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias.reduce((ret, alias) => {
|
|
3971
|
+
if (!ret[alias.find.toString()]) {
|
|
3972
|
+
ret[alias.find.toString()] = alias.replacement;
|
|
3662
3973
|
}
|
|
3663
3974
|
return ret;
|
|
3664
|
-
},
|
|
3975
|
+
}, {}) : context.config.build.alias : {}),
|
|
3665
3976
|
inject: inject && Object.keys(inject).length > 0 ? [
|
|
3666
3977
|
joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.artifactsPath, "inject-shim.js")
|
|
3667
3978
|
] : void 0
|
|
@@ -3719,15 +4030,28 @@ var DEFAULT_VITE_CONFIG = {
|
|
|
3719
4030
|
clearScreen: true
|
|
3720
4031
|
};
|
|
3721
4032
|
function extractViteConfig(context) {
|
|
3722
|
-
return
|
|
4033
|
+
return defu2__default.default({
|
|
3723
4034
|
resolve: {
|
|
3724
4035
|
alias: context.builtins.reduce((ret, id) => {
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
4036
|
+
if (!ret.find((e) => e.find === id)) {
|
|
4037
|
+
const path = context.fs.ids[id];
|
|
4038
|
+
if (path) {
|
|
4039
|
+
ret.push({
|
|
4040
|
+
find: id,
|
|
4041
|
+
replacement: path
|
|
4042
|
+
});
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
return ret;
|
|
4046
|
+
}, context.config.build.alias ? Array.isArray(context.config.build.alias) ? context.config.build.alias : Object.entries(context.config.build.alias).reduce((ret, [id, path]) => {
|
|
4047
|
+
if (!ret.find((e) => e.find === id)) {
|
|
4048
|
+
ret.push({
|
|
4049
|
+
find: id,
|
|
4050
|
+
replacement: path
|
|
4051
|
+
});
|
|
3728
4052
|
}
|
|
3729
4053
|
return ret;
|
|
3730
|
-
},
|
|
4054
|
+
}, []) : []),
|
|
3731
4055
|
dedupe: context.config.build.dedupe,
|
|
3732
4056
|
mainFields: context.config.build.mainFields,
|
|
3733
4057
|
conditions: context.config.build.conditions,
|
|
@@ -3789,9 +4113,23 @@ async function handleResolveId(context, args, options = {}) {
|
|
|
3789
4113
|
};
|
|
3790
4114
|
}
|
|
3791
4115
|
}
|
|
3792
|
-
if (context.
|
|
3793
|
-
|
|
3794
|
-
|
|
4116
|
+
if (!!context.tsconfig.options.paths && Object.keys(context.tsconfig.options.paths).some((path) => args.id.startsWith(path.replaceAll("*", "")))) {
|
|
4117
|
+
let tsconfigPath = false;
|
|
4118
|
+
if (context.tsconfig.options.paths) {
|
|
4119
|
+
for (const tsconfigPathKey of Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")))) {
|
|
4120
|
+
const resolvedPath = context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath2) => context.fs.resolve(join.joinPaths(context.workspaceConfig.workspaceRoot, tsconfigPath2.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || context.fs.formatPath(tsconfigPath2) === context.fs.formatPath(args.id));
|
|
4121
|
+
if (resolvedPath) {
|
|
4122
|
+
tsconfigPath = context.fs.formatPath(resolvedPath) === context.fs.formatPath(args.id) ? context.fs.formatPath(resolvedPath) : context.fs.resolve(join.joinPaths(context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), args.id.replace(tsconfigPathKey.replaceAll("*", ""), "")));
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
let tsconfigPathPackage = false;
|
|
4127
|
+
if (context.tsconfig.options.paths) {
|
|
4128
|
+
const tsconfigPathKeys = Object.keys(context.tsconfig.options.paths).filter((tsconfigPath2) => args.id.startsWith(tsconfigPath2.replaceAll("*", "")));
|
|
4129
|
+
if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
|
|
4130
|
+
tsconfigPathPackage = tsconfigPathKeys[0].replace(/\/\*$/, "");
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
3795
4133
|
if (tsconfigPath && tsconfigPathPackage) {
|
|
3796
4134
|
return {
|
|
3797
4135
|
id: tsconfigPath,
|
|
@@ -3824,7 +4162,7 @@ async function handleResolveId(context, args, options = {}) {
|
|
|
3824
4162
|
args.importer
|
|
3825
4163
|
] : []
|
|
3826
4164
|
});
|
|
3827
|
-
if (bundleRequire.match(args.id, options.noExternal) || resolvedPath && context.fs.
|
|
4165
|
+
if (bundleRequire.match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.variant === "builtin") {
|
|
3828
4166
|
return void 0;
|
|
3829
4167
|
}
|
|
3830
4168
|
if (bundleRequire.match(args.id, options.external) || args.id.startsWith("node:")) {
|
|
@@ -3973,7 +4311,7 @@ var vite = unplugin.createVitePlugin(createUnpluginFactory("vite", (api, plugin)
|
|
|
3973
4311
|
api.context.config.mode = environmentChecks.isDevelopmentMode(env.mode) ? "development" : environmentChecks.isTestMode(env.mode) ? "test" : "production";
|
|
3974
4312
|
const environment = await api.context.getEnvironment();
|
|
3975
4313
|
const result = await api.callHook(environment, "config");
|
|
3976
|
-
return
|
|
4314
|
+
return defu2__default.default(
|
|
3977
4315
|
extractViteConfig(api.context),
|
|
3978
4316
|
// Need to use `any` here to avoid excessive type complexity
|
|
3979
4317
|
result?.build ?? {},
|
|
@@ -4041,228 +4379,6 @@ unplugin.createRolldownPlugin(createUnpluginFactory("rolldown"));
|
|
|
4041
4379
|
unplugin.createRollupPlugin(createUnpluginFactory("rollup"));
|
|
4042
4380
|
unplugin.createRspackPlugin(createUnpluginFactory("rspack"));
|
|
4043
4381
|
unplugin.createUnloaderPlugin(createUnpluginFactory("unloader"));
|
|
4044
|
-
BigInt("0xa56c61324b9d6e49");
|
|
4045
|
-
var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
4046
|
-
static {
|
|
4047
|
-
chunkSHUYVCID_js.__name(this, "FileMetadata_KeyValuePair");
|
|
4048
|
-
}
|
|
4049
|
-
static _capnp = {
|
|
4050
|
-
displayName: "KeyValuePair",
|
|
4051
|
-
id: "eabb26cf58b2a14c",
|
|
4052
|
-
size: new $__namespace.ObjectSize(0, 2)
|
|
4053
|
-
};
|
|
4054
|
-
get key() {
|
|
4055
|
-
return $__namespace.utils.getText(0, this);
|
|
4056
|
-
}
|
|
4057
|
-
set key(value) {
|
|
4058
|
-
$__namespace.utils.setText(0, value, this);
|
|
4059
|
-
}
|
|
4060
|
-
get value() {
|
|
4061
|
-
return $__namespace.utils.getText(1, this);
|
|
4062
|
-
}
|
|
4063
|
-
set value(value) {
|
|
4064
|
-
$__namespace.utils.setText(1, value, this);
|
|
4065
|
-
}
|
|
4066
|
-
toString() {
|
|
4067
|
-
return "FileMetadata_KeyValuePair_" + super.toString();
|
|
4068
|
-
}
|
|
4069
|
-
};
|
|
4070
|
-
var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
4071
|
-
static {
|
|
4072
|
-
chunkSHUYVCID_js.__name(this, "FileMetadata");
|
|
4073
|
-
}
|
|
4074
|
-
static KeyValuePair = FileMetadata_KeyValuePair;
|
|
4075
|
-
static _capnp = {
|
|
4076
|
-
displayName: "FileMetadata",
|
|
4077
|
-
id: "8e2cab5d7e28c7b3",
|
|
4078
|
-
size: new $__namespace.ObjectSize(0, 4),
|
|
4079
|
-
defaultVariant: "normal"
|
|
4080
|
-
};
|
|
4081
|
-
static _Properties;
|
|
4082
|
-
/**
|
|
4083
|
-
* The variant of the file.
|
|
4084
|
-
*
|
|
4085
|
-
*/
|
|
4086
|
-
get id() {
|
|
4087
|
-
return $__namespace.utils.getText(0, this);
|
|
4088
|
-
}
|
|
4089
|
-
set id(value) {
|
|
4090
|
-
$__namespace.utils.setText(0, value, this);
|
|
4091
|
-
}
|
|
4092
|
-
/**
|
|
4093
|
-
* The output mode of the file.
|
|
4094
|
-
*
|
|
4095
|
-
*/
|
|
4096
|
-
get variant() {
|
|
4097
|
-
return $__namespace.utils.getText(1, this, _FileMetadata._capnp.defaultVariant);
|
|
4098
|
-
}
|
|
4099
|
-
set variant(value) {
|
|
4100
|
-
$__namespace.utils.setText(1, value, this);
|
|
4101
|
-
}
|
|
4102
|
-
/**
|
|
4103
|
-
* Additional metadata associated with the file.
|
|
4104
|
-
*
|
|
4105
|
-
*/
|
|
4106
|
-
get mode() {
|
|
4107
|
-
return $__namespace.utils.getText(2, this);
|
|
4108
|
-
}
|
|
4109
|
-
set mode(value) {
|
|
4110
|
-
$__namespace.utils.setText(2, value, this);
|
|
4111
|
-
}
|
|
4112
|
-
_adoptProperties(value) {
|
|
4113
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
|
|
4114
|
-
}
|
|
4115
|
-
_disownProperties() {
|
|
4116
|
-
return $__namespace.utils.disown(this.properties);
|
|
4117
|
-
}
|
|
4118
|
-
get properties() {
|
|
4119
|
-
return $__namespace.utils.getList(3, _FileMetadata._Properties, this);
|
|
4120
|
-
}
|
|
4121
|
-
_hasProperties() {
|
|
4122
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
|
|
4123
|
-
}
|
|
4124
|
-
_initProperties(length) {
|
|
4125
|
-
return $__namespace.utils.initList(3, _FileMetadata._Properties, length, this);
|
|
4126
|
-
}
|
|
4127
|
-
set properties(value) {
|
|
4128
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
|
|
4129
|
-
}
|
|
4130
|
-
toString() {
|
|
4131
|
-
return "FileMetadata_" + super.toString();
|
|
4132
|
-
}
|
|
4133
|
-
};
|
|
4134
|
-
var FileIdentifier = class extends $__namespace.Struct {
|
|
4135
|
-
static {
|
|
4136
|
-
chunkSHUYVCID_js.__name(this, "FileIdentifier");
|
|
4137
|
-
}
|
|
4138
|
-
static _capnp = {
|
|
4139
|
-
displayName: "FileIdentifier",
|
|
4140
|
-
id: "e12b8732389d7406",
|
|
4141
|
-
size: new $__namespace.ObjectSize(0, 2)
|
|
4142
|
-
};
|
|
4143
|
-
/**
|
|
4144
|
-
* An additional identifier for the file.
|
|
4145
|
-
*
|
|
4146
|
-
*/
|
|
4147
|
-
get path() {
|
|
4148
|
-
return $__namespace.utils.getText(0, this);
|
|
4149
|
-
}
|
|
4150
|
-
set path(value) {
|
|
4151
|
-
$__namespace.utils.setText(0, value, this);
|
|
4152
|
-
}
|
|
4153
|
-
get id() {
|
|
4154
|
-
return $__namespace.utils.getText(1, this);
|
|
4155
|
-
}
|
|
4156
|
-
set id(value) {
|
|
4157
|
-
$__namespace.utils.setText(1, value, this);
|
|
4158
|
-
}
|
|
4159
|
-
toString() {
|
|
4160
|
-
return "FileIdentifier_" + super.toString();
|
|
4161
|
-
}
|
|
4162
|
-
};
|
|
4163
|
-
var FileData = class extends $__namespace.Struct {
|
|
4164
|
-
static {
|
|
4165
|
-
chunkSHUYVCID_js.__name(this, "FileData");
|
|
4166
|
-
}
|
|
4167
|
-
static _capnp = {
|
|
4168
|
-
displayName: "FileData",
|
|
4169
|
-
id: "fa6725c8a360f9a2",
|
|
4170
|
-
size: new $__namespace.ObjectSize(0, 2)
|
|
4171
|
-
};
|
|
4172
|
-
/**
|
|
4173
|
-
* The contents of the file.
|
|
4174
|
-
*
|
|
4175
|
-
*/
|
|
4176
|
-
get path() {
|
|
4177
|
-
return $__namespace.utils.getText(0, this);
|
|
4178
|
-
}
|
|
4179
|
-
set path(value) {
|
|
4180
|
-
$__namespace.utils.setText(0, value, this);
|
|
4181
|
-
}
|
|
4182
|
-
get content() {
|
|
4183
|
-
return $__namespace.utils.getText(1, this);
|
|
4184
|
-
}
|
|
4185
|
-
set content(value) {
|
|
4186
|
-
$__namespace.utils.setText(1, value, this);
|
|
4187
|
-
}
|
|
4188
|
-
toString() {
|
|
4189
|
-
return "FileData_" + super.toString();
|
|
4190
|
-
}
|
|
4191
|
-
};
|
|
4192
|
-
var FileSystemData = class _FileSystemData extends $__namespace.Struct {
|
|
4193
|
-
static {
|
|
4194
|
-
chunkSHUYVCID_js.__name(this, "FileSystemData");
|
|
4195
|
-
}
|
|
4196
|
-
static _capnp = {
|
|
4197
|
-
displayName: "FileSystemData",
|
|
4198
|
-
id: "aaa72a672ac0732f",
|
|
4199
|
-
size: new $__namespace.ObjectSize(0, 3)
|
|
4200
|
-
};
|
|
4201
|
-
static _Ids;
|
|
4202
|
-
static _Metadata;
|
|
4203
|
-
static _Files;
|
|
4204
|
-
_adoptIds(value) {
|
|
4205
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
|
|
4206
|
-
}
|
|
4207
|
-
_disownIds() {
|
|
4208
|
-
return $__namespace.utils.disown(this.ids);
|
|
4209
|
-
}
|
|
4210
|
-
get ids() {
|
|
4211
|
-
return $__namespace.utils.getList(0, _FileSystemData._Ids, this);
|
|
4212
|
-
}
|
|
4213
|
-
_hasIds() {
|
|
4214
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(0, this));
|
|
4215
|
-
}
|
|
4216
|
-
_initIds(length) {
|
|
4217
|
-
return $__namespace.utils.initList(0, _FileSystemData._Ids, length, this);
|
|
4218
|
-
}
|
|
4219
|
-
set ids(value) {
|
|
4220
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
|
|
4221
|
-
}
|
|
4222
|
-
_adoptMetadata(value) {
|
|
4223
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
|
|
4224
|
-
}
|
|
4225
|
-
_disownMetadata() {
|
|
4226
|
-
return $__namespace.utils.disown(this.metadata);
|
|
4227
|
-
}
|
|
4228
|
-
get metadata() {
|
|
4229
|
-
return $__namespace.utils.getList(1, _FileSystemData._Metadata, this);
|
|
4230
|
-
}
|
|
4231
|
-
_hasMetadata() {
|
|
4232
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
|
|
4233
|
-
}
|
|
4234
|
-
_initMetadata(length) {
|
|
4235
|
-
return $__namespace.utils.initList(1, _FileSystemData._Metadata, length, this);
|
|
4236
|
-
}
|
|
4237
|
-
set metadata(value) {
|
|
4238
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
|
|
4239
|
-
}
|
|
4240
|
-
_adoptFiles(value) {
|
|
4241
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
4242
|
-
}
|
|
4243
|
-
_disownFiles() {
|
|
4244
|
-
return $__namespace.utils.disown(this.files);
|
|
4245
|
-
}
|
|
4246
|
-
get files() {
|
|
4247
|
-
return $__namespace.utils.getList(2, _FileSystemData._Files, this);
|
|
4248
|
-
}
|
|
4249
|
-
_hasFiles() {
|
|
4250
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
4251
|
-
}
|
|
4252
|
-
_initFiles(length) {
|
|
4253
|
-
return $__namespace.utils.initList(2, _FileSystemData._Files, length, this);
|
|
4254
|
-
}
|
|
4255
|
-
set files(value) {
|
|
4256
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
4257
|
-
}
|
|
4258
|
-
toString() {
|
|
4259
|
-
return "FileSystemData_" + super.toString();
|
|
4260
|
-
}
|
|
4261
|
-
};
|
|
4262
|
-
FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
|
|
4263
|
-
FileSystemData._Ids = $__namespace.CompositeList(FileIdentifier);
|
|
4264
|
-
FileSystemData._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
4265
|
-
FileSystemData._Files = $__namespace.CompositeList(FileData);
|
|
4266
4382
|
|
|
4267
4383
|
// ../powerlines/src/index.ts
|
|
4268
4384
|
var src_default = PowerlinesAPI;
|
|
@@ -4277,7 +4393,7 @@ function withExecutor(command, executorFn) {
|
|
|
4277
4393
|
throw new Error("The executor requires `projectsConfigurations` on the context object.");
|
|
4278
4394
|
}
|
|
4279
4395
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
4280
|
-
const api = await src_default.from(workspaceConfig.workspaceRoot,
|
|
4396
|
+
const api = await src_default.from(workspaceConfig.workspaceRoot, defu2__default.default({
|
|
4281
4397
|
root: projectConfig.root,
|
|
4282
4398
|
type: projectConfig.projectType,
|
|
4283
4399
|
sourceRoot: projectConfig.sourceRoot,
|
|
@@ -4290,7 +4406,7 @@ function withExecutor(command, executorFn) {
|
|
|
4290
4406
|
}
|
|
4291
4407
|
}, options));
|
|
4292
4408
|
try {
|
|
4293
|
-
return await Promise.resolve(executorFn(
|
|
4409
|
+
return await Promise.resolve(executorFn(defu2__default.default({
|
|
4294
4410
|
projectName: context.projectName,
|
|
4295
4411
|
options,
|
|
4296
4412
|
workspaceConfig,
|