qumra-cli 2.3.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +5 -1
- package/dist/cli.js +446 -169
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ var require$$17 = require('@nestjs/microservices');
|
|
|
16
16
|
var require$$20 = require('@nestjs/platform-express');
|
|
17
17
|
var require$$8 = require('repl');
|
|
18
18
|
var fs$j = require('fs/promises');
|
|
19
|
-
var
|
|
19
|
+
var path$d = require('path');
|
|
20
20
|
var fs$i = require('fs');
|
|
21
21
|
var require$$1$6 = require('module');
|
|
22
22
|
var require$$2$7 = require('events');
|
|
@@ -103,9 +103,10 @@ function _mergeNamespaces(n, m) {
|
|
|
103
103
|
return Object.freeze(n);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
var require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0$c);
|
|
106
|
+
var require$$0__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(require$$0$c);
|
|
107
|
+
var require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0$d);
|
|
107
108
|
var fs__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(fs$j);
|
|
108
|
-
var
|
|
109
|
+
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$d);
|
|
109
110
|
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs$i);
|
|
110
111
|
var blessed__namespace = /*#__PURE__*/_interopNamespaceDefault(blessed);
|
|
111
112
|
var net__namespace = /*#__PURE__*/_interopNamespaceDefault(net$4);
|
|
@@ -42300,7 +42301,7 @@ var __importDefault$5 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
42300
42301
|
};
|
|
42301
42302
|
Object.defineProperty(ExplorerBase$1, "__esModule", { value: true });
|
|
42302
42303
|
ExplorerBase$1.getExtensionDescription = ExplorerBase$1.ExplorerBase = void 0;
|
|
42303
|
-
const path_1$2 = __importDefault$5(
|
|
42304
|
+
const path_1$2 = __importDefault$5(path$d);
|
|
42304
42305
|
const util_js_1$2 = util$P;
|
|
42305
42306
|
/**
|
|
42306
42307
|
* @internal
|
|
@@ -42385,7 +42386,7 @@ var hasRequiredResolveFrom;
|
|
|
42385
42386
|
function requireResolveFrom () {
|
|
42386
42387
|
if (hasRequiredResolveFrom) return resolveFrom.exports;
|
|
42387
42388
|
hasRequiredResolveFrom = 1;
|
|
42388
|
-
const path =
|
|
42389
|
+
const path = path$d;
|
|
42389
42390
|
const Module = require$$1$6;
|
|
42390
42391
|
const fs = fs$i;
|
|
42391
42392
|
|
|
@@ -42507,7 +42508,7 @@ var hasRequiredImportFresh;
|
|
|
42507
42508
|
function requireImportFresh () {
|
|
42508
42509
|
if (hasRequiredImportFresh) return importFresh;
|
|
42509
42510
|
hasRequiredImportFresh = 1;
|
|
42510
|
-
const path =
|
|
42511
|
+
const path = path$d;
|
|
42511
42512
|
const resolveFrom = requireResolveFrom();
|
|
42512
42513
|
const parentModule = requireParentModule();
|
|
42513
42514
|
|
|
@@ -50928,7 +50929,7 @@ function requireSourceMapSupport () {
|
|
|
50928
50929
|
hasRequiredSourceMapSupport = 1;
|
|
50929
50930
|
(function (module, exports$1) {
|
|
50930
50931
|
var SourceMapConsumer = requireSourceMap().SourceMapConsumer;
|
|
50931
|
-
var path =
|
|
50932
|
+
var path = path$d;
|
|
50932
50933
|
|
|
50933
50934
|
var fs;
|
|
50934
50935
|
try {
|
|
@@ -59808,7 +59809,7 @@ ${lanes.join("\n")}
|
|
|
59808
59809
|
function getNodeSystem() {
|
|
59809
59810
|
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
59810
59811
|
const _fs = fs$i;
|
|
59811
|
-
const _path =
|
|
59812
|
+
const _path = path$d;
|
|
59812
59813
|
const _os = require$$5$5;
|
|
59813
59814
|
let _crypto;
|
|
59814
59815
|
try {
|
|
@@ -248272,7 +248273,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
248272
248273
|
exports$1.loadTs = exports$1.loadTsSync = exports$1.loadYaml = exports$1.loadJson = exports$1.loadJs = exports$1.loadJsSync = void 0;
|
|
248273
248274
|
const fs_1 = fs$i;
|
|
248274
248275
|
const promises_1 = fs$j;
|
|
248275
|
-
const path_1 = __importDefault(
|
|
248276
|
+
const path_1 = __importDefault(path$d);
|
|
248276
248277
|
const url_1 = require$$0$c;
|
|
248277
248278
|
let importFresh;
|
|
248278
248279
|
const loadJsSync = function loadJsSync(filepath) {
|
|
@@ -248404,7 +248405,7 @@ var __importDefault$4 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
248404
248405
|
Object.defineProperty(Explorer$1, "__esModule", { value: true });
|
|
248405
248406
|
Explorer$1.Explorer = void 0;
|
|
248406
248407
|
const promises_1$1 = __importDefault$4(fs$j);
|
|
248407
|
-
const path_1$1 = __importDefault$4(
|
|
248408
|
+
const path_1$1 = __importDefault$4(path$d);
|
|
248408
248409
|
const path_type_1$1 = pathType;
|
|
248409
248410
|
const ExplorerBase_js_1$1 = ExplorerBase$1;
|
|
248410
248411
|
const loaders_js_1$1 = loaders$1;
|
|
@@ -248508,7 +248509,7 @@ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
248508
248509
|
Object.defineProperty(ExplorerSync$1, "__esModule", { value: true });
|
|
248509
248510
|
ExplorerSync$1.ExplorerSync = void 0;
|
|
248510
248511
|
const fs_1$3 = __importDefault$3(fs$i);
|
|
248511
|
-
const path_1 = __importDefault$3(
|
|
248512
|
+
const path_1 = __importDefault$3(path$d);
|
|
248512
248513
|
const path_type_1 = pathType;
|
|
248513
248514
|
const ExplorerBase_js_1 = ExplorerBase$1;
|
|
248514
248515
|
const loaders_js_1 = loaders$1;
|
|
@@ -267383,7 +267384,7 @@ suggestSimilar$2.suggestSimilar = suggestSimilar$1;
|
|
|
267383
267384
|
|
|
267384
267385
|
const EventEmitter$7 = require$$2$7.EventEmitter;
|
|
267385
267386
|
const childProcess = require$$1$7;
|
|
267386
|
-
const path$c =
|
|
267387
|
+
const path$c = path$d;
|
|
267387
267388
|
const fs$g = fs$i;
|
|
267388
267389
|
const process$4 = process4;
|
|
267389
267390
|
|
|
@@ -309690,7 +309691,7 @@ const CONFIG_DIR = '.qumra';
|
|
|
309690
309691
|
const CONFIG_FILE = 'qumra.config.json';
|
|
309691
309692
|
let ConfigService = class ConfigService {
|
|
309692
309693
|
getConfigPath(basePath = process.cwd()) {
|
|
309693
|
-
return
|
|
309694
|
+
return path__namespace.join(basePath, CONFIG_DIR, CONFIG_FILE);
|
|
309694
309695
|
}
|
|
309695
309696
|
async load(basePath = process.cwd()) {
|
|
309696
309697
|
const configPath = this.getConfigPath(basePath);
|
|
@@ -309706,7 +309707,7 @@ let ConfigService = class ConfigService {
|
|
|
309706
309707
|
}
|
|
309707
309708
|
}
|
|
309708
309709
|
async save(config, basePath = process.cwd()) {
|
|
309709
|
-
const dirPath =
|
|
309710
|
+
const dirPath = path__namespace.join(basePath, CONFIG_DIR);
|
|
309710
309711
|
const configPath = this.getConfigPath(basePath);
|
|
309711
309712
|
if (!fs__namespace.existsSync(dirPath)) {
|
|
309712
309713
|
fs__namespace.mkdirSync(dirPath, { recursive: true });
|
|
@@ -310283,6 +310284,154 @@ TunnelService = __decorate$5([
|
|
|
310283
310284
|
__metadata$2("design:paramtypes", [LoggerService])
|
|
310284
310285
|
], TunnelService);
|
|
310285
310286
|
|
|
310287
|
+
const HASH_FILE_NAME = 'file-hashes.json';
|
|
310288
|
+
const HASH_ALGORITHM = 'sha256';
|
|
310289
|
+
let FileHashService = class FileHashService {
|
|
310290
|
+
constructor() {
|
|
310291
|
+
this.hashStore = {};
|
|
310292
|
+
this.hashFilePath = '';
|
|
310293
|
+
this.initialized = false;
|
|
310294
|
+
}
|
|
310295
|
+
async init(basePath = process.cwd()) {
|
|
310296
|
+
this.hashFilePath = path__namespace.join(basePath, '.qumra', HASH_FILE_NAME);
|
|
310297
|
+
await this.loadHashes();
|
|
310298
|
+
this.initialized = true;
|
|
310299
|
+
}
|
|
310300
|
+
async loadHashes() {
|
|
310301
|
+
try {
|
|
310302
|
+
if (fs__namespace.existsSync(this.hashFilePath)) {
|
|
310303
|
+
const content = fs__namespace.readFileSync(this.hashFilePath, 'utf-8');
|
|
310304
|
+
this.hashStore = JSON.parse(content);
|
|
310305
|
+
}
|
|
310306
|
+
}
|
|
310307
|
+
catch {
|
|
310308
|
+
this.hashStore = {};
|
|
310309
|
+
}
|
|
310310
|
+
}
|
|
310311
|
+
async saveHashes() {
|
|
310312
|
+
const dir = path__namespace.dirname(this.hashFilePath);
|
|
310313
|
+
if (!fs__namespace.existsSync(dir)) {
|
|
310314
|
+
fs__namespace.mkdirSync(dir, { recursive: true });
|
|
310315
|
+
}
|
|
310316
|
+
fs__namespace.writeFileSync(this.hashFilePath, JSON.stringify(this.hashStore, null, 2));
|
|
310317
|
+
}
|
|
310318
|
+
async computeHash(filePath) {
|
|
310319
|
+
return new Promise((resolve, reject) => {
|
|
310320
|
+
const hash = require$$0__namespace.createHash(HASH_ALGORITHM);
|
|
310321
|
+
const stream = fs__namespace.createReadStream(filePath);
|
|
310322
|
+
stream.on('data', (data) => hash.update(data));
|
|
310323
|
+
stream.on('end', () => resolve(hash.digest('hex')));
|
|
310324
|
+
stream.on('error', reject);
|
|
310325
|
+
});
|
|
310326
|
+
}
|
|
310327
|
+
async hasChanged(filePath) {
|
|
310328
|
+
if (!this.initialized) {
|
|
310329
|
+
await this.init();
|
|
310330
|
+
}
|
|
310331
|
+
const relativePath = this.getRelativePath(filePath);
|
|
310332
|
+
if (!fs__namespace.existsSync(filePath)) {
|
|
310333
|
+
return this.hashStore[relativePath] !== undefined;
|
|
310334
|
+
}
|
|
310335
|
+
const currentHash = await this.computeHash(filePath);
|
|
310336
|
+
const storedEntry = this.hashStore[relativePath];
|
|
310337
|
+
if (!storedEntry) {
|
|
310338
|
+
return true;
|
|
310339
|
+
}
|
|
310340
|
+
return storedEntry.hash !== currentHash;
|
|
310341
|
+
}
|
|
310342
|
+
async updateHash(filePath) {
|
|
310343
|
+
if (!this.initialized) {
|
|
310344
|
+
await this.init();
|
|
310345
|
+
}
|
|
310346
|
+
const relativePath = this.getRelativePath(filePath);
|
|
310347
|
+
if (!fs__namespace.existsSync(filePath)) {
|
|
310348
|
+
delete this.hashStore[relativePath];
|
|
310349
|
+
await this.saveHashes();
|
|
310350
|
+
return;
|
|
310351
|
+
}
|
|
310352
|
+
const hash = await this.computeHash(filePath);
|
|
310353
|
+
const stat = fs__namespace.statSync(filePath);
|
|
310354
|
+
this.hashStore[relativePath] = {
|
|
310355
|
+
hash,
|
|
310356
|
+
lastSynced: new Date().toISOString(),
|
|
310357
|
+
size: stat.size,
|
|
310358
|
+
};
|
|
310359
|
+
await this.saveHashes();
|
|
310360
|
+
}
|
|
310361
|
+
async removeHash(filePath) {
|
|
310362
|
+
if (!this.initialized) {
|
|
310363
|
+
await this.init();
|
|
310364
|
+
}
|
|
310365
|
+
const relativePath = this.getRelativePath(filePath);
|
|
310366
|
+
delete this.hashStore[relativePath];
|
|
310367
|
+
await this.saveHashes();
|
|
310368
|
+
}
|
|
310369
|
+
async getChangedFiles(basePath = process.cwd()) {
|
|
310370
|
+
if (!this.initialized) {
|
|
310371
|
+
await this.init(basePath);
|
|
310372
|
+
}
|
|
310373
|
+
const changedFiles = [];
|
|
310374
|
+
const folders = Object.keys(THEME_FOLDERS);
|
|
310375
|
+
for (const folder of folders) {
|
|
310376
|
+
const folderPath = path__namespace.join(basePath, folder);
|
|
310377
|
+
if (!fs__namespace.existsSync(folderPath))
|
|
310378
|
+
continue;
|
|
310379
|
+
const files = this.getAllFiles(folderPath);
|
|
310380
|
+
const allowedExtensions = THEME_FOLDERS[folder];
|
|
310381
|
+
for (const file of files) {
|
|
310382
|
+
const ext = path__namespace.extname(file).toLowerCase();
|
|
310383
|
+
if (![...allowedExtensions].includes(ext))
|
|
310384
|
+
continue;
|
|
310385
|
+
const hasChanged = await this.hasChanged(file);
|
|
310386
|
+
if (hasChanged) {
|
|
310387
|
+
changedFiles.push(file);
|
|
310388
|
+
}
|
|
310389
|
+
}
|
|
310390
|
+
}
|
|
310391
|
+
return changedFiles;
|
|
310392
|
+
}
|
|
310393
|
+
async getDeletedFiles(basePath = process.cwd()) {
|
|
310394
|
+
if (!this.initialized) {
|
|
310395
|
+
await this.init(basePath);
|
|
310396
|
+
}
|
|
310397
|
+
const deletedFiles = [];
|
|
310398
|
+
for (const relativePath of Object.keys(this.hashStore)) {
|
|
310399
|
+
const fullPath = path__namespace.join(basePath, relativePath);
|
|
310400
|
+
if (!fs__namespace.existsSync(fullPath)) {
|
|
310401
|
+
deletedFiles.push(relativePath);
|
|
310402
|
+
}
|
|
310403
|
+
}
|
|
310404
|
+
return deletedFiles;
|
|
310405
|
+
}
|
|
310406
|
+
getStoredHash(filePath) {
|
|
310407
|
+
const relativePath = this.getRelativePath(filePath);
|
|
310408
|
+
return this.hashStore[relativePath] || null;
|
|
310409
|
+
}
|
|
310410
|
+
getRelativePath(filePath) {
|
|
310411
|
+
if (path__namespace.isAbsolute(filePath)) {
|
|
310412
|
+
return path__namespace.relative(process.cwd(), filePath);
|
|
310413
|
+
}
|
|
310414
|
+
return filePath;
|
|
310415
|
+
}
|
|
310416
|
+
getAllFiles(dirPath) {
|
|
310417
|
+
const files = [];
|
|
310418
|
+
const items = fs__namespace.readdirSync(dirPath, { withFileTypes: true });
|
|
310419
|
+
for (const item of items) {
|
|
310420
|
+
const fullPath = path__namespace.join(dirPath, item.name);
|
|
310421
|
+
if (item.isDirectory()) {
|
|
310422
|
+
files.push(...this.getAllFiles(fullPath));
|
|
310423
|
+
}
|
|
310424
|
+
else if (item.isFile()) {
|
|
310425
|
+
files.push(fullPath);
|
|
310426
|
+
}
|
|
310427
|
+
}
|
|
310428
|
+
return files;
|
|
310429
|
+
}
|
|
310430
|
+
};
|
|
310431
|
+
FileHashService = __decorate$5([
|
|
310432
|
+
commonExports.Injectable()
|
|
310433
|
+
], FileHashService);
|
|
310434
|
+
|
|
310286
310435
|
const providers = [
|
|
310287
310436
|
LoggerService,
|
|
310288
310437
|
StorageService,
|
|
@@ -310291,6 +310440,7 @@ const providers = [
|
|
|
310291
310440
|
GraphqlService,
|
|
310292
310441
|
ConfigService,
|
|
310293
310442
|
TunnelService,
|
|
310443
|
+
FileHashService,
|
|
310294
310444
|
];
|
|
310295
310445
|
let CommonModule = class CommonModule {
|
|
310296
310446
|
};
|
|
@@ -335139,7 +335289,7 @@ var osTmpdir = function () {
|
|
|
335139
335289
|
* Module dependencies.
|
|
335140
335290
|
*/
|
|
335141
335291
|
const fs$d = fs$i;
|
|
335142
|
-
const path$b =
|
|
335292
|
+
const path$b = path$d;
|
|
335143
335293
|
const crypto$2 = require$$0$d;
|
|
335144
335294
|
const osTmpDir = osTmpdir;
|
|
335145
335295
|
const _c$2 = process.binding('constants');
|
|
@@ -338893,7 +339043,7 @@ const binaryExtensions = new Set([
|
|
|
338893
339043
|
'xmind', 'xpi', 'xpm', 'xwd', 'xz',
|
|
338894
339044
|
'z', 'zip', 'zipx',
|
|
338895
339045
|
]);
|
|
338896
|
-
const isBinaryPath = (filePath) => binaryExtensions.has(
|
|
339046
|
+
const isBinaryPath = (filePath) => binaryExtensions.has(path__namespace.extname(filePath).slice(1).toLowerCase());
|
|
338897
339047
|
// TODO: emit errors properly. Example: EMFILE on Macos.
|
|
338898
339048
|
const foreach = (val, fn) => {
|
|
338899
339049
|
if (val instanceof Set) {
|
|
@@ -338946,7 +339096,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
338946
339096
|
// emit based on events occurring for files from a directory's watcher in
|
|
338947
339097
|
// case the file's watcher misses it (and rely on throttling to de-dupe)
|
|
338948
339098
|
if (evPath && path !== evPath) {
|
|
338949
|
-
fsWatchBroadcast(
|
|
339099
|
+
fsWatchBroadcast(path__namespace.resolve(path, evPath), KEY_LISTENERS, path__namespace.join(path, evPath));
|
|
338950
339100
|
}
|
|
338951
339101
|
};
|
|
338952
339102
|
try {
|
|
@@ -339129,11 +339279,11 @@ class NodeFsHandler {
|
|
|
339129
339279
|
*/
|
|
339130
339280
|
_watchWithNodeFs(path, listener) {
|
|
339131
339281
|
const opts = this.fsw.options;
|
|
339132
|
-
const directory =
|
|
339133
|
-
const basename =
|
|
339282
|
+
const directory = path__namespace.dirname(path);
|
|
339283
|
+
const basename = path__namespace.basename(path);
|
|
339134
339284
|
const parent = this.fsw._getWatchedDir(directory);
|
|
339135
339285
|
parent.add(basename);
|
|
339136
|
-
const absolutePath =
|
|
339286
|
+
const absolutePath = path__namespace.resolve(path);
|
|
339137
339287
|
const options = {
|
|
339138
339288
|
persistent: opts.persistent,
|
|
339139
339289
|
};
|
|
@@ -339165,8 +339315,8 @@ class NodeFsHandler {
|
|
|
339165
339315
|
if (this.fsw.closed) {
|
|
339166
339316
|
return;
|
|
339167
339317
|
}
|
|
339168
|
-
const dirname =
|
|
339169
|
-
const basename =
|
|
339318
|
+
const dirname = path__namespace.dirname(file);
|
|
339319
|
+
const basename = path__namespace.basename(file);
|
|
339170
339320
|
const parent = this.fsw._getWatchedDir(dirname);
|
|
339171
339321
|
// stats is always present
|
|
339172
339322
|
let prevStats = stats;
|
|
@@ -339273,7 +339423,7 @@ class NodeFsHandler {
|
|
|
339273
339423
|
}
|
|
339274
339424
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
339275
339425
|
// Normalize the directory name on Windows
|
|
339276
|
-
directory =
|
|
339426
|
+
directory = path__namespace.join(directory, '');
|
|
339277
339427
|
throttler = this.fsw._throttle('readdir', directory, 1000);
|
|
339278
339428
|
if (!throttler)
|
|
339279
339429
|
return;
|
|
@@ -339292,7 +339442,7 @@ class NodeFsHandler {
|
|
|
339292
339442
|
return;
|
|
339293
339443
|
}
|
|
339294
339444
|
const item = entry.path;
|
|
339295
|
-
let path =
|
|
339445
|
+
let path = path__namespace.join(directory, item);
|
|
339296
339446
|
current.add(item);
|
|
339297
339447
|
if (entry.stats.isSymbolicLink() &&
|
|
339298
339448
|
(await this._handleSymlink(entry, directory, path, item))) {
|
|
@@ -339308,7 +339458,7 @@ class NodeFsHandler {
|
|
|
339308
339458
|
if (item === target || (!target && !previous.has(item))) {
|
|
339309
339459
|
this.fsw._incrReadyCount();
|
|
339310
339460
|
// ensure relativeness of path is preserved in case of watcher reuse
|
|
339311
|
-
path =
|
|
339461
|
+
path = path__namespace.join(dir, path__namespace.relative(dir, path));
|
|
339312
339462
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
339313
339463
|
}
|
|
339314
339464
|
})
|
|
@@ -339353,13 +339503,13 @@ class NodeFsHandler {
|
|
|
339353
339503
|
* @returns closer for the watcher instance.
|
|
339354
339504
|
*/
|
|
339355
339505
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
339356
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
339357
|
-
const tracked = parentDir.has(
|
|
339506
|
+
const parentDir = this.fsw._getWatchedDir(path__namespace.dirname(dir));
|
|
339507
|
+
const tracked = parentDir.has(path__namespace.basename(dir));
|
|
339358
339508
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
|
|
339359
339509
|
this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
339360
339510
|
}
|
|
339361
339511
|
// ensure dir is tracked (harmless if redundant)
|
|
339362
|
-
parentDir.add(
|
|
339512
|
+
parentDir.add(path__namespace.basename(dir));
|
|
339363
339513
|
this.fsw._getWatchedDir(dir);
|
|
339364
339514
|
let throttler;
|
|
339365
339515
|
let closer;
|
|
@@ -339411,7 +339561,7 @@ class NodeFsHandler {
|
|
|
339411
339561
|
const follow = this.fsw.options.followSymlinks;
|
|
339412
339562
|
let closer;
|
|
339413
339563
|
if (stats.isDirectory()) {
|
|
339414
|
-
const absPath =
|
|
339564
|
+
const absPath = path__namespace.resolve(path);
|
|
339415
339565
|
const targetPath = follow ? await fs$j.realpath(path) : path;
|
|
339416
339566
|
if (this.fsw.closed)
|
|
339417
339567
|
return;
|
|
@@ -339427,7 +339577,7 @@ class NodeFsHandler {
|
|
|
339427
339577
|
const targetPath = follow ? await fs$j.realpath(path) : path;
|
|
339428
339578
|
if (this.fsw.closed)
|
|
339429
339579
|
return;
|
|
339430
|
-
const parent =
|
|
339580
|
+
const parent = path__namespace.dirname(wh.watchPath);
|
|
339431
339581
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
339432
339582
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
339433
339583
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
|
@@ -339435,7 +339585,7 @@ class NodeFsHandler {
|
|
|
339435
339585
|
return;
|
|
339436
339586
|
// preserve this symlink's target path
|
|
339437
339587
|
if (targetPath !== undefined) {
|
|
339438
|
-
this.fsw._symlinkPaths.set(
|
|
339588
|
+
this.fsw._symlinkPaths.set(path__namespace.resolve(path), targetPath);
|
|
339439
339589
|
}
|
|
339440
339590
|
}
|
|
339441
339591
|
else {
|
|
@@ -339481,11 +339631,11 @@ function createPattern(matcher) {
|
|
|
339481
339631
|
if (matcher.path === string)
|
|
339482
339632
|
return true;
|
|
339483
339633
|
if (matcher.recursive) {
|
|
339484
|
-
const relative =
|
|
339634
|
+
const relative = path__namespace.relative(matcher.path, string);
|
|
339485
339635
|
if (!relative) {
|
|
339486
339636
|
return false;
|
|
339487
339637
|
}
|
|
339488
|
-
return !relative.startsWith('..') && !
|
|
339638
|
+
return !relative.startsWith('..') && !path__namespace.isAbsolute(relative);
|
|
339489
339639
|
}
|
|
339490
339640
|
return false;
|
|
339491
339641
|
};
|
|
@@ -339495,7 +339645,7 @@ function createPattern(matcher) {
|
|
|
339495
339645
|
function normalizePath$3(path) {
|
|
339496
339646
|
if (typeof path !== 'string')
|
|
339497
339647
|
throw new Error('string expected');
|
|
339498
|
-
path =
|
|
339648
|
+
path = path__namespace.normalize(path);
|
|
339499
339649
|
path = path.replace(/\\/g, '/');
|
|
339500
339650
|
let prepend = false;
|
|
339501
339651
|
if (path.startsWith('//'))
|
|
@@ -339555,21 +339705,21 @@ const toUnix = (string) => {
|
|
|
339555
339705
|
};
|
|
339556
339706
|
// Our version of upath.normalize
|
|
339557
339707
|
// TODO: this is not equal to path-normalize module - investigate why
|
|
339558
|
-
const normalizePathToUnix = (path) => toUnix(
|
|
339708
|
+
const normalizePathToUnix = (path) => toUnix(path__namespace.normalize(toUnix(path)));
|
|
339559
339709
|
// TODO: refactor
|
|
339560
339710
|
const normalizeIgnored = (cwd = '') => (path) => {
|
|
339561
339711
|
if (typeof path === 'string') {
|
|
339562
|
-
return normalizePathToUnix(
|
|
339712
|
+
return normalizePathToUnix(path__namespace.isAbsolute(path) ? path : path__namespace.join(cwd, path));
|
|
339563
339713
|
}
|
|
339564
339714
|
else {
|
|
339565
339715
|
return path;
|
|
339566
339716
|
}
|
|
339567
339717
|
};
|
|
339568
339718
|
const getAbsolutePath = (path, cwd) => {
|
|
339569
|
-
if (
|
|
339719
|
+
if (path__namespace.isAbsolute(path)) {
|
|
339570
339720
|
return path;
|
|
339571
339721
|
}
|
|
339572
|
-
return
|
|
339722
|
+
return path__namespace.join(cwd, path);
|
|
339573
339723
|
};
|
|
339574
339724
|
const EMPTY_SET = Object.freeze(new Set());
|
|
339575
339725
|
/**
|
|
@@ -339601,7 +339751,7 @@ class DirEntry {
|
|
|
339601
339751
|
}
|
|
339602
339752
|
catch (err) {
|
|
339603
339753
|
if (this._removeWatcher) {
|
|
339604
|
-
this._removeWatcher(
|
|
339754
|
+
this._removeWatcher(path__namespace.dirname(dir), path__namespace.basename(dir));
|
|
339605
339755
|
}
|
|
339606
339756
|
}
|
|
339607
339757
|
}
|
|
@@ -339633,7 +339783,7 @@ class WatchHelper {
|
|
|
339633
339783
|
const watchPath = path;
|
|
339634
339784
|
this.path = path = path.replace(REPLACER_RE, '');
|
|
339635
339785
|
this.watchPath = watchPath;
|
|
339636
|
-
this.fullWatchPath =
|
|
339786
|
+
this.fullWatchPath = path__namespace.resolve(watchPath);
|
|
339637
339787
|
this.dirParts = [];
|
|
339638
339788
|
this.dirParts.forEach((parts) => {
|
|
339639
339789
|
if (parts.length > 1)
|
|
@@ -339643,7 +339793,7 @@ class WatchHelper {
|
|
|
339643
339793
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
339644
339794
|
}
|
|
339645
339795
|
entryPath(entry) {
|
|
339646
|
-
return
|
|
339796
|
+
return path__namespace.join(this.watchPath, path__namespace.relative(this.watchPath, entry.fullPath));
|
|
339647
339797
|
}
|
|
339648
339798
|
filterPath(entry) {
|
|
339649
339799
|
const { stats } = entry;
|
|
@@ -339799,7 +339949,7 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
339799
339949
|
return;
|
|
339800
339950
|
results.forEach((item) => {
|
|
339801
339951
|
if (item)
|
|
339802
|
-
this.add(
|
|
339952
|
+
this.add(path__namespace.dirname(item), path__namespace.basename(_origAdd || item));
|
|
339803
339953
|
});
|
|
339804
339954
|
});
|
|
339805
339955
|
return this;
|
|
@@ -339814,10 +339964,10 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
339814
339964
|
const { cwd } = this.options;
|
|
339815
339965
|
paths.forEach((path) => {
|
|
339816
339966
|
// convert to absolute path unless relative path already matches
|
|
339817
|
-
if (!
|
|
339967
|
+
if (!path__namespace.isAbsolute(path) && !this._closers.has(path)) {
|
|
339818
339968
|
if (cwd)
|
|
339819
|
-
path =
|
|
339820
|
-
path =
|
|
339969
|
+
path = path__namespace.join(cwd, path);
|
|
339970
|
+
path = path__namespace.resolve(path);
|
|
339821
339971
|
}
|
|
339822
339972
|
this._closePath(path);
|
|
339823
339973
|
this._addIgnoredPath(path);
|
|
@@ -339871,7 +340021,7 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
339871
340021
|
getWatched() {
|
|
339872
340022
|
const watchList = {};
|
|
339873
340023
|
this._watched.forEach((entry, dir) => {
|
|
339874
|
-
const key = this.options.cwd ?
|
|
340024
|
+
const key = this.options.cwd ? path__namespace.relative(this.options.cwd, dir) : dir;
|
|
339875
340025
|
const index = key || ONE_DOT;
|
|
339876
340026
|
watchList[index] = entry.getChildren().sort();
|
|
339877
340027
|
});
|
|
@@ -339897,9 +340047,9 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
339897
340047
|
return;
|
|
339898
340048
|
const opts = this.options;
|
|
339899
340049
|
if (isWindows$1)
|
|
339900
|
-
path =
|
|
340050
|
+
path = path__namespace.normalize(path);
|
|
339901
340051
|
if (opts.cwd)
|
|
339902
|
-
path =
|
|
340052
|
+
path = path__namespace.relative(opts.cwd, path);
|
|
339903
340053
|
const args = [path];
|
|
339904
340054
|
if (stats != null)
|
|
339905
340055
|
args.push(stats);
|
|
@@ -339955,7 +340105,7 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
339955
340105
|
if (opts.alwaysStat &&
|
|
339956
340106
|
stats === undefined &&
|
|
339957
340107
|
(event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
339958
|
-
const fullPath = opts.cwd ?
|
|
340108
|
+
const fullPath = opts.cwd ? path__namespace.join(opts.cwd, path) : path;
|
|
339959
340109
|
let stats;
|
|
339960
340110
|
try {
|
|
339961
340111
|
stats = await fs$j.stat(fullPath);
|
|
@@ -340038,8 +340188,8 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
340038
340188
|
const pollInterval = awf.pollInterval;
|
|
340039
340189
|
let timeoutHandler;
|
|
340040
340190
|
let fullPath = path;
|
|
340041
|
-
if (this.options.cwd && !
|
|
340042
|
-
fullPath =
|
|
340191
|
+
if (this.options.cwd && !path__namespace.isAbsolute(path)) {
|
|
340192
|
+
fullPath = path__namespace.join(this.options.cwd, path);
|
|
340043
340193
|
}
|
|
340044
340194
|
const now = new Date();
|
|
340045
340195
|
const writes = this._pendingWrites;
|
|
@@ -340110,7 +340260,7 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
340110
340260
|
* @param directory path of the directory
|
|
340111
340261
|
*/
|
|
340112
340262
|
_getWatchedDir(directory) {
|
|
340113
|
-
const dir =
|
|
340263
|
+
const dir = path__namespace.resolve(directory);
|
|
340114
340264
|
if (!this._watched.has(dir))
|
|
340115
340265
|
this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
340116
340266
|
return this._watched.get(dir);
|
|
@@ -340136,8 +340286,8 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
340136
340286
|
// if what is being deleted is a directory, get that directory's paths
|
|
340137
340287
|
// for recursive deleting and cleaning of watched object
|
|
340138
340288
|
// if it is not a directory, nestedDirectoryChildren will be empty array
|
|
340139
|
-
const path =
|
|
340140
|
-
const fullPath =
|
|
340289
|
+
const path = path__namespace.join(directory, item);
|
|
340290
|
+
const fullPath = path__namespace.resolve(path);
|
|
340141
340291
|
isDirectory =
|
|
340142
340292
|
isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
|
340143
340293
|
// prevent duplicate handling in case of arriving here nearly simultaneously
|
|
@@ -340169,7 +340319,7 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
340169
340319
|
// If we wait for this file to be fully written, cancel the wait.
|
|
340170
340320
|
let relPath = path;
|
|
340171
340321
|
if (this.options.cwd)
|
|
340172
|
-
relPath =
|
|
340322
|
+
relPath = path__namespace.relative(this.options.cwd, path);
|
|
340173
340323
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
340174
340324
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
340175
340325
|
if (event === EVENTS.ADD)
|
|
@@ -340190,8 +340340,8 @@ class FSWatcher extends require$$2$7.EventEmitter {
|
|
|
340190
340340
|
*/
|
|
340191
340341
|
_closePath(path) {
|
|
340192
340342
|
this._closeFile(path);
|
|
340193
|
-
const dir =
|
|
340194
|
-
this._getWatchedDir(dir).remove(
|
|
340343
|
+
const dir = path__namespace.dirname(path);
|
|
340344
|
+
this._getWatchedDir(dir).remove(path__namespace.basename(path));
|
|
340195
340345
|
}
|
|
340196
340346
|
/**
|
|
340197
340347
|
* Closes only file-specific watchers
|
|
@@ -352142,7 +352292,7 @@ var mimeDb = require$$0$5;
|
|
|
352142
352292
|
*/
|
|
352143
352293
|
|
|
352144
352294
|
var db = mimeDb;
|
|
352145
|
-
var extname =
|
|
352295
|
+
var extname = path$d.extname;
|
|
352146
352296
|
|
|
352147
352297
|
/**
|
|
352148
352298
|
* Module variables.
|
|
@@ -353581,7 +353731,7 @@ var populate$1 = function (dst, src) {
|
|
|
353581
353731
|
|
|
353582
353732
|
var CombinedStream = combined_stream;
|
|
353583
353733
|
var util$J = require$$0$a;
|
|
353584
|
-
var path$a =
|
|
353734
|
+
var path$a = path$d;
|
|
353585
353735
|
var http$6 = require$$0$g;
|
|
353586
353736
|
var https$2 = require$$1$b;
|
|
353587
353737
|
var parseUrl$4 = require$$0$c.parse;
|
|
@@ -359653,11 +359803,12 @@ const {
|
|
|
359653
359803
|
|
|
359654
359804
|
const debounceMap = new Map();
|
|
359655
359805
|
let ThemeWatcherService = class ThemeWatcherService {
|
|
359656
|
-
constructor(logger, auth, config, graphql) {
|
|
359806
|
+
constructor(logger, auth, config, graphql, fileHash) {
|
|
359657
359807
|
this.logger = logger;
|
|
359658
359808
|
this.auth = auth;
|
|
359659
359809
|
this.config = config;
|
|
359660
359810
|
this.graphql = graphql;
|
|
359811
|
+
this.fileHash = fileHash;
|
|
359661
359812
|
this.devUI = null;
|
|
359662
359813
|
}
|
|
359663
359814
|
setDevUI(devUI) {
|
|
@@ -359682,9 +359833,76 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359682
359833
|
}
|
|
359683
359834
|
}
|
|
359684
359835
|
}
|
|
359836
|
+
async initialSync(appThemeId) {
|
|
359837
|
+
const rootDir = process.cwd();
|
|
359838
|
+
await this.fileHash.init(rootDir);
|
|
359839
|
+
const changedFiles = await this.fileHash.getChangedFiles(rootDir);
|
|
359840
|
+
let synced = 0;
|
|
359841
|
+
let skipped = 0;
|
|
359842
|
+
if (changedFiles.length === 0) {
|
|
359843
|
+
this.log('All files are up to date', 'info');
|
|
359844
|
+
return { synced, skipped };
|
|
359845
|
+
}
|
|
359846
|
+
this.log(`Found ${changedFiles.length} changed file(s), syncing...`, 'info');
|
|
359847
|
+
for (const filePath of changedFiles) {
|
|
359848
|
+
const folder = this.getFolderFromPath(filePath);
|
|
359849
|
+
if (!folder) {
|
|
359850
|
+
skipped++;
|
|
359851
|
+
continue;
|
|
359852
|
+
}
|
|
359853
|
+
const ext = path__namespace.extname(filePath).toLowerCase();
|
|
359854
|
+
const allowedExtensions = THEME_FOLDERS[folder];
|
|
359855
|
+
if (!allowedExtensions || ![...allowedExtensions].includes(ext)) {
|
|
359856
|
+
skipped++;
|
|
359857
|
+
continue;
|
|
359858
|
+
}
|
|
359859
|
+
const relativePath = path__namespace.relative(rootDir, filePath);
|
|
359860
|
+
try {
|
|
359861
|
+
switch (folder) {
|
|
359862
|
+
case 'assets':
|
|
359863
|
+
await this.handleAssetFile(appThemeId, filePath, 'upsert');
|
|
359864
|
+
break;
|
|
359865
|
+
case 'layouts':
|
|
359866
|
+
case 'templates':
|
|
359867
|
+
case 'ui':
|
|
359868
|
+
case 'locales':
|
|
359869
|
+
await this.uploadFileToServer(appThemeId, filePath, 'upsert');
|
|
359870
|
+
break;
|
|
359871
|
+
case 'pages':
|
|
359872
|
+
if (ext === '.json') {
|
|
359873
|
+
await this.syncThemePage(appThemeId, filePath, 'upsert');
|
|
359874
|
+
}
|
|
359875
|
+
break;
|
|
359876
|
+
case 'settings':
|
|
359877
|
+
if (ext === '.json') {
|
|
359878
|
+
await this.syncThemeVersionSettings(appThemeId, filePath, 'upsert');
|
|
359879
|
+
}
|
|
359880
|
+
break;
|
|
359881
|
+
case 'widgets':
|
|
359882
|
+
if (ext === '.njk') {
|
|
359883
|
+
await this.uploadFileToServer(appThemeId, filePath, 'upsert');
|
|
359884
|
+
}
|
|
359885
|
+
else if (ext === '.json') {
|
|
359886
|
+
await this.syncWidgetSchema(appThemeId, filePath, 'upsert');
|
|
359887
|
+
}
|
|
359888
|
+
break;
|
|
359889
|
+
}
|
|
359890
|
+
await this.fileHash.updateHash(filePath);
|
|
359891
|
+
this.log(`Synced: ${relativePath}`, 'success');
|
|
359892
|
+
synced++;
|
|
359893
|
+
}
|
|
359894
|
+
catch (err) {
|
|
359895
|
+
this.log(`Failed: ${relativePath} - ${err.message}`, 'error');
|
|
359896
|
+
}
|
|
359897
|
+
}
|
|
359898
|
+
this.log(`Initial sync complete: ${synced} synced, ${skipped} skipped`, 'info');
|
|
359899
|
+
return { synced, skipped };
|
|
359900
|
+
}
|
|
359685
359901
|
async watchAndSync(appThemeId, onFileChange) {
|
|
359686
359902
|
const rootDir = process.cwd();
|
|
359687
|
-
|
|
359903
|
+
// Initialize hash service
|
|
359904
|
+
await this.fileHash.init(rootDir);
|
|
359905
|
+
const watchPaths = Object.keys(THEME_FOLDERS).map((folder) => path__namespace.join(rootDir, folder));
|
|
359688
359906
|
return new Promise((resolve, reject) => {
|
|
359689
359907
|
const watcher = chokidar.watch(watchPaths, {
|
|
359690
359908
|
persistent: true,
|
|
@@ -359696,16 +359914,13 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359696
359914
|
resolve();
|
|
359697
359915
|
})
|
|
359698
359916
|
.on('add', (filePath) => {
|
|
359699
|
-
this.handleFileChange({ appThemeId, event: 'upsert', filePath });
|
|
359700
|
-
onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(filePath);
|
|
359917
|
+
this.handleFileChange({ appThemeId, event: 'upsert', filePath, onSyncComplete: onFileChange });
|
|
359701
359918
|
})
|
|
359702
359919
|
.on('change', (filePath) => {
|
|
359703
|
-
this.handleFileChange({ appThemeId, event: 'upsert', filePath });
|
|
359704
|
-
onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(filePath);
|
|
359920
|
+
this.handleFileChange({ appThemeId, event: 'upsert', filePath, onSyncComplete: onFileChange });
|
|
359705
359921
|
})
|
|
359706
359922
|
.on('unlink', (filePath) => {
|
|
359707
|
-
this.handleFileChange({ appThemeId, event: 'delete', filePath });
|
|
359708
|
-
onFileChange === null || onFileChange === void 0 ? void 0 : onFileChange(filePath);
|
|
359923
|
+
this.handleFileChange({ appThemeId, event: 'delete', filePath, onSyncComplete: onFileChange });
|
|
359709
359924
|
})
|
|
359710
359925
|
.on('error', (error) => {
|
|
359711
359926
|
this.log((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error', 'error');
|
|
@@ -359713,15 +359928,15 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359713
359928
|
});
|
|
359714
359929
|
});
|
|
359715
359930
|
}
|
|
359716
|
-
async handleFileChange({ appThemeId, event, filePath }) {
|
|
359931
|
+
async handleFileChange({ appThemeId, event, filePath, onSyncComplete }) {
|
|
359717
359932
|
const folder = this.getFolderFromPath(filePath);
|
|
359718
359933
|
if (!folder)
|
|
359719
359934
|
return;
|
|
359720
|
-
const ext =
|
|
359935
|
+
const ext = path__namespace.extname(filePath).toLowerCase();
|
|
359721
359936
|
const allowedExtensions = THEME_FOLDERS[folder];
|
|
359722
359937
|
if (!allowedExtensions || ![...allowedExtensions].includes(ext))
|
|
359723
359938
|
return;
|
|
359724
|
-
const relativePath =
|
|
359939
|
+
const relativePath = path__namespace.relative(process.cwd(), filePath);
|
|
359725
359940
|
// Debounce - 300ms delay
|
|
359726
359941
|
if (debounceMap.has(relativePath)) {
|
|
359727
359942
|
clearTimeout(debounceMap.get(relativePath));
|
|
@@ -359729,6 +359944,14 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359729
359944
|
const timeout = setTimeout(async () => {
|
|
359730
359945
|
debounceMap.delete(relativePath);
|
|
359731
359946
|
try {
|
|
359947
|
+
// Check if file actually changed (skip if content is same)
|
|
359948
|
+
if (event !== 'delete') {
|
|
359949
|
+
const hasChanged = await this.fileHash.hasChanged(filePath);
|
|
359950
|
+
if (!hasChanged) {
|
|
359951
|
+
this.log(`Skipped (unchanged): ${relativePath}`, 'info');
|
|
359952
|
+
return;
|
|
359953
|
+
}
|
|
359954
|
+
}
|
|
359732
359955
|
switch (folder) {
|
|
359733
359956
|
case 'assets':
|
|
359734
359957
|
await this.handleAssetFile(appThemeId, filePath, event);
|
|
@@ -359758,7 +359981,16 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359758
359981
|
}
|
|
359759
359982
|
break;
|
|
359760
359983
|
}
|
|
359984
|
+
// Update hash after successful sync
|
|
359985
|
+
if (event === 'delete') {
|
|
359986
|
+
await this.fileHash.removeHash(filePath);
|
|
359987
|
+
}
|
|
359988
|
+
else {
|
|
359989
|
+
await this.fileHash.updateHash(filePath);
|
|
359990
|
+
}
|
|
359761
359991
|
this.log(`Synced: ${relativePath}`, 'success');
|
|
359992
|
+
// Notify hot reload after successful sync
|
|
359993
|
+
onSyncComplete === null || onSyncComplete === void 0 ? void 0 : onSyncComplete(filePath);
|
|
359762
359994
|
}
|
|
359763
359995
|
catch (err) {
|
|
359764
359996
|
this.log(`Failed: ${relativePath} - ${err.message}`, 'error');
|
|
@@ -359775,9 +360007,9 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359775
360007
|
if (!(qumraConfig === null || qumraConfig === void 0 ? void 0 : qumraConfig.themeId) || !(qumraConfig === null || qumraConfig === void 0 ? void 0 : qumraConfig.version)) {
|
|
359776
360008
|
throw new Error('themeId or version missing in config');
|
|
359777
360009
|
}
|
|
359778
|
-
const fileName =
|
|
360010
|
+
const fileName = path__namespace.basename(filePath);
|
|
359779
360011
|
const fileStat = fs__namespace.statSync(filePath);
|
|
359780
|
-
const ext =
|
|
360012
|
+
const ext = path__namespace.extname(filePath).toLowerCase();
|
|
359781
360013
|
const contentType = this.getContentType(ext);
|
|
359782
360014
|
const mutation = `
|
|
359783
360015
|
mutation CdnPresignedUrl($cdnPresignedInput: CdnPresignedInput!) {
|
|
@@ -359820,10 +360052,10 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359820
360052
|
if (event === 'delete')
|
|
359821
360053
|
return;
|
|
359822
360054
|
const qumraConfig = await this.config.load();
|
|
359823
|
-
const relativePath =
|
|
360055
|
+
const relativePath = path__namespace.relative(process.cwd(), filePath);
|
|
359824
360056
|
const form = new FormData$2();
|
|
359825
360057
|
form.append('file', fs__namespace.createReadStream(filePath), {
|
|
359826
|
-
filename:
|
|
360058
|
+
filename: path__namespace.basename(filePath),
|
|
359827
360059
|
filepath: relativePath,
|
|
359828
360060
|
});
|
|
359829
360061
|
form.append('filePath', relativePath);
|
|
@@ -359854,7 +360086,7 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359854
360086
|
}
|
|
359855
360087
|
}
|
|
359856
360088
|
`;
|
|
359857
|
-
const pageHandle =
|
|
360089
|
+
const pageHandle = path__namespace.basename(filePath, '.json');
|
|
359858
360090
|
const variables = {
|
|
359859
360091
|
input: {
|
|
359860
360092
|
themeId: qumraConfig.themeId,
|
|
@@ -359887,7 +360119,7 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359887
360119
|
}
|
|
359888
360120
|
}
|
|
359889
360121
|
`;
|
|
359890
|
-
const fileName =
|
|
360122
|
+
const fileName = path__namespace.basename(filePath);
|
|
359891
360123
|
const input = {
|
|
359892
360124
|
themeId: qumraConfig.themeId,
|
|
359893
360125
|
version: qumraConfig.version,
|
|
@@ -359928,7 +360160,7 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359928
360160
|
}
|
|
359929
360161
|
}
|
|
359930
360162
|
`;
|
|
359931
|
-
const widgetKey =
|
|
360163
|
+
const widgetKey = path__namespace.basename(path__namespace.dirname(filePath));
|
|
359932
360164
|
const variables = {
|
|
359933
360165
|
input: {
|
|
359934
360166
|
themeId: qumraConfig.themeId,
|
|
@@ -359952,8 +360184,8 @@ let ThemeWatcherService = class ThemeWatcherService {
|
|
|
359952
360184
|
}
|
|
359953
360185
|
getFolderFromPath(filePath) {
|
|
359954
360186
|
const rootDir = process.cwd();
|
|
359955
|
-
const relativePath =
|
|
359956
|
-
const parts = relativePath.split(
|
|
360187
|
+
const relativePath = path__namespace.relative(rootDir, filePath);
|
|
360188
|
+
const parts = relativePath.split(path__namespace.sep);
|
|
359957
360189
|
const folder = parts[0];
|
|
359958
360190
|
return Object.keys(THEME_FOLDERS).includes(folder) ? folder : null;
|
|
359959
360191
|
}
|
|
@@ -359979,7 +360211,8 @@ ThemeWatcherService = __decorate$5([
|
|
|
359979
360211
|
__metadata$2("design:paramtypes", [LoggerService,
|
|
359980
360212
|
AuthService,
|
|
359981
360213
|
ConfigService,
|
|
359982
|
-
GraphqlService
|
|
360214
|
+
GraphqlService,
|
|
360215
|
+
FileHashService])
|
|
359983
360216
|
], ThemeWatcherService);
|
|
359984
360217
|
|
|
359985
360218
|
let ThemeValidatorService = class ThemeValidatorService {
|
|
@@ -359987,9 +360220,9 @@ let ThemeValidatorService = class ThemeValidatorService {
|
|
|
359987
360220
|
this.logger = logger;
|
|
359988
360221
|
}
|
|
359989
360222
|
validateStructure(projectPath = process.cwd()) {
|
|
359990
|
-
this.validatePages(
|
|
359991
|
-
this.validateWidgets(
|
|
359992
|
-
this.validateLocales(
|
|
360223
|
+
this.validatePages(path__namespace.join(projectPath, 'pages'));
|
|
360224
|
+
this.validateWidgets(path__namespace.join(projectPath, 'widgets'));
|
|
360225
|
+
this.validateLocales(path__namespace.join(projectPath, 'locales'));
|
|
359993
360226
|
}
|
|
359994
360227
|
validatePages(pagesPath) {
|
|
359995
360228
|
if (!fs__namespace.existsSync(pagesPath)) {
|
|
@@ -360000,7 +360233,7 @@ let ThemeValidatorService = class ThemeValidatorService {
|
|
|
360000
360233
|
throw new Error('No page files found in pages/');
|
|
360001
360234
|
}
|
|
360002
360235
|
for (const file of files) {
|
|
360003
|
-
const filePath =
|
|
360236
|
+
const filePath = path__namespace.join(pagesPath, file);
|
|
360004
360237
|
const content = fs__namespace.readFileSync(filePath, 'utf-8');
|
|
360005
360238
|
try {
|
|
360006
360239
|
const page = JSON.parse(content);
|
|
@@ -360023,8 +360256,8 @@ let ThemeValidatorService = class ThemeValidatorService {
|
|
|
360023
360256
|
.filter((d) => d.isDirectory())
|
|
360024
360257
|
.map((d) => d.name);
|
|
360025
360258
|
for (const widget of widgets) {
|
|
360026
|
-
const schemaPath =
|
|
360027
|
-
const templatePath =
|
|
360259
|
+
const schemaPath = path__namespace.join(widgetsPath, widget, 'schema.json');
|
|
360260
|
+
const templatePath = path__namespace.join(widgetsPath, widget, 'widget.njk');
|
|
360028
360261
|
if (!fs__namespace.existsSync(schemaPath)) {
|
|
360029
360262
|
throw new Error(`${widget}/: missing schema.json`);
|
|
360030
360263
|
}
|
|
@@ -360047,7 +360280,7 @@ let ThemeValidatorService = class ThemeValidatorService {
|
|
|
360047
360280
|
}
|
|
360048
360281
|
const files = fs__namespace.readdirSync(localesPath).filter((f) => f.endsWith('.json'));
|
|
360049
360282
|
for (const file of files) {
|
|
360050
|
-
const filePath =
|
|
360283
|
+
const filePath = path__namespace.join(localesPath, file);
|
|
360051
360284
|
try {
|
|
360052
360285
|
JSON.parse(fs__namespace.readFileSync(filePath, 'utf-8'));
|
|
360053
360286
|
}
|
|
@@ -361283,7 +361516,7 @@ var readdirGlob_1 = readdirGlob;
|
|
|
361283
361516
|
const fs$b = fs$i;
|
|
361284
361517
|
const { EventEmitter: EventEmitter$4 } = require$$2$7;
|
|
361285
361518
|
const { Minimatch } = minimatch_1$5;
|
|
361286
|
-
const { resolve: resolve$4 } =
|
|
361519
|
+
const { resolve: resolve$4 } = path$d;
|
|
361287
361520
|
|
|
361288
361521
|
function readdir(dir, strict) {
|
|
361289
361522
|
return new Promise((resolve, reject) => {
|
|
@@ -387517,7 +387750,7 @@ hasMagic$1.hasMagic = hasMagic;
|
|
|
387517
387750
|
*/
|
|
387518
387751
|
|
|
387519
387752
|
var fs$9 = gracefulFs;
|
|
387520
|
-
var path$7 =
|
|
387753
|
+
var path$7 = path$d;
|
|
387521
387754
|
|
|
387522
387755
|
var flatten$2 = flatten_1;
|
|
387523
387756
|
var difference = difference_1;
|
|
@@ -387729,7 +387962,7 @@ var fileExports = file$1.exports;
|
|
|
387729
387962
|
*/
|
|
387730
387963
|
|
|
387731
387964
|
var fs$8 = gracefulFs;
|
|
387732
|
-
var path$6 =
|
|
387965
|
+
var path$6 = path$d;
|
|
387733
387966
|
var isStream$5 = isStream_1;
|
|
387734
387967
|
var lazystream = lazystream$1;
|
|
387735
387968
|
var normalizePath$1 = normalizePath$2;
|
|
@@ -395002,7 +395235,7 @@ var oursExports$2 = ours$2.exports;
|
|
|
395002
395235
|
var fs$7 = fs$i;
|
|
395003
395236
|
var glob = readdirGlob_1;
|
|
395004
395237
|
var async = require$$2$4;
|
|
395005
|
-
var path$5 =
|
|
395238
|
+
var path$5 = path$d;
|
|
395006
395239
|
var util$D = archiverUtilsExports;
|
|
395007
395240
|
|
|
395008
395241
|
var inherits$5 = require$$0$a.inherits;
|
|
@@ -415031,7 +415264,7 @@ let ThemeBundlerService = class ThemeBundlerService {
|
|
|
415031
415264
|
throw new Error('themeName not found in config. Run: qumra theme init');
|
|
415032
415265
|
}
|
|
415033
415266
|
const zipFileName = `${qumraConfig.themeName}.zip`;
|
|
415034
|
-
const zipFilePath =
|
|
415267
|
+
const zipFilePath = path__namespace.join(projectPath, zipFileName);
|
|
415035
415268
|
// Remove old zip if exists
|
|
415036
415269
|
if (fs__namespace.existsSync(zipFilePath)) {
|
|
415037
415270
|
fs__namespace.unlinkSync(zipFilePath);
|
|
@@ -415041,13 +415274,13 @@ let ThemeBundlerService = class ThemeBundlerService {
|
|
|
415041
415274
|
archive.pipe(output);
|
|
415042
415275
|
// Add theme directories
|
|
415043
415276
|
for (const dir of ALLOWED_THEME_DIRS) {
|
|
415044
|
-
const fullPath =
|
|
415277
|
+
const fullPath = path__namespace.join(projectPath, dir);
|
|
415045
415278
|
if (fs__namespace.existsSync(fullPath)) {
|
|
415046
415279
|
archive.directory(fullPath, dir);
|
|
415047
415280
|
}
|
|
415048
415281
|
}
|
|
415049
415282
|
// Add .qumra config
|
|
415050
|
-
const qumraDir =
|
|
415283
|
+
const qumraDir = path__namespace.join(projectPath, '.qumra');
|
|
415051
415284
|
if (fs__namespace.existsSync(qumraDir)) {
|
|
415052
415285
|
archive.directory(qumraDir, '.qumra');
|
|
415053
415286
|
}
|
|
@@ -415082,7 +415315,7 @@ var bodyParser = {exports: {}};
|
|
|
415082
415315
|
* Module dependencies.
|
|
415083
415316
|
*/
|
|
415084
415317
|
|
|
415085
|
-
var relative =
|
|
415318
|
+
var relative = path$d.relative;
|
|
415086
415319
|
|
|
415087
415320
|
/**
|
|
415088
415321
|
* Module exports.
|
|
@@ -423371,7 +423604,7 @@ function requireQuery () {
|
|
|
423371
423604
|
*/
|
|
423372
423605
|
|
|
423373
423606
|
var debug$m = srcExports$5('express:view');
|
|
423374
|
-
var path$4 =
|
|
423607
|
+
var path$4 = path$d;
|
|
423375
423608
|
var fs$6 = fs$i;
|
|
423376
423609
|
|
|
423377
423610
|
/**
|
|
@@ -423561,7 +423794,7 @@ contentDisposition$2.exports.parse = parse$g;
|
|
|
423561
423794
|
* @private
|
|
423562
423795
|
*/
|
|
423563
423796
|
|
|
423564
|
-
var basename =
|
|
423797
|
+
var basename = path$d.basename;
|
|
423565
423798
|
var Buffer$2 = safeBufferExports.Buffer;
|
|
423566
423799
|
|
|
423567
423800
|
/**
|
|
@@ -427545,7 +427778,7 @@ var mime$2 = mime_1;
|
|
|
427545
427778
|
var ms$9 = ms$a;
|
|
427546
427779
|
var onFinished$1 = onFinishedExports;
|
|
427547
427780
|
var parseRange$1 = rangeParser_1;
|
|
427548
|
-
var path$3 =
|
|
427781
|
+
var path$3 = path$d;
|
|
427549
427782
|
var statuses$1 = statuses$3;
|
|
427550
427783
|
var Stream = require$$0$b;
|
|
427551
427784
|
var util$r = require$$0$a;
|
|
@@ -430088,7 +430321,7 @@ var proxyAddrExports = proxyAddr.exports;
|
|
|
430088
430321
|
var deprecate = depd_1('express');
|
|
430089
430322
|
var flatten = arrayFlatten_1;
|
|
430090
430323
|
var merge = utilsMergeExports;
|
|
430091
|
-
var resolve =
|
|
430324
|
+
var resolve = path$d.resolve;
|
|
430092
430325
|
var setPrototypeOf = setprototypeof;
|
|
430093
430326
|
|
|
430094
430327
|
/**
|
|
@@ -432970,7 +433203,7 @@ var escapeHtml = escapeHtml_1;
|
|
|
432970
433203
|
var http$2 = require$$0$g;
|
|
432971
433204
|
var isAbsolute = utils$b.isAbsolute;
|
|
432972
433205
|
var onFinished = onFinishedExports;
|
|
432973
|
-
var path$2 =
|
|
433206
|
+
var path$2 = path$d;
|
|
432974
433207
|
var statuses = statuses$3;
|
|
432975
433208
|
var merge$1 = utilsMergeExports;
|
|
432976
433209
|
var sign$1 = cookieSignature.sign;
|
|
@@ -434151,7 +434384,7 @@ function requireServeStatic () {
|
|
|
434151
434384
|
var encodeUrl = encodeurl$1;
|
|
434152
434385
|
var escapeHtml = escapeHtml_1;
|
|
434153
434386
|
var parseUrl = parseurlExports;
|
|
434154
|
-
var resolve =
|
|
434387
|
+
var resolve = path$d.resolve;
|
|
434155
434388
|
var send = sendExports;
|
|
434156
434389
|
var url = require$$0$c;
|
|
434157
434390
|
|
|
@@ -438851,7 +439084,7 @@ var braces_1 = braces$1;
|
|
|
438851
439084
|
|
|
438852
439085
|
var utils$6 = {};
|
|
438853
439086
|
|
|
438854
|
-
const path$1 =
|
|
439087
|
+
const path$1 = path$d;
|
|
438855
439088
|
const WIN_SLASH = '\\\\/';
|
|
438856
439089
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
438857
439090
|
|
|
@@ -439031,7 +439264,7 @@ var constants$9 = {
|
|
|
439031
439264
|
|
|
439032
439265
|
(function (exports$1) {
|
|
439033
439266
|
|
|
439034
|
-
const path =
|
|
439267
|
+
const path = path$d;
|
|
439035
439268
|
const win32 = process.platform === 'win32';
|
|
439036
439269
|
const {
|
|
439037
439270
|
REGEX_BACKSLASH,
|
|
@@ -440575,7 +440808,7 @@ parse$8.fastpaths = (input, options) => {
|
|
|
440575
440808
|
|
|
440576
440809
|
var parse_1 = parse$8;
|
|
440577
440810
|
|
|
440578
|
-
const path =
|
|
440811
|
+
const path = path$d;
|
|
440579
440812
|
const scan = scan_1;
|
|
440580
440813
|
const parse$7 = parse_1;
|
|
440581
440814
|
const utils$3 = utils$6;
|
|
@@ -529645,7 +529878,7 @@ var require$$18 = {
|
|
|
529645
529878
|
const zlib_1 = zlib$3;
|
|
529646
529879
|
const accepts = accepts$3;
|
|
529647
529880
|
const stream_1 = require$$0$b;
|
|
529648
|
-
const path =
|
|
529881
|
+
const path = path$d;
|
|
529649
529882
|
const engine_io_1 = engine_io;
|
|
529650
529883
|
const client_1 = client;
|
|
529651
529884
|
const events_1 = require$$2$7;
|
|
@@ -530515,7 +530748,7 @@ let ThemeHotReloadService = class ThemeHotReloadService {
|
|
|
530515
530748
|
const changeType = this.getChangeType(filePath);
|
|
530516
530749
|
const event = {
|
|
530517
530750
|
type: changeType,
|
|
530518
|
-
file:
|
|
530751
|
+
file: path__namespace.basename(filePath),
|
|
530519
530752
|
timestamp: Date.now(),
|
|
530520
530753
|
};
|
|
530521
530754
|
this.io.emit('file-change', event);
|
|
@@ -530525,7 +530758,7 @@ let ThemeHotReloadService = class ThemeHotReloadService {
|
|
|
530525
530758
|
* Determine the type of change based on file extension
|
|
530526
530759
|
*/
|
|
530527
530760
|
getChangeType(filePath) {
|
|
530528
|
-
const ext =
|
|
530761
|
+
const ext = path__namespace.extname(filePath).toLowerCase();
|
|
530529
530762
|
this.getFolderFromPath(filePath);
|
|
530530
530763
|
// CSS files can be hot-swapped without full reload
|
|
530531
530764
|
if (ext === '.css') {
|
|
@@ -530546,7 +530779,7 @@ let ThemeHotReloadService = class ThemeHotReloadService {
|
|
|
530546
530779
|
* Extract folder name from file path
|
|
530547
530780
|
*/
|
|
530548
530781
|
getFolderFromPath(filePath) {
|
|
530549
|
-
const parts = filePath.split(
|
|
530782
|
+
const parts = filePath.split(path__namespace.sep);
|
|
530550
530783
|
const themeFolders = ['assets', 'layouts', 'locales', 'pages', 'settings', 'widgets', 'ui', 'templates'];
|
|
530551
530784
|
for (const part of parts) {
|
|
530552
530785
|
if (themeFolders.includes(part)) {
|
|
@@ -530748,11 +530981,11 @@ let ThemeProxyService = class ThemeProxyService {
|
|
|
530748
530981
|
});
|
|
530749
530982
|
// Serve static assets from theme/assets folder
|
|
530750
530983
|
this.app.use('/assets', (req, res, next) => {
|
|
530751
|
-
const ext =
|
|
530984
|
+
const ext = path__namespace.extname(req.path).toLowerCase();
|
|
530752
530985
|
const fileType = this.getFileType(ext);
|
|
530753
530986
|
this.log(`[${fileType}] /assets${req.path}`);
|
|
530754
530987
|
next();
|
|
530755
|
-
}, express$1.static(
|
|
530988
|
+
}, express$1.static(path__namespace.join(themePath, 'assets'), {
|
|
530756
530989
|
setHeaders: (res) => corsHeaders(res),
|
|
530757
530990
|
}));
|
|
530758
530991
|
// Mock Cloudflare CDN endpoints to prevent CORS errors
|
|
@@ -530780,7 +531013,7 @@ let ThemeProxyService = class ThemeProxyService {
|
|
|
530780
531013
|
proxyReq: (proxyReq, req) => {
|
|
530781
531014
|
// Log the request
|
|
530782
531015
|
const reqPath = req.url || '/';
|
|
530783
|
-
const ext =
|
|
531016
|
+
const ext = path__namespace.extname(reqPath).toLowerCase();
|
|
530784
531017
|
// Only log page requests (not assets)
|
|
530785
531018
|
if (!ext || ext === '.html' || reqPath === '/') {
|
|
530786
531019
|
self.log(`${req.method} ${reqPath}`);
|
|
@@ -531091,7 +531324,7 @@ let ThemeService = class ThemeService {
|
|
|
531091
531324
|
this.hotReload = hotReload;
|
|
531092
531325
|
}
|
|
531093
531326
|
async init(themeName) {
|
|
531094
|
-
const targetPath =
|
|
531327
|
+
const targetPath = path__namespace.resolve(process.cwd(), themeName);
|
|
531095
531328
|
if (fs__namespace.existsSync(targetPath)) {
|
|
531096
531329
|
throw new Error(`Folder "${themeName}" already exists`);
|
|
531097
531330
|
}
|
|
@@ -531100,7 +531333,7 @@ let ThemeService = class ThemeService {
|
|
|
531100
531333
|
this.logger.info('init', 'Cloning starter template...');
|
|
531101
531334
|
require$$1$7.execSync(`git clone ${THEME_STARTER_REPO} "${themeName}"`, { stdio: 'ignore' });
|
|
531102
531335
|
// Remove .git
|
|
531103
|
-
fs__namespace.rmSync(
|
|
531336
|
+
fs__namespace.rmSync(path__namespace.join(targetPath, '.git'), { recursive: true, force: true });
|
|
531104
531337
|
// Save config
|
|
531105
531338
|
await this.config.save({
|
|
531106
531339
|
themeId: themeData.themeId,
|
|
@@ -531160,7 +531393,7 @@ let ThemeService = class ThemeService {
|
|
|
531160
531393
|
],
|
|
531161
531394
|
urls: [
|
|
531162
531395
|
{ label: 'Local Dev URL', url: proxyUrl },
|
|
531163
|
-
{ label: '
|
|
531396
|
+
{ label: 'Online Preview', url: `${storeUrl}?theme=${appTheme._id}` },
|
|
531164
531397
|
{ label: 'Theme Editor', url: editorUrl },
|
|
531165
531398
|
],
|
|
531166
531399
|
shortcuts: [
|
|
@@ -531173,7 +531406,7 @@ let ThemeService = class ThemeService {
|
|
|
531173
531406
|
}
|
|
531174
531407
|
},
|
|
531175
531408
|
{ key: 'o', label: 'Open Browser', handler: () => open(proxyUrl) },
|
|
531176
|
-
{ key: 's', label: '
|
|
531409
|
+
{ key: 's', label: 'Online Preview', handler: () => open(`${storeUrl}?theme=${appTheme._id}`) },
|
|
531177
531410
|
{ key: 'e', label: 'Theme Editor', handler: () => open(editorUrl) },
|
|
531178
531411
|
],
|
|
531179
531412
|
logPanels: ['Logs'],
|
|
@@ -531182,6 +531415,12 @@ let ThemeService = class ThemeService {
|
|
|
531182
531415
|
this.proxy.setDevUI(devUI);
|
|
531183
531416
|
this.watcher.setDevUI(devUI);
|
|
531184
531417
|
this.hotReload.setDevUI(devUI);
|
|
531418
|
+
// Initial sync - sync changed files since last session
|
|
531419
|
+
devUI.log('sync', 'Checking for changed files...');
|
|
531420
|
+
const { synced, skipped } = await this.watcher.initialSync(appTheme._id);
|
|
531421
|
+
if (synced > 0) {
|
|
531422
|
+
devUI.log('sync', `Initial sync: ${synced} file(s) synced`, 'success');
|
|
531423
|
+
}
|
|
531185
531424
|
// Start file watcher
|
|
531186
531425
|
devUI.log('watcher', 'Starting file watcher...');
|
|
531187
531426
|
await this.watcher.watchAndSync(appTheme._id, (filePath) => {
|
|
@@ -531207,7 +531446,7 @@ let ThemeService = class ThemeService {
|
|
|
531207
531446
|
await this.bundler.bundle();
|
|
531208
531447
|
}
|
|
531209
531448
|
changeVersion(type, increment) {
|
|
531210
|
-
const configPath =
|
|
531449
|
+
const configPath = path__namespace.join(process.cwd(), 'qumra.config.json');
|
|
531211
531450
|
if (!fs__namespace.existsSync(configPath)) {
|
|
531212
531451
|
throw new Error('qumra.config.json not found');
|
|
531213
531452
|
}
|
|
@@ -531285,13 +531524,18 @@ ThemeService = __decorate$5([
|
|
|
531285
531524
|
], ThemeService);
|
|
531286
531525
|
|
|
531287
531526
|
let ThemeInitCommand = class ThemeInitCommand extends src$6.CommandRunner {
|
|
531288
|
-
constructor(themeService, logger) {
|
|
531527
|
+
constructor(themeService, logger, auth) {
|
|
531289
531528
|
super();
|
|
531290
531529
|
this.themeService = themeService;
|
|
531291
531530
|
this.logger = logger;
|
|
531531
|
+
this.auth = auth;
|
|
531292
531532
|
}
|
|
531293
531533
|
async run() {
|
|
531294
531534
|
try {
|
|
531535
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
531536
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
531537
|
+
process.exit(1);
|
|
531538
|
+
}
|
|
531295
531539
|
const { themeName } = await inquirer.prompt([
|
|
531296
531540
|
{
|
|
531297
531541
|
type: 'input',
|
|
@@ -531318,17 +531562,23 @@ let ThemeInitCommand = class ThemeInitCommand extends src$6.CommandRunner {
|
|
|
531318
531562
|
ThemeInitCommand = __decorate$5([
|
|
531319
531563
|
src$6.SubCommand({ name: 'init', description: 'Create a new theme' }),
|
|
531320
531564
|
__metadata$2("design:paramtypes", [ThemeService,
|
|
531321
|
-
LoggerService
|
|
531565
|
+
LoggerService,
|
|
531566
|
+
AuthService])
|
|
531322
531567
|
], ThemeInitCommand);
|
|
531323
531568
|
|
|
531324
531569
|
let ThemeDevCommand = class ThemeDevCommand extends src$6.CommandRunner {
|
|
531325
|
-
constructor(themeService, logger) {
|
|
531570
|
+
constructor(themeService, logger, auth) {
|
|
531326
531571
|
super();
|
|
531327
531572
|
this.themeService = themeService;
|
|
531328
531573
|
this.logger = logger;
|
|
531574
|
+
this.auth = auth;
|
|
531329
531575
|
}
|
|
531330
531576
|
async run() {
|
|
531331
531577
|
try {
|
|
531578
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
531579
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
531580
|
+
process.exit(1);
|
|
531581
|
+
}
|
|
531332
531582
|
await this.themeService.dev();
|
|
531333
531583
|
}
|
|
531334
531584
|
catch (error) {
|
|
@@ -531341,18 +531591,25 @@ ThemeDevCommand = __decorate$5([
|
|
|
531341
531591
|
src$6.SubCommand({ name: 'dev', description: 'Start development server' }),
|
|
531342
531592
|
__param$2(0, commonExports.Inject(ThemeService)),
|
|
531343
531593
|
__param$2(1, commonExports.Inject(LoggerService)),
|
|
531594
|
+
__param$2(2, commonExports.Inject(AuthService)),
|
|
531344
531595
|
__metadata$2("design:paramtypes", [ThemeService,
|
|
531345
|
-
LoggerService
|
|
531596
|
+
LoggerService,
|
|
531597
|
+
AuthService])
|
|
531346
531598
|
], ThemeDevCommand);
|
|
531347
531599
|
|
|
531348
531600
|
let ThemePublishCommand = class ThemePublishCommand extends src$6.CommandRunner {
|
|
531349
|
-
constructor(themeService, logger) {
|
|
531601
|
+
constructor(themeService, logger, auth) {
|
|
531350
531602
|
super();
|
|
531351
531603
|
this.themeService = themeService;
|
|
531352
531604
|
this.logger = logger;
|
|
531605
|
+
this.auth = auth;
|
|
531353
531606
|
}
|
|
531354
531607
|
async run() {
|
|
531355
531608
|
try {
|
|
531609
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
531610
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
531611
|
+
process.exit(1);
|
|
531612
|
+
}
|
|
531356
531613
|
await this.themeService.publish();
|
|
531357
531614
|
}
|
|
531358
531615
|
catch (error) {
|
|
@@ -531364,7 +531621,8 @@ let ThemePublishCommand = class ThemePublishCommand extends src$6.CommandRunner
|
|
|
531364
531621
|
ThemePublishCommand = __decorate$5([
|
|
531365
531622
|
src$6.SubCommand({ name: 'publish', description: 'Validate theme for publishing' }),
|
|
531366
531623
|
__metadata$2("design:paramtypes", [ThemeService,
|
|
531367
|
-
LoggerService
|
|
531624
|
+
LoggerService,
|
|
531625
|
+
AuthService])
|
|
531368
531626
|
], ThemePublishCommand);
|
|
531369
531627
|
|
|
531370
531628
|
let ThemeBundleCommand = class ThemeBundleCommand extends src$6.CommandRunner {
|
|
@@ -531574,18 +531832,18 @@ let ThemeAssetMapperService = class ThemeAssetMapperService {
|
|
|
531574
531832
|
* Check if a local file exists
|
|
531575
531833
|
*/
|
|
531576
531834
|
localFileExists(relativePath) {
|
|
531577
|
-
const fullPath =
|
|
531835
|
+
const fullPath = path__namespace.join(this.themePath, relativePath);
|
|
531578
531836
|
return fs__namespace.existsSync(fullPath);
|
|
531579
531837
|
}
|
|
531580
531838
|
/**
|
|
531581
531839
|
* Get local file content and MIME type
|
|
531582
531840
|
*/
|
|
531583
531841
|
getLocalAsset(relativePath) {
|
|
531584
|
-
const fullPath =
|
|
531842
|
+
const fullPath = path__namespace.join(this.themePath, relativePath);
|
|
531585
531843
|
if (!fs__namespace.existsSync(fullPath)) {
|
|
531586
531844
|
return null;
|
|
531587
531845
|
}
|
|
531588
|
-
const ext =
|
|
531846
|
+
const ext = path__namespace.extname(relativePath).toLowerCase();
|
|
531589
531847
|
const mimeType = MIME_TYPES[ext] || 'application/octet-stream';
|
|
531590
531848
|
return {
|
|
531591
531849
|
localPath: fullPath,
|
|
@@ -531596,7 +531854,7 @@ let ThemeAssetMapperService = class ThemeAssetMapperService {
|
|
|
531596
531854
|
* Get MIME type for a file extension
|
|
531597
531855
|
*/
|
|
531598
531856
|
getMimeType(filePath) {
|
|
531599
|
-
const ext =
|
|
531857
|
+
const ext = path__namespace.extname(filePath).toLowerCase();
|
|
531600
531858
|
return MIME_TYPES[ext] || 'application/octet-stream';
|
|
531601
531859
|
}
|
|
531602
531860
|
};
|
|
@@ -531952,7 +532210,7 @@ let AppService = class AppService {
|
|
|
531952
532210
|
this.devServer = devServer;
|
|
531953
532211
|
}
|
|
531954
532212
|
async init(appName) {
|
|
531955
|
-
const targetPath =
|
|
532213
|
+
const targetPath = path__namespace.resolve(process.cwd(), appName);
|
|
531956
532214
|
if (fs__namespace.existsSync(targetPath)) {
|
|
531957
532215
|
throw new Error(`Folder "${appName}" already exists`);
|
|
531958
532216
|
}
|
|
@@ -531964,7 +532222,7 @@ let AppService = class AppService {
|
|
|
531964
532222
|
this.logger.info('init', 'Cloning starter template...');
|
|
531965
532223
|
require$$1$7.execSync(`git clone ${APP_STARTER_REPO} "${appName}"`, { stdio: 'ignore' });
|
|
531966
532224
|
// Remove .git
|
|
531967
|
-
fs__namespace.rmSync(
|
|
532225
|
+
fs__namespace.rmSync(path__namespace.join(targetPath, '.git'), { recursive: true, force: true });
|
|
531968
532226
|
// Save config
|
|
531969
532227
|
await this.config.save({
|
|
531970
532228
|
clientId: appData.clientId,
|
|
@@ -532133,7 +532391,7 @@ let AppService = class AppService {
|
|
|
532133
532391
|
return install;
|
|
532134
532392
|
}
|
|
532135
532393
|
async loadManifest() {
|
|
532136
|
-
const manifestPath =
|
|
532394
|
+
const manifestPath = path__namespace.join(process.cwd(), 'qumra.app.json');
|
|
532137
532395
|
if (!fs__namespace.existsSync(manifestPath)) {
|
|
532138
532396
|
return null;
|
|
532139
532397
|
}
|
|
@@ -532165,13 +532423,18 @@ AppService = __decorate$5([
|
|
|
532165
532423
|
], AppService);
|
|
532166
532424
|
|
|
532167
532425
|
let AppInitCommand = class AppInitCommand extends src$6.CommandRunner {
|
|
532168
|
-
constructor(appService, logger) {
|
|
532426
|
+
constructor(appService, logger, auth) {
|
|
532169
532427
|
super();
|
|
532170
532428
|
this.appService = appService;
|
|
532171
532429
|
this.logger = logger;
|
|
532430
|
+
this.auth = auth;
|
|
532172
532431
|
}
|
|
532173
532432
|
async run() {
|
|
532174
532433
|
try {
|
|
532434
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
532435
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
532436
|
+
process.exit(1);
|
|
532437
|
+
}
|
|
532175
532438
|
const { appName } = await inquirer.prompt([
|
|
532176
532439
|
{
|
|
532177
532440
|
type: 'input',
|
|
@@ -532198,17 +532461,23 @@ let AppInitCommand = class AppInitCommand extends src$6.CommandRunner {
|
|
|
532198
532461
|
AppInitCommand = __decorate$5([
|
|
532199
532462
|
src$6.SubCommand({ name: 'init', description: 'Create a new app' }),
|
|
532200
532463
|
__metadata$2("design:paramtypes", [AppService,
|
|
532201
|
-
LoggerService
|
|
532464
|
+
LoggerService,
|
|
532465
|
+
AuthService])
|
|
532202
532466
|
], AppInitCommand);
|
|
532203
532467
|
|
|
532204
532468
|
let AppDevCommand = class AppDevCommand extends src$6.CommandRunner {
|
|
532205
|
-
constructor(appService, logger) {
|
|
532469
|
+
constructor(appService, logger, auth) {
|
|
532206
532470
|
super();
|
|
532207
532471
|
this.appService = appService;
|
|
532208
532472
|
this.logger = logger;
|
|
532473
|
+
this.auth = auth;
|
|
532209
532474
|
}
|
|
532210
532475
|
async run() {
|
|
532211
532476
|
try {
|
|
532477
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
532478
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
532479
|
+
process.exit(1);
|
|
532480
|
+
}
|
|
532212
532481
|
await this.appService.dev();
|
|
532213
532482
|
}
|
|
532214
532483
|
catch (error) {
|
|
@@ -532221,18 +532490,25 @@ AppDevCommand = __decorate$5([
|
|
|
532221
532490
|
src$6.SubCommand({ name: 'dev', description: 'Start development environment' }),
|
|
532222
532491
|
__param$2(0, commonExports.Inject(AppService)),
|
|
532223
532492
|
__param$2(1, commonExports.Inject(LoggerService)),
|
|
532493
|
+
__param$2(2, commonExports.Inject(AuthService)),
|
|
532224
532494
|
__metadata$2("design:paramtypes", [AppService,
|
|
532225
|
-
LoggerService
|
|
532495
|
+
LoggerService,
|
|
532496
|
+
AuthService])
|
|
532226
532497
|
], AppDevCommand);
|
|
532227
532498
|
|
|
532228
532499
|
let AppDeployCommand = class AppDeployCommand extends src$6.CommandRunner {
|
|
532229
|
-
constructor(appService, logger) {
|
|
532500
|
+
constructor(appService, logger, auth) {
|
|
532230
532501
|
super();
|
|
532231
532502
|
this.appService = appService;
|
|
532232
532503
|
this.logger = logger;
|
|
532504
|
+
this.auth = auth;
|
|
532233
532505
|
}
|
|
532234
532506
|
async run() {
|
|
532235
532507
|
try {
|
|
532508
|
+
if (!(await this.auth.isAuthenticated())) {
|
|
532509
|
+
this.logger.error('auth', 'You must be logged in. Run: qumra user login');
|
|
532510
|
+
process.exit(1);
|
|
532511
|
+
}
|
|
532236
532512
|
await this.appService.deploy();
|
|
532237
532513
|
}
|
|
532238
532514
|
catch (error) {
|
|
@@ -532244,7 +532520,8 @@ let AppDeployCommand = class AppDeployCommand extends src$6.CommandRunner {
|
|
|
532244
532520
|
AppDeployCommand = __decorate$5([
|
|
532245
532521
|
src$6.SubCommand({ name: 'deploy', description: 'Deploy app to production' }),
|
|
532246
532522
|
__metadata$2("design:paramtypes", [AppService,
|
|
532247
|
-
LoggerService
|
|
532523
|
+
LoggerService,
|
|
532524
|
+
AuthService])
|
|
532248
532525
|
], AppDeployCommand);
|
|
532249
532526
|
|
|
532250
532527
|
let AppCommand = class AppCommand extends src$6.CommandRunner {
|
|
@@ -532295,12 +532572,12 @@ let GenerateService = class GenerateService {
|
|
|
532295
532572
|
}
|
|
532296
532573
|
async createWidget(widgetName) {
|
|
532297
532574
|
this.validateWidgetName(widgetName);
|
|
532298
|
-
const widgetsDir =
|
|
532299
|
-
const widgetDir =
|
|
532575
|
+
const widgetsDir = path__namespace.join(process.cwd(), 'widgets');
|
|
532576
|
+
const widgetDir = path__namespace.join(widgetsDir, widgetName);
|
|
532300
532577
|
if (fs__namespace.existsSync(widgetDir)) {
|
|
532301
532578
|
throw new Error(`Widget "${widgetName}" already exists`);
|
|
532302
532579
|
}
|
|
532303
|
-
const pagesDir =
|
|
532580
|
+
const pagesDir = path__namespace.join(process.cwd(), 'pages');
|
|
532304
532581
|
if (!fs__namespace.existsSync(pagesDir)) {
|
|
532305
532582
|
throw new Error('pages/ folder not found. Are you in a theme project?');
|
|
532306
532583
|
}
|
|
@@ -532320,10 +532597,10 @@ let GenerateService = class GenerateService {
|
|
|
532320
532597
|
// Create widget directory and files
|
|
532321
532598
|
fs__namespace.mkdirSync(widgetDir, { recursive: true });
|
|
532322
532599
|
const schema = { ...WIDGET_SCHEMA_TEMPLATE, name: widgetName };
|
|
532323
|
-
fs__namespace.writeFileSync(
|
|
532324
|
-
fs__namespace.writeFileSync(
|
|
532600
|
+
fs__namespace.writeFileSync(path__namespace.join(widgetDir, 'schema.json'), JSON.stringify(schema, null, 2));
|
|
532601
|
+
fs__namespace.writeFileSync(path__namespace.join(widgetDir, 'widget.njk'), WIDGET_TEMPLATE);
|
|
532325
532602
|
// Add widget to page
|
|
532326
|
-
const pagePath =
|
|
532603
|
+
const pagePath = path__namespace.join(pagesDir, selectedPage);
|
|
532327
532604
|
const pageContent = JSON.parse(fs__namespace.readFileSync(pagePath, 'utf-8'));
|
|
532328
532605
|
if (!Array.isArray(pageContent.widgets)) {
|
|
532329
532606
|
pageContent.widgets = [];
|
|
@@ -533659,7 +533936,7 @@ var doc = /*#__PURE__*/Object.freeze({
|
|
|
533659
533936
|
|
|
533660
533937
|
const require$1 = require$$1$6.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
533661
533938
|
const __filename$1 = require$$0$c.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
533662
|
-
|
|
533939
|
+
path$d.dirname(__filename$1);
|
|
533663
533940
|
|
|
533664
533941
|
var __create$3 = Object.create;
|
|
533665
533942
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -543836,8 +544113,8 @@ var URL_STRING_PREFIX = "file:";
|
|
|
543836
544113
|
var isUrlInstance = (value) => value instanceof URL;
|
|
543837
544114
|
var isUrlString = (value) => typeof value === "string" && value.startsWith(URL_STRING_PREFIX);
|
|
543838
544115
|
var isUrl = (urlOrPath) => isUrlInstance(urlOrPath) || isUrlString(urlOrPath);
|
|
543839
|
-
var toPath = (urlOrPath) => isUrl(urlOrPath) ? require$$0__namespace.fileURLToPath(urlOrPath) : urlOrPath;
|
|
543840
|
-
var toAbsolutePath = (urlOrPath) => urlOrPath ?
|
|
544116
|
+
var toPath = (urlOrPath) => isUrl(urlOrPath) ? require$$0__namespace$1.fileURLToPath(urlOrPath) : urlOrPath;
|
|
544117
|
+
var toAbsolutePath = (urlOrPath) => urlOrPath ? path__namespace.resolve(isUrl(urlOrPath) ? require$$0__namespace$1.fileURLToPath(urlOrPath) : urlOrPath) : urlOrPath;
|
|
543841
544118
|
|
|
543842
544119
|
// src/utils/partition.js
|
|
543843
544120
|
function partition2(array2, predicate) {
|
|
@@ -543857,7 +544134,7 @@ async function findInDirectory(nameOrNames, { typeCheck, cwd, allowSymlinks = tr
|
|
|
543857
544134
|
const directory = toAbsolutePath(cwd) ?? process4.cwd();
|
|
543858
544135
|
const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];
|
|
543859
544136
|
for (const name of names) {
|
|
543860
|
-
const fileOrDirectory =
|
|
544137
|
+
const fileOrDirectory = path__namespace.join(directory, name);
|
|
543861
544138
|
const stats = await safeStat(fileOrDirectory, allowSymlinks);
|
|
543862
544139
|
if (await typeCheck(stats) && (!filter2 || await filter2({ name, path: fileOrDirectory, stats }))) {
|
|
543863
544140
|
return fileOrDirectory;
|
|
@@ -543880,15 +544157,15 @@ function* iterateDirectoryUp(from, to) {
|
|
|
543880
544157
|
let directory = toAbsolutePath(from) ?? process4.cwd();
|
|
543881
544158
|
let stopDirectory = toAbsolutePath(to);
|
|
543882
544159
|
if (stopDirectory) {
|
|
543883
|
-
const relation =
|
|
544160
|
+
const relation = path__namespace.relative(stopDirectory, directory);
|
|
543884
544161
|
if (relation[0] === "." || relation === directory) {
|
|
543885
544162
|
return;
|
|
543886
544163
|
}
|
|
543887
544164
|
}
|
|
543888
|
-
stopDirectory = stopDirectory ? directory.slice(0, stopDirectory.length) :
|
|
544165
|
+
stopDirectory = stopDirectory ? directory.slice(0, stopDirectory.length) : path__namespace.parse(directory).root;
|
|
543889
544166
|
while (directory !== stopDirectory) {
|
|
543890
544167
|
yield directory;
|
|
543891
|
-
directory =
|
|
544168
|
+
directory = path__namespace.dirname(directory);
|
|
543892
544169
|
}
|
|
543893
544170
|
yield stopDirectory;
|
|
543894
544171
|
}
|
|
@@ -543972,7 +544249,7 @@ async function findProjectRoot(startDirectory, options8) {
|
|
|
543972
544249
|
const directory = await searcher.search(startDirectory, {
|
|
543973
544250
|
cache: options8.shouldCache
|
|
543974
544251
|
});
|
|
543975
|
-
return directory ?
|
|
544252
|
+
return directory ? path__namespace.dirname(directory) : void 0;
|
|
543976
544253
|
}
|
|
543977
544254
|
function clearFindProjectRootCache() {
|
|
543978
544255
|
searcher == null ? void 0 : searcher.clearCache();
|
|
@@ -544039,14 +544316,14 @@ function clearEditorconfigCache() {
|
|
|
544039
544316
|
editorconfigCache.clear();
|
|
544040
544317
|
}
|
|
544041
544318
|
async function loadEditorconfigInternal(file, { shouldCache }) {
|
|
544042
|
-
const directory =
|
|
544319
|
+
const directory = path$d.dirname(file);
|
|
544043
544320
|
const root2 = await findProjectRoot(directory, { shouldCache });
|
|
544044
544321
|
const editorConfig = await import_editorconfig.default.parse(file, { root: root2 });
|
|
544045
544322
|
const config = editorconfig_to_prettier_default(editorConfig);
|
|
544046
544323
|
return config;
|
|
544047
544324
|
}
|
|
544048
544325
|
function loadEditorconfig(file, { shouldCache }) {
|
|
544049
|
-
file =
|
|
544326
|
+
file = path$d.resolve(file);
|
|
544050
544327
|
if (!shouldCache || !editorconfigCache.has(file)) {
|
|
544051
544328
|
editorconfigCache.set(
|
|
544052
544329
|
file,
|
|
@@ -546248,7 +546525,7 @@ function read2(jsonPath, { base, specifier }) {
|
|
|
546248
546525
|
}
|
|
546249
546526
|
let string;
|
|
546250
546527
|
try {
|
|
546251
|
-
string = fs$i.readFileSync(
|
|
546528
|
+
string = fs$i.readFileSync(path$d.toNamespacedPath(jsonPath), "utf8");
|
|
546252
546529
|
} catch (error) {
|
|
546253
546530
|
const exception = (
|
|
546254
546531
|
/** @type {ErrnoException} */
|
|
@@ -546492,7 +546769,7 @@ Default "index" lookups for the main are deprecated for ES modules.`,
|
|
|
546492
546769
|
"DeprecationWarning",
|
|
546493
546770
|
"DEP0151"
|
|
546494
546771
|
);
|
|
546495
|
-
} else if (
|
|
546772
|
+
} else if (path$d.resolve(packagePath, main) !== urlPath) {
|
|
546496
546773
|
process4.emitWarning(
|
|
546497
546774
|
`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
|
|
546498
546775
|
packagePath.length
|
|
@@ -546599,7 +546876,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
|
546599
546876
|
{
|
|
546600
546877
|
const real = fs$i.realpathSync(filePath);
|
|
546601
546878
|
const { search, hash } = resolved;
|
|
546602
|
-
resolved = require$$0$c.pathToFileURL(real + (filePath.endsWith(
|
|
546879
|
+
resolved = require$$0$c.pathToFileURL(real + (filePath.endsWith(path$d.sep) ? "/" : ""));
|
|
546603
546880
|
resolved.search = search;
|
|
546604
546881
|
resolved.hash = hash;
|
|
546605
546882
|
}
|
|
@@ -547295,7 +547572,7 @@ var load_external_config_default = loadExternalConfig;
|
|
|
547295
547572
|
|
|
547296
547573
|
// src/config/prettier-config/load-config.js
|
|
547297
547574
|
async function loadConfig(configFile) {
|
|
547298
|
-
const { base: fileName, ext: extension } =
|
|
547575
|
+
const { base: fileName, ext: extension } = path$d.parse(configFile);
|
|
547299
547576
|
const load = fileName === "package.json" ? loadConfigFromPackageJson : fileName === "package.yaml" ? loadConfigFromPackageYaml : loaders_default[extension];
|
|
547300
547577
|
if (!load) {
|
|
547301
547578
|
throw new Error(
|
|
@@ -547327,14 +547604,14 @@ function clearPrettierConfigCache() {
|
|
|
547327
547604
|
searchCache.clear();
|
|
547328
547605
|
}
|
|
547329
547606
|
function loadPrettierConfig(configFile, { shouldCache }) {
|
|
547330
|
-
configFile =
|
|
547607
|
+
configFile = path$d.resolve(configFile);
|
|
547331
547608
|
if (!shouldCache || !loadCache.has(configFile)) {
|
|
547332
547609
|
loadCache.set(configFile, load_config_default(configFile));
|
|
547333
547610
|
}
|
|
547334
547611
|
return loadCache.get(configFile);
|
|
547335
547612
|
}
|
|
547336
547613
|
function getSearchFunction(stopDirectory) {
|
|
547337
|
-
stopDirectory = stopDirectory ?
|
|
547614
|
+
stopDirectory = stopDirectory ? path$d.resolve(stopDirectory) : void 0;
|
|
547338
547615
|
if (!searchCache.has(stopDirectory)) {
|
|
547339
547616
|
const searcher2 = config_searcher_default(stopDirectory);
|
|
547340
547617
|
const searchFunction = searcher2.search.bind(searcher2);
|
|
@@ -547343,7 +547620,7 @@ function getSearchFunction(stopDirectory) {
|
|
|
547343
547620
|
return searchCache.get(stopDirectory);
|
|
547344
547621
|
}
|
|
547345
547622
|
function searchPrettierConfig(startDirectory, options8 = {}) {
|
|
547346
|
-
startDirectory = startDirectory ?
|
|
547623
|
+
startDirectory = startDirectory ? path$d.resolve(startDirectory) : process.cwd();
|
|
547347
547624
|
const stopDirectory = mockable_default.getPrettierConfigSearchStopDirectory();
|
|
547348
547625
|
const search = getSearchFunction(stopDirectory);
|
|
547349
547626
|
return search(startDirectory, { cache: options8.shouldCache });
|
|
@@ -547365,7 +547642,7 @@ async function loadPrettierConfig2(file, options8) {
|
|
|
547365
547642
|
const shouldCache = options8.useCache;
|
|
547366
547643
|
let configFile = options8.config;
|
|
547367
547644
|
if (!configFile) {
|
|
547368
|
-
const directory = file ?
|
|
547645
|
+
const directory = file ? path$d.dirname(path$d.resolve(file)) : void 0;
|
|
547369
547646
|
configFile = await searchPrettierConfig(directory, { shouldCache });
|
|
547370
547647
|
}
|
|
547371
547648
|
if (!configFile) {
|
|
@@ -547391,13 +547668,13 @@ async function resolveConfig(fileUrlOrPath, options8) {
|
|
|
547391
547668
|
};
|
|
547392
547669
|
if (Array.isArray(merged.plugins)) {
|
|
547393
547670
|
merged.plugins = merged.plugins.map(
|
|
547394
|
-
(value) => typeof value === "string" && value.startsWith(".") ?
|
|
547671
|
+
(value) => typeof value === "string" && value.startsWith(".") ? path$d.resolve(path$d.dirname(result.configFile), value) : value
|
|
547395
547672
|
);
|
|
547396
547673
|
}
|
|
547397
547674
|
return merged;
|
|
547398
547675
|
}
|
|
547399
547676
|
async function resolveConfigFile(fileUrlOrPath) {
|
|
547400
|
-
const directory = fileUrlOrPath ?
|
|
547677
|
+
const directory = fileUrlOrPath ? path$d.dirname(path$d.resolve(toPath(fileUrlOrPath))) : void 0;
|
|
547401
547678
|
const result = await searchPrettierConfig(directory, { shouldCache: false });
|
|
547402
547679
|
return result ?? null;
|
|
547403
547680
|
}
|
|
@@ -547405,7 +547682,7 @@ function mergeOverrides(configResult, filePath) {
|
|
|
547405
547682
|
const { config, configFile } = configResult || {};
|
|
547406
547683
|
const { overrides, ...options8 } = config || {};
|
|
547407
547684
|
if (filePath && overrides) {
|
|
547408
|
-
const relativeFilePath =
|
|
547685
|
+
const relativeFilePath = path$d.relative(path$d.dirname(configFile), filePath);
|
|
547409
547686
|
for (const override of overrides) {
|
|
547410
547687
|
if (pathMatchesGlobs(
|
|
547411
547688
|
relativeFilePath,
|
|
@@ -552079,7 +552356,7 @@ function loadBuiltinPlugins() {
|
|
|
552079
552356
|
}
|
|
552080
552357
|
var load_builtin_plugins_default = loadBuiltinPlugins;
|
|
552081
552358
|
function importFromDirectory(specifier, directory) {
|
|
552082
|
-
return import_from_file_default(specifier,
|
|
552359
|
+
return import_from_file_default(specifier, path$d.join(directory, "noop.js"));
|
|
552083
552360
|
}
|
|
552084
552361
|
var import_from_directory_default = importFromDirectory;
|
|
552085
552362
|
|
|
@@ -552088,11 +552365,11 @@ async function importPlugin(name, cwd) {
|
|
|
552088
552365
|
if (isUrl(name)) {
|
|
552089
552366
|
return import(name);
|
|
552090
552367
|
}
|
|
552091
|
-
if (
|
|
552368
|
+
if (path$d.isAbsolute(name)) {
|
|
552092
552369
|
return import(require$$0$c.pathToFileURL(name).href);
|
|
552093
552370
|
}
|
|
552094
552371
|
try {
|
|
552095
|
-
return await import(require$$0$c.pathToFileURL(
|
|
552372
|
+
return await import(require$$0$c.pathToFileURL(path$d.resolve(name)).href);
|
|
552096
552373
|
} catch {
|
|
552097
552374
|
return import_from_directory_default(name, cwd);
|
|
552098
552375
|
}
|
|
@@ -552125,7 +552402,7 @@ var load_plugins_default = loadPlugins;
|
|
|
552125
552402
|
|
|
552126
552403
|
// src/utils/ignore.js
|
|
552127
552404
|
var import_ignore = __toESM$3(require_ignore());
|
|
552128
|
-
var slash =
|
|
552405
|
+
var slash = path$d.sep === "\\" ? (filePath) => string_replace_all_default(
|
|
552129
552406
|
/* isOptionalObject */
|
|
552130
552407
|
false,
|
|
552131
552408
|
filePath,
|
|
@@ -552134,11 +552411,11 @@ var slash = sysPath.sep === "\\" ? (filePath) => string_replace_all_default(
|
|
|
552134
552411
|
) : (filePath) => filePath;
|
|
552135
552412
|
function getRelativePath(file, ignoreFile) {
|
|
552136
552413
|
const ignoreFilePath = toPath(ignoreFile);
|
|
552137
|
-
const filePath = isUrl(file) ? require$$0$c.fileURLToPath(file) :
|
|
552138
|
-
return
|
|
552414
|
+
const filePath = isUrl(file) ? require$$0$c.fileURLToPath(file) : path$d.resolve(file);
|
|
552415
|
+
return path$d.relative(
|
|
552139
552416
|
// If there's an ignore-path set, the filename must be relative to the
|
|
552140
552417
|
// ignore path, not the current working directory.
|
|
552141
|
-
ignoreFilePath ?
|
|
552418
|
+
ignoreFilePath ? path$d.dirname(ignoreFilePath) : process.cwd(),
|
|
552142
552419
|
filePath
|
|
552143
552420
|
);
|
|
552144
552421
|
}
|