@intrig/core 0.0.15-17 → 0.0.15-19
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/main.js +141 -30
- package/package.json +2 -39
package/main.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname } from 'path';
|
|
3
5
|
const require = createRequire(import.meta.url);
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
4
8
|
|
|
5
9
|
import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module";
|
|
6
10
|
/******/ var __webpack_modules__ = ([
|
|
@@ -2229,18 +2233,46 @@ function package_manager_service_ts_decorate(decorators, target, key, desc) {
|
|
|
2229
2233
|
|
|
2230
2234
|
|
|
2231
2235
|
|
|
2232
|
-
|
|
2236
|
+
|
|
2237
|
+
|
|
2233
2238
|
const execAsync = (0,external_util_.promisify)(external_child_process_.exec);
|
|
2239
|
+
/**
|
|
2240
|
+
* Detects the package manager by checking for lockfiles (bundleable replacement for 'nypm')
|
|
2241
|
+
*/ function detectPackageManager(cwd) {
|
|
2242
|
+
if ((0,external_fs_.existsSync)((0,external_path_.join)(cwd, 'bun.lockb'))) {
|
|
2243
|
+
return {
|
|
2244
|
+
name: 'bun'
|
|
2245
|
+
};
|
|
2246
|
+
}
|
|
2247
|
+
if ((0,external_fs_.existsSync)((0,external_path_.join)(cwd, 'pnpm-lock.yaml'))) {
|
|
2248
|
+
return {
|
|
2249
|
+
name: 'pnpm'
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
if ((0,external_fs_.existsSync)((0,external_path_.join)(cwd, 'yarn.lock'))) {
|
|
2253
|
+
return {
|
|
2254
|
+
name: 'yarn'
|
|
2255
|
+
};
|
|
2256
|
+
}
|
|
2257
|
+
if ((0,external_fs_.existsSync)((0,external_path_.join)(cwd, 'deno.lock'))) {
|
|
2258
|
+
return {
|
|
2259
|
+
name: 'deno'
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
// Default to npm (package-lock.json or no lockfile)
|
|
2263
|
+
return {
|
|
2264
|
+
name: 'npm'
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2234
2267
|
class PackageManagerService {
|
|
2235
|
-
/** Detect (and cache) the project
|
|
2268
|
+
/** Detect (and cache) the project's package manager */ async getPM() {
|
|
2236
2269
|
if (!this.pm) {
|
|
2237
|
-
const
|
|
2238
|
-
const detectedPM = await detectPackageManager(process.cwd());
|
|
2270
|
+
const detectedPM = detectPackageManager(process.cwd());
|
|
2239
2271
|
if (!detectedPM) {
|
|
2240
2272
|
throw new Error('Failed to detect package manager');
|
|
2241
2273
|
}
|
|
2242
2274
|
this.pm = detectedPM;
|
|
2243
|
-
this.logger.log(`Detected package manager: ${this.pm.name}
|
|
2275
|
+
this.logger.log(`Detected package manager: ${this.pm.name}`);
|
|
2244
2276
|
}
|
|
2245
2277
|
if (!this.pm) {
|
|
2246
2278
|
throw new Error('Failed to detect package manager');
|
|
@@ -16009,6 +16041,7 @@ SearchCommand = search_command_ts_decorate([
|
|
|
16009
16041
|
|
|
16010
16042
|
// EXTERNAL MODULE: ../../node_modules/express/index.js
|
|
16011
16043
|
var express = __webpack_require__(796);
|
|
16044
|
+
var express_default = /*#__PURE__*/__webpack_require__.n(express);
|
|
16012
16045
|
;// ../../node_modules/raw-loader/dist/cjs.js!../../dist/app/insight/index.html?raw
|
|
16013
16046
|
/* harmony default export */ const insightraw = ("<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Insight</title>\n <base href=\"/\" />\n\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\" />\n <script type=\"module\" crossorigin src=\"/assets/index.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"/assets/index.css\">\n </head>\n <body>\n <div id=\"root\"></div>\n </body>\n</html>\n");
|
|
16014
16047
|
;// ../../node_modules/raw-loader/dist/cjs.js!../../dist/app/insight/assets/index.css?raw
|
|
@@ -16059,11 +16092,35 @@ function insight_command_ts_metadata(k, v) {
|
|
|
16059
16092
|
|
|
16060
16093
|
|
|
16061
16094
|
|
|
16062
|
-
// import open from 'open'
|
|
16063
16095
|
|
|
16064
16096
|
|
|
16065
16097
|
|
|
16066
16098
|
|
|
16099
|
+
|
|
16100
|
+
|
|
16101
|
+
/**
|
|
16102
|
+
* Opens a URL in the default browser (bundleable replacement for 'open' package)
|
|
16103
|
+
*/ function openUrl(url) {
|
|
16104
|
+
return new Promise((resolve, reject)=>{
|
|
16105
|
+
let cmd;
|
|
16106
|
+
const os = (0,external_os_.platform)();
|
|
16107
|
+
if (os === 'darwin') {
|
|
16108
|
+
cmd = `open "${url}"`;
|
|
16109
|
+
} else if (os === 'win32') {
|
|
16110
|
+
cmd = `start "" "${url}"`;
|
|
16111
|
+
} else {
|
|
16112
|
+
// Linux and others
|
|
16113
|
+
cmd = `xdg-open "${url}"`;
|
|
16114
|
+
}
|
|
16115
|
+
(0,external_child_process_.exec)(cmd, (err)=>{
|
|
16116
|
+
if (err) {
|
|
16117
|
+
reject(err);
|
|
16118
|
+
} else {
|
|
16119
|
+
resolve();
|
|
16120
|
+
}
|
|
16121
|
+
});
|
|
16122
|
+
});
|
|
16123
|
+
}
|
|
16067
16124
|
const INTRIG_INSIGHT = ` ${source_default().bold.yellow('INTRIG INSIGHT')} `;
|
|
16068
16125
|
const SOCIAL_NUMBERS = [
|
|
16069
16126
|
12496,
|
|
@@ -16089,7 +16146,7 @@ class InsightCommand extends src.CommandRunner {
|
|
|
16089
16146
|
}
|
|
16090
16147
|
async run(passedParams, options) {
|
|
16091
16148
|
await this.validateMetadata();
|
|
16092
|
-
const app =
|
|
16149
|
+
const app = express_default()();
|
|
16093
16150
|
// Get the port from options or find an available one
|
|
16094
16151
|
const port = await this.findAvailablePort(options?.port);
|
|
16095
16152
|
// Load insight assets
|
|
@@ -16120,8 +16177,8 @@ class InsightCommand extends src.CommandRunner {
|
|
|
16120
16177
|
res.send(insightAssets.favicon);
|
|
16121
16178
|
});
|
|
16122
16179
|
// API route - parse JSON body
|
|
16123
|
-
app.use(
|
|
16124
|
-
app.use(
|
|
16180
|
+
app.use(express_default().json());
|
|
16181
|
+
app.use(express_default().urlencoded({
|
|
16125
16182
|
extended: true
|
|
16126
16183
|
}));
|
|
16127
16184
|
app.use('/api', async (req, res)=>await this.handleApiRequests(req, res));
|
|
@@ -16155,8 +16212,7 @@ class InsightCommand extends src.CommandRunner {
|
|
|
16155
16212
|
process.on('SIGTERM', ()=>this.shutdown());
|
|
16156
16213
|
// Only open the browser if the silent flag is not set
|
|
16157
16214
|
if (!options?.silent) {
|
|
16158
|
-
|
|
16159
|
-
await open(`http://localhost:${port}`);
|
|
16215
|
+
await openUrl(`http://localhost:${port}`);
|
|
16160
16216
|
}
|
|
16161
16217
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
16162
16218
|
return new Promise(()=>{});
|
|
@@ -17134,9 +17190,31 @@ function last_visit_service_ts_metadata(k, v) {
|
|
|
17134
17190
|
|
|
17135
17191
|
|
|
17136
17192
|
|
|
17137
|
-
// import { Low } from 'lowdb';
|
|
17138
|
-
// import { JSONFile } from 'lowdb/node';
|
|
17139
17193
|
|
|
17194
|
+
/**
|
|
17195
|
+
* Simple JSON file database (bundleable replacement for 'lowdb')
|
|
17196
|
+
*/ let JsonFileDB = class JsonFileDB {
|
|
17197
|
+
constructor(filePath, defaultData){
|
|
17198
|
+
this.filePath = filePath;
|
|
17199
|
+
this.defaultData = defaultData;
|
|
17200
|
+
this.data = defaultData;
|
|
17201
|
+
}
|
|
17202
|
+
async read() {
|
|
17203
|
+
try {
|
|
17204
|
+
if ((0,lib.existsSync)(this.filePath)) {
|
|
17205
|
+
const content = (0,lib.readFileSync)(this.filePath, 'utf8');
|
|
17206
|
+
this.data = JSON.parse(content);
|
|
17207
|
+
} else {
|
|
17208
|
+
this.data = this.defaultData;
|
|
17209
|
+
}
|
|
17210
|
+
} catch {
|
|
17211
|
+
this.data = this.defaultData;
|
|
17212
|
+
}
|
|
17213
|
+
}
|
|
17214
|
+
async write() {
|
|
17215
|
+
(0,lib.writeFileSync)(this.filePath, JSON.stringify(this.data, null, 2), 'utf8');
|
|
17216
|
+
}
|
|
17217
|
+
};
|
|
17140
17218
|
class LastVisitService {
|
|
17141
17219
|
constructor(configService){
|
|
17142
17220
|
this.configService = configService;
|
|
@@ -17147,17 +17225,15 @@ class LastVisitService {
|
|
|
17147
17225
|
this.dbFile = (0,external_path_.join)(this.configDir, 'last-visit.json');
|
|
17148
17226
|
// Ensure the config directory exists
|
|
17149
17227
|
(0,lib.ensureDirSync)(this.configDir);
|
|
17228
|
+
// Initialize the database
|
|
17229
|
+
this.db = new JsonFileDB(this.dbFile, {
|
|
17230
|
+
items: [],
|
|
17231
|
+
pinnedItems: []
|
|
17232
|
+
});
|
|
17150
17233
|
// Load the database
|
|
17151
17234
|
this.loadDb().catch((e)=>console.error('Failed to load last visit database', e));
|
|
17152
17235
|
}
|
|
17153
17236
|
async loadDb() {
|
|
17154
|
-
const { JSONFile } = await import(/* webpackIgnore: true */ 'lowdb/node');
|
|
17155
|
-
const adapter = new JSONFile(this.dbFile);
|
|
17156
|
-
const { Low } = await import(/* webpackIgnore: true */ 'lowdb');
|
|
17157
|
-
this.db = new Low(adapter, {
|
|
17158
|
-
items: [],
|
|
17159
|
-
pinnedItems: []
|
|
17160
|
-
});
|
|
17161
17237
|
try {
|
|
17162
17238
|
await this.db.read();
|
|
17163
17239
|
// Initialize if data is null
|
|
@@ -19109,17 +19185,52 @@ class InitCommand extends src.CommandRunner {
|
|
|
19109
19185
|
cwd: rootDir,
|
|
19110
19186
|
stdio: 'pipe'
|
|
19111
19187
|
});
|
|
19112
|
-
installSpinner.
|
|
19113
|
-
// Install @intrig/core as a dev dependency
|
|
19114
|
-
execSync('npm install --save-dev @intrig/core', {
|
|
19115
|
-
cwd: rootDir,
|
|
19116
|
-
stdio: 'pipe'
|
|
19117
|
-
});
|
|
19118
|
-
installSpinner.succeed(`Plugin ${plugin.name} and @intrig/core installed successfully`);
|
|
19188
|
+
installSpinner.succeed(`Plugin ${plugin.name} installed successfully`);
|
|
19119
19189
|
} catch (npmError) {
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19190
|
+
const errorMessage = npmError?.stderr?.toString() || npmError?.message || '';
|
|
19191
|
+
// Check if this is a peer dependency conflict (ERESOLVE error)
|
|
19192
|
+
if (errorMessage.includes('ERESOLVE') || errorMessage.includes('--legacy-peer-deps')) {
|
|
19193
|
+
installSpinner.warn(`Peer dependency conflict detected while installing ${plugin.name}`);
|
|
19194
|
+
console.log(source_default().yellow('\n⚠️ This is usually caused by conflicting package versions in your project.'));
|
|
19195
|
+
console.log(source_default().yellow(' Using --legacy-peer-deps may resolve this, but could cause runtime issues.\n'));
|
|
19196
|
+
let shouldRetry = skipPrompts; // Auto-accept if --yes flag is set
|
|
19197
|
+
if (!skipPrompts) {
|
|
19198
|
+
const { confirmRetry } = await inquirer_dist_esm.prompt([
|
|
19199
|
+
{
|
|
19200
|
+
type: 'confirm',
|
|
19201
|
+
name: 'confirmRetry',
|
|
19202
|
+
message: 'Retry with --legacy-peer-deps?',
|
|
19203
|
+
default: false
|
|
19204
|
+
}
|
|
19205
|
+
]);
|
|
19206
|
+
shouldRetry = confirmRetry;
|
|
19207
|
+
} else {
|
|
19208
|
+
console.log(source_default().blue('ℹ️ --yes flag set, automatically retrying with --legacy-peer-deps'));
|
|
19209
|
+
}
|
|
19210
|
+
if (shouldRetry) {
|
|
19211
|
+
const retrySpinner = ora_default()(`Retrying installation with --legacy-peer-deps...`).start();
|
|
19212
|
+
try {
|
|
19213
|
+
execSync(`npm install --save-dev ${plugin.name} --legacy-peer-deps`, {
|
|
19214
|
+
cwd: rootDir,
|
|
19215
|
+
stdio: 'pipe'
|
|
19216
|
+
});
|
|
19217
|
+
retrySpinner.succeed(`Plugin ${plugin.name} installed successfully (with --legacy-peer-deps)`);
|
|
19218
|
+
console.log(source_default().yellow('⚠️ Note: Installed with --legacy-peer-deps. Verify your application works correctly.'));
|
|
19219
|
+
} catch (retryError) {
|
|
19220
|
+
retrySpinner.fail(`Failed to install plugin ${plugin.name} even with --legacy-peer-deps`);
|
|
19221
|
+
throw new Error(`Failed to install plugin ${plugin.name}: ${retryError?.message}`);
|
|
19222
|
+
}
|
|
19223
|
+
} else {
|
|
19224
|
+
console.log(source_default().blue('\nℹ️ Installation cancelled. To resolve manually:'));
|
|
19225
|
+
console.log(source_default().blue(' 1. Fix the conflicting dependencies in your project, or'));
|
|
19226
|
+
console.log(source_default().blue(` 2. Run: npm install --save-dev ${plugin.name} --legacy-peer-deps\n`));
|
|
19227
|
+
throw new Error(`Installation cancelled due to peer dependency conflict`);
|
|
19228
|
+
}
|
|
19229
|
+
} else {
|
|
19230
|
+
installSpinner.fail(`Failed to install plugin ${plugin.name}`);
|
|
19231
|
+
console.log(source_default().red('❌ Error:'), npmError?.message);
|
|
19232
|
+
throw new Error(`Failed to install plugin ${plugin.name}: ${npmError?.message}`);
|
|
19233
|
+
}
|
|
19123
19234
|
}
|
|
19124
19235
|
// Now use createRequire to load the plugin
|
|
19125
19236
|
const loadSpinner = ora_default()(`Loading and initializing plugin: ${plugin.name}`).start();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intrig/core",
|
|
3
|
-
"version": "0.0.15-
|
|
3
|
+
"version": "0.0.15-19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,42 +9,5 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@apidevtools/json-schema-ref-parser": "12.0.2",
|
|
14
|
-
"@nestjs/axios": "4.0.1",
|
|
15
|
-
"@nestjs/common": "10.4.20",
|
|
16
|
-
"@nestjs/config": "4.0.2",
|
|
17
|
-
"@nestjs/core": "10.4.20",
|
|
18
|
-
"@nestjs/platform-express": "10.4.20",
|
|
19
|
-
"@nestjs/swagger": "8.1.1",
|
|
20
|
-
"axios": "1.11.0",
|
|
21
|
-
"chalk": "4.1.2",
|
|
22
|
-
"class-transformer": "0.5.1",
|
|
23
|
-
"class-validator": "0.14.2",
|
|
24
|
-
"cross-spawn": "^7.0.6",
|
|
25
|
-
"eventsource-parser": "3.0.5",
|
|
26
|
-
"express": "4.21.2",
|
|
27
|
-
"fs-extra": "11.3.1",
|
|
28
|
-
"immer": "10.1.1",
|
|
29
|
-
"inquirer": "12.9.3",
|
|
30
|
-
"js-yaml": "4.1.0",
|
|
31
|
-
"json-schema": "0.4.0",
|
|
32
|
-
"lodash": "4.17.21",
|
|
33
|
-
"lowdb": "7.0.1",
|
|
34
|
-
"minisearch": "7.1.2",
|
|
35
|
-
"nest-commander": "3.19.0",
|
|
36
|
-
"nypm": "0.6.1",
|
|
37
|
-
"open": "10.2.0",
|
|
38
|
-
"openapi-types": "12.1.3",
|
|
39
|
-
"ora": "5.4.1",
|
|
40
|
-
"prettier": "3.6.2",
|
|
41
|
-
"proper-lockfile": "4.1.2",
|
|
42
|
-
"reflect-metadata": "0.1.14",
|
|
43
|
-
"rxjs": "7.8.2",
|
|
44
|
-
"schinquirer": "0.3.2",
|
|
45
|
-
"semver": "6.3.1",
|
|
46
|
-
"tcp-port-used": "1.0.2",
|
|
47
|
-
"webpack": "5.101.3"
|
|
48
|
-
},
|
|
49
|
-
"main": "main.js"
|
|
12
|
+
"dependencies": {}
|
|
50
13
|
}
|