@neat.is/core 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BI3XKGVG.js → chunk-GJHEZC5K.js} +56 -21
- package/dist/chunk-GJHEZC5K.js.map +1 -0
- package/dist/{chunk-DPEPI2N6.js → chunk-X2AMX3QZ.js} +32 -14
- package/dist/chunk-X2AMX3QZ.js.map +1 -0
- package/dist/cli.cjs +366 -120
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +250 -58
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +85 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +85 -32
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +55 -20
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-BI3XKGVG.js.map +0 -1
- package/dist/chunk-DPEPI2N6.js.map +0 -1
|
@@ -3990,14 +3990,21 @@ function engineFromImage(image) {
|
|
|
3990
3990
|
// src/extract/databases/dotenv.ts
|
|
3991
3991
|
var CONNECTION_KEYS = /* @__PURE__ */ new Set([
|
|
3992
3992
|
"DATABASE_URL",
|
|
3993
|
+
"DATABASE_URI",
|
|
3993
3994
|
"DB_URL",
|
|
3995
|
+
"DB_URI",
|
|
3994
3996
|
"POSTGRES_URL",
|
|
3997
|
+
"POSTGRES_URI",
|
|
3995
3998
|
"POSTGRESQL_URL",
|
|
3999
|
+
"POSTGRESQL_URI",
|
|
3996
4000
|
"MYSQL_URL",
|
|
4001
|
+
"MYSQL_URI",
|
|
4002
|
+
"MONGODB_URL",
|
|
3997
4003
|
"MONGODB_URI",
|
|
3998
4004
|
"MONGO_URL",
|
|
3999
4005
|
"MONGO_URI",
|
|
4000
|
-
"REDIS_URL"
|
|
4006
|
+
"REDIS_URL",
|
|
4007
|
+
"REDIS_URI"
|
|
4001
4008
|
]);
|
|
4002
4009
|
function parseDotenvLine(line) {
|
|
4003
4010
|
const trimmed = line.trim();
|
|
@@ -7910,11 +7917,42 @@ async function readPackageJson(scanPath) {
|
|
|
7910
7917
|
const raw = await fs27.readFile(pkgPath, "utf8");
|
|
7911
7918
|
return JSON.parse(raw);
|
|
7912
7919
|
}
|
|
7920
|
+
var HOOK_WALK_SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
7921
|
+
"node_modules",
|
|
7922
|
+
"dist",
|
|
7923
|
+
"build",
|
|
7924
|
+
"out",
|
|
7925
|
+
"coverage",
|
|
7926
|
+
"neat-out"
|
|
7927
|
+
]);
|
|
7913
7928
|
async function findHookFiles(scanPath) {
|
|
7914
|
-
const
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7929
|
+
const found = [];
|
|
7930
|
+
const walk3 = async (dir) => {
|
|
7931
|
+
const entries = await fs27.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
7932
|
+
for (const entry of entries) {
|
|
7933
|
+
if (entry.isDirectory()) {
|
|
7934
|
+
if (entry.name.startsWith(".") || HOOK_WALK_SKIP_DIRS.has(entry.name)) continue;
|
|
7935
|
+
await walk3(path45.join(dir, entry.name));
|
|
7936
|
+
} else if (entry.isFile()) {
|
|
7937
|
+
if ((entry.name.startsWith("instrumentation") || entry.name.startsWith("otel-init")) && /\.(ts|js|cjs|mjs)$/.test(entry.name)) {
|
|
7938
|
+
const rel = path45.relative(scanPath, path45.join(dir, entry.name));
|
|
7939
|
+
found.push(rel.split(path45.sep).join("/"));
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
};
|
|
7944
|
+
await walk3(scanPath);
|
|
7945
|
+
return found.sort();
|
|
7946
|
+
}
|
|
7947
|
+
async function pickPrimaryHookFile(scanPath, hookFiles, snippet2) {
|
|
7948
|
+
let fallback = null;
|
|
7949
|
+
for (const file of hookFiles) {
|
|
7950
|
+
const content = await fs27.readFile(path45.join(scanPath, file), "utf8");
|
|
7951
|
+
const patched = splicedContent(content, snippet2);
|
|
7952
|
+
if (patched !== null) return { file, content, patched };
|
|
7953
|
+
if (fallback === null) fallback = { file, content };
|
|
7954
|
+
}
|
|
7955
|
+
return { file: fallback.file, content: fallback.content, patched: null };
|
|
7918
7956
|
}
|
|
7919
7957
|
function extendLogPath() {
|
|
7920
7958
|
return process.env.NEAT_EXTEND_LOG ?? path45.join(os3.homedir(), ".neat", "extend-log.ndjson");
|
|
@@ -8007,7 +8045,13 @@ async function applyExtension(ctx, args, options) {
|
|
|
8007
8045
|
return { library: args.library, filesTouched: [], depsAdded: [], installOutput: "", alreadyApplied: true };
|
|
8008
8046
|
}
|
|
8009
8047
|
}
|
|
8010
|
-
const
|
|
8048
|
+
const primary = await pickPrimaryHookFile(ctx.scanPath, hookFiles, args.registration_snippet);
|
|
8049
|
+
if (primary.patched === null) {
|
|
8050
|
+
throw new Error(
|
|
8051
|
+
`Could not find instrumentation insertion point in ${hookFiles.join(", ")}. Expected __INSTRUMENTATION_BLOCK__, instrumentations.push(, or new NodeSDK(.`
|
|
8052
|
+
);
|
|
8053
|
+
}
|
|
8054
|
+
const primaryFile = primary.file;
|
|
8011
8055
|
const primaryPath = path45.join(ctx.scanPath, primaryFile);
|
|
8012
8056
|
const filesTouched = [];
|
|
8013
8057
|
const depsAdded = [];
|
|
@@ -8019,14 +8063,7 @@ async function applyExtension(ctx, args, options) {
|
|
|
8019
8063
|
filesTouched.push("package.json");
|
|
8020
8064
|
depsAdded.push(`${args.instrumentation_package}@${args.version}`);
|
|
8021
8065
|
}
|
|
8022
|
-
|
|
8023
|
-
const patched = splicedContent(hookContent, args.registration_snippet);
|
|
8024
|
-
if (!patched) {
|
|
8025
|
-
throw new Error(
|
|
8026
|
-
`Could not find instrumentation insertion point in ${primaryFile}. Expected __INSTRUMENTATION_BLOCK__, instrumentations.push(, or new NodeSDK(.`
|
|
8027
|
-
);
|
|
8028
|
-
}
|
|
8029
|
-
await fs27.writeFile(primaryPath, patched, "utf8");
|
|
8066
|
+
await fs27.writeFile(primaryPath, primary.patched, "utf8");
|
|
8030
8067
|
filesTouched.push(primaryFile);
|
|
8031
8068
|
const cmd = await detectPackageManager(ctx.scanPath);
|
|
8032
8069
|
const installer = options?.runInstall ?? runPackageManagerInstall;
|
|
@@ -8068,7 +8105,7 @@ async function dryRunExtension(ctx, args) {
|
|
|
8068
8105
|
};
|
|
8069
8106
|
}
|
|
8070
8107
|
}
|
|
8071
|
-
const
|
|
8108
|
+
const primary = await pickPrimaryHookFile(ctx.scanPath, hookFiles, args.registration_snippet);
|
|
8072
8109
|
const filesTouched = [];
|
|
8073
8110
|
const depsToAdd = [];
|
|
8074
8111
|
let packageJsonPatch = {};
|
|
@@ -8079,10 +8116,8 @@ async function dryRunExtension(ctx, args) {
|
|
|
8079
8116
|
depsToAdd.push(`${args.instrumentation_package}@${args.version}`);
|
|
8080
8117
|
filesTouched.push("package.json");
|
|
8081
8118
|
}
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
if (patched) {
|
|
8085
|
-
filesTouched.push(primaryFile);
|
|
8119
|
+
if (primary.patched !== null) {
|
|
8120
|
+
filesTouched.push(primary.file);
|
|
8086
8121
|
templatePatch = `+ ${args.registration_snippet}`;
|
|
8087
8122
|
} else {
|
|
8088
8123
|
templatePatch = "Could not find insertion point in hook file.";
|
|
@@ -9149,7 +9184,7 @@ function registerRoutes(scope, ctx) {
|
|
|
9149
9184
|
});
|
|
9150
9185
|
}
|
|
9151
9186
|
async function buildApi(opts) {
|
|
9152
|
-
const app = Fastify({ logger: false });
|
|
9187
|
+
const app = Fastify({ logger: false, routerOptions: { maxParamLength: 1024 } });
|
|
9153
9188
|
await app.register(cors, { origin: true });
|
|
9154
9189
|
const env = readAuthEnv();
|
|
9155
9190
|
const authToken = opts.authToken ?? env.authToken;
|
|
@@ -9361,4 +9396,4 @@ export {
|
|
|
9361
9396
|
recordConnectorPoll,
|
|
9362
9397
|
buildApi
|
|
9363
9398
|
};
|
|
9364
|
-
//# sourceMappingURL=chunk-
|
|
9399
|
+
//# sourceMappingURL=chunk-GJHEZC5K.js.map
|