@lenne.tech/cli 1.41.0 → 1.41.1
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.
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.FrontendHelper = void 0;
|
|
13
13
|
const check_freshness_hooks_1 = require("../lib/check-freshness-hooks");
|
|
14
14
|
const markdown_table_1 = require("../lib/markdown-table");
|
|
15
|
+
const strip_comments_1 = require("../lib/strip-comments");
|
|
15
16
|
const vendor_claude_md_1 = require("../lib/vendor-claude-md");
|
|
16
17
|
/**
|
|
17
18
|
* Frontend helper functions for project scaffolding
|
|
@@ -813,7 +814,11 @@ class FrontendHelper {
|
|
|
813
814
|
for (const absFile of allFiles) {
|
|
814
815
|
if (skipPathContaining && absFile.includes(skipPathContaining))
|
|
815
816
|
continue;
|
|
816
|
-
|
|
817
|
+
// Strip comments first — a docblock that DOCUMENTS the conversion legitimately quotes the
|
|
818
|
+
// very import syntax this looks for, and would otherwise be reported as a file the user has
|
|
819
|
+
// to fix by hand. Same false-positive class that hit the backend detector on
|
|
820
|
+
// nest-server-starter's bootstrap-diagnostics.spec.ts.
|
|
821
|
+
const content = (0, strip_comments_1.stripComments)(filesystem.read(absFile) || '');
|
|
817
822
|
const matches = typeof needle === 'string' ? content.includes(needle) : needle.test(content);
|
|
818
823
|
if (matches) {
|
|
819
824
|
stale.push(absFile.replace(`${appDir}/`, ''));
|
|
@@ -48,6 +48,7 @@ const path_1 = require("path");
|
|
|
48
48
|
const ts = __importStar(require("typescript"));
|
|
49
49
|
const check_freshness_hooks_1 = require("../lib/check-freshness-hooks");
|
|
50
50
|
const markdown_table_1 = require("../lib/markdown-table");
|
|
51
|
+
const strip_comments_1 = require("../lib/strip-comments");
|
|
51
52
|
const vendor_claude_md_1 = require("../lib/vendor-claude-md");
|
|
52
53
|
/**
|
|
53
54
|
* Server helper functions
|
|
@@ -2494,7 +2495,14 @@ class Server {
|
|
|
2494
2495
|
recursive: true,
|
|
2495
2496
|
}) || [];
|
|
2496
2497
|
for (const file of files) {
|
|
2497
|
-
const
|
|
2498
|
+
const raw = this.filesystem.read(file) || '';
|
|
2499
|
+
// Strip comments before matching. The keyword-anchored pattern is not enough on its own:
|
|
2500
|
+
// a docblock that DOCUMENTS the conversion legitimately quotes the very syntax it looks
|
|
2501
|
+
// for — nest-server-starter's `tests/unit/bootstrap-diagnostics.spec.ts` contains
|
|
2502
|
+
// "rewrites `from '@lenne.tech/nest-server'` to a relative `./core` path", which matched
|
|
2503
|
+
// and told the user to rewrite imports that file does not have. A detector that reads
|
|
2504
|
+
// comments as code produces false alarms on exactly the files that explain it best.
|
|
2505
|
+
const content = (0, strip_comments_1.stripComments)(raw);
|
|
2498
2506
|
if (pattern ? pattern.test(content) : content.includes(needle)) {
|
|
2499
2507
|
stale.push(file.replace(`${dest}/`, ''));
|
|
2500
2508
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.stripComments = stripComments;
|
|
37
|
+
const ts = __importStar(require("typescript"));
|
|
38
|
+
/**
|
|
39
|
+
* Removes comments from TypeScript/JavaScript source, preserving everything else verbatim.
|
|
40
|
+
*
|
|
41
|
+
* Exists because detectors that search source for import specifiers must not read comments as
|
|
42
|
+
* code. A keyword-anchored regex is not sufficient on its own: a docblock that DOCUMENTS an import
|
|
43
|
+
* rewrite legitimately quotes the exact syntax the detector looks for. nest-server-starter's
|
|
44
|
+
* `tests/unit/bootstrap-diagnostics.spec.ts` contains
|
|
45
|
+
*
|
|
46
|
+
* * CLI's vendor conversion rewrites `from '@lenne.tech/nest-server'` to a relative `./core` path
|
|
47
|
+
*
|
|
48
|
+
* which matched `/(?:from|import|…)\s*['"]@lenne\.tech\/nest-server['"]/` and made
|
|
49
|
+
* `lt fullstack init --framework-mode vendor` warn about imports that file does not have.
|
|
50
|
+
*
|
|
51
|
+
* Uses the TypeScript scanner rather than a regex, so string literals, template literals and
|
|
52
|
+
* regex literals containing `//` or `/*` are handled correctly by construction — a hand-rolled
|
|
53
|
+
* stripper trips over `'https://…'` and over `/* ` inside a string.
|
|
54
|
+
*
|
|
55
|
+
* Comment characters are replaced with spaces instead of being deleted, so byte offsets and line
|
|
56
|
+
* numbers of the surrounding code stay unchanged — a caller can still report a meaningful
|
|
57
|
+
* position from a match.
|
|
58
|
+
*
|
|
59
|
+
* @param source - TypeScript or JavaScript source text
|
|
60
|
+
* @returns The source with every comment blanked out
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* stripComments("// from 'pkg'\nimport x from 'pkg';")
|
|
64
|
+
* // => " \nimport x from 'pkg';"
|
|
65
|
+
*/
|
|
66
|
+
function stripComments(source) {
|
|
67
|
+
const scanner = ts.createScanner(ts.ScriptTarget.Latest, /* skipTrivia */ false, ts.LanguageVariant.Standard, source);
|
|
68
|
+
let result = '';
|
|
69
|
+
let token = scanner.scan();
|
|
70
|
+
while (token !== ts.SyntaxKind.EndOfFileToken) {
|
|
71
|
+
const text = scanner.getTokenText();
|
|
72
|
+
const isComment = token === ts.SyntaxKind.SingleLineCommentTrivia || token === ts.SyntaxKind.MultiLineCommentTrivia;
|
|
73
|
+
// Keep newlines so line numbers survive; blank everything else in the comment.
|
|
74
|
+
result += isComment ? text.replace(/[^\n]/g, ' ') : text;
|
|
75
|
+
token = scanner.scan();
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/cli",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.1",
|
|
4
4
|
"description": "lenne.Tech CLI: lt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lenne.Tech",
|
|
@@ -100,10 +100,16 @@
|
|
|
100
100
|
"ts-jest": "29.4.11"
|
|
101
101
|
},
|
|
102
102
|
"//overrides": {
|
|
103
|
-
"semver@*": "Force latest semver 7.x across all sub-deps; gluegun@5.2.2 pins semver@7.7.0 which is stale - remove once gluegun updates its dep."
|
|
103
|
+
"semver@*": "Force latest semver 7.x across all sub-deps; gluegun@5.2.2 pins semver@7.7.0 which is stale - remove once gluegun updates its dep.",
|
|
104
|
+
"brace-expansion@<1.1.16": "DoS via exponential-time expansion of consecutive non-expanding {} groups (GHSA-3jxr-9vmj-r5cp, high). Transitive via dotgitignore/eslint/fs-jetpack/glob/test-exclude > minimatch. One bounded key per affected major so each can only raise a vulnerable version, never cap a patched one - remove once minimatch requests the patched ranges.",
|
|
105
|
+
"brace-expansion@>=2.0.0 <2.1.2": "Same advisory, 2.x line.",
|
|
106
|
+
"brace-expansion@>=5.0.0 <5.0.7": "Same advisory, 5.x line. Floored at >=5.0.0 so a future 3.x/4.x dependency is not silently forced across two majors."
|
|
104
107
|
},
|
|
105
108
|
"overrides": {
|
|
106
|
-
"semver@*": "7.8.5"
|
|
109
|
+
"semver@*": "7.8.5",
|
|
110
|
+
"brace-expansion@<1.1.16": "1.1.16",
|
|
111
|
+
"brace-expansion@>=2.0.0 <2.1.2": "2.1.2",
|
|
112
|
+
"brace-expansion@>=5.0.0 <5.0.7": "5.0.7"
|
|
107
113
|
},
|
|
108
114
|
"jest": {
|
|
109
115
|
"testEnvironment": "node",
|