@diplodoc/cli 0.0.0-rc-remove-cli-tests-27946830449 → 0.0.0-rc-remove-cli-tests-27970657034
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/build/index.js
CHANGED
|
@@ -324605,7 +324605,7 @@ var import_config93 = require("@diplodoc/cli/lib/config");
|
|
|
324605
324605
|
|
|
324606
324606
|
// src/constants.ts
|
|
324607
324607
|
var import_node_path2 = require("node:path");
|
|
324608
|
-
var VERSION = "0.0.0-rc-remove-cli-tests-
|
|
324608
|
+
var VERSION = "0.0.0-rc-remove-cli-tests-27970657034" ? "0.0.0-rc-remove-cli-tests-27970657034" : "0.0.0";
|
|
324609
324609
|
var MAIN_TIMER_ID = "Build time";
|
|
324610
324610
|
var ASSETS_FOLDER = (0, import_node_path2.resolve)(__dirname, "../assets");
|
|
324611
324611
|
var BUNDLE_FOLDER = "_bundle";
|
|
@@ -374630,8 +374630,8 @@ var run = async (argv2) => {
|
|
|
374630
374630
|
if (import_node_worker_threads4.isMainThread && require.main === module) {
|
|
374631
374631
|
(async () => {
|
|
374632
374632
|
import_utils410.console.time(MAIN_TIMER_ID);
|
|
374633
|
-
if ("0.0.0-rc-remove-cli-tests-
|
|
374634
|
-
import_utils410.console.log(`Using v${"0.0.0-rc-remove-cli-tests-
|
|
374633
|
+
if ("0.0.0-rc-remove-cli-tests-27970657034") {
|
|
374634
|
+
import_utils410.console.log(`Using v${"0.0.0-rc-remove-cli-tests-27970657034"} version`);
|
|
374635
374635
|
}
|
|
374636
374636
|
const report = await run(process.argv);
|
|
374637
374637
|
import_utils410.console.timeEnd(MAIN_TIMER_ID);
|
package/build/index.mjs
CHANGED
|
@@ -324591,7 +324591,7 @@ import { Command as Command8 } from "@diplodoc/cli/lib/config";
|
|
|
324591
324591
|
|
|
324592
324592
|
// src/constants.ts
|
|
324593
324593
|
import { join, resolve as resolve2 } from "node:path";
|
|
324594
|
-
var VERSION = "0.0.0-rc-remove-cli-tests-
|
|
324594
|
+
var VERSION = "0.0.0-rc-remove-cli-tests-27970657034" ? "0.0.0-rc-remove-cli-tests-27970657034" : "0.0.0";
|
|
324595
324595
|
var MAIN_TIMER_ID = "Build time";
|
|
324596
324596
|
var ASSETS_FOLDER = resolve2(__dirname, "../assets");
|
|
324597
324597
|
var BUNDLE_FOLDER = "_bundle";
|
|
@@ -374654,8 +374654,8 @@ var run = async (argv2) => {
|
|
|
374654
374654
|
if (isMainThread4 && __require.main === module) {
|
|
374655
374655
|
(async () => {
|
|
374656
374656
|
console7.time(MAIN_TIMER_ID);
|
|
374657
|
-
if ("0.0.0-rc-remove-cli-tests-
|
|
374658
|
-
console7.log(`Using v${"0.0.0-rc-remove-cli-tests-
|
|
374657
|
+
if ("0.0.0-rc-remove-cli-tests-27970657034") {
|
|
374658
|
+
console7.log(`Using v${"0.0.0-rc-remove-cli-tests-27970657034"} version`);
|
|
374659
374659
|
}
|
|
374660
374660
|
const report = await run(process.argv);
|
|
374661
374661
|
console7.timeEnd(MAIN_TIMER_ID);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diplodoc/cli",
|
|
3
|
-
"version": "0.0.0-rc-remove-cli-tests-
|
|
3
|
+
"version": "0.0.0-rc-remove-cli-tests-27970657034",
|
|
4
4
|
"description": "Make documentation using yfm-docs in Markdown and HTML formats",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -109,6 +109,18 @@
|
|
|
109
109
|
"threads": "1.7.0",
|
|
110
110
|
"ts-dedent": "2.2.0"
|
|
111
111
|
},
|
|
112
|
+
"peerDependencies": {
|
|
113
|
+
"strip-ansi": "^7.1.0",
|
|
114
|
+
"vitest": "^3.2.1"
|
|
115
|
+
},
|
|
116
|
+
"peerDependenciesMeta": {
|
|
117
|
+
"strip-ansi": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
120
|
+
"vitest": {
|
|
121
|
+
"optional": true
|
|
122
|
+
}
|
|
123
|
+
},
|
|
112
124
|
"devDependencies": {
|
|
113
125
|
"@aws-sdk/client-s3": "^3.758.0",
|
|
114
126
|
"@aws-sdk/lib-storage": "^3.758.0",
|
package/tests/fixtures/file.ts
CHANGED
|
@@ -94,8 +94,10 @@ export async function compareDirectories(
|
|
|
94
94
|
// Here we sort the order of the included files after all processing
|
|
95
95
|
// This is necessary for better test stability
|
|
96
96
|
// We do not care in what order these files were received and processed
|
|
97
|
-
// We sort only the final list and put it in the snapshot
|
|
98
|
-
|
|
97
|
+
// We sort only the final list and put it in the snapshot.
|
|
98
|
+
// `bundleless` strips dynamic (numeric-id) client chunks → drop the now-empty
|
|
99
|
+
// entries so they don't appear in the file list snapshot.
|
|
100
|
+
filesForSnapshot = filesForSnapshot.map(bundleless).map(hashless).filter(Boolean).sort();
|
|
99
101
|
|
|
100
102
|
if (!ignoreFileList) {
|
|
101
103
|
expect(JSON.stringify(filesForSnapshot, null, 2)).toMatchSnapshot('filelist');
|
package/tests/fixtures/test.ts
CHANGED
|
@@ -43,11 +43,58 @@ export function hashless(text: string): string {
|
|
|
43
43
|
* "vendor-00121562c7b7d3b5.rtl.css" → "vendor-rtl-css",
|
|
44
44
|
* "976-40cbc1d2518eb8ea.js" → "chunk-js" (numeric webpack chunk ID).
|
|
45
45
|
*/
|
|
46
|
+
// Matches a dynamic client chunk reference: a numeric (webpack/rspack id) base
|
|
47
|
+
// with a content hash, e.g. `_bundle/572-d105b8fc819aff93.rtl.css`,
|
|
48
|
+
// `_bundle/189-ab12cd34ef56.js`.
|
|
49
|
+
const DYNAMIC_CHUNK = String.raw`_bundle\/\d+-[a-f0-9]{12,16}(?:\.[a-z0-9]+)*\.[a-z0-9]+`;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Removes dynamic (numeric-id) client chunks from both the file list and any
|
|
53
|
+
* references inside content.
|
|
54
|
+
*
|
|
55
|
+
* These chunks are an internal detail of the client bundler: their count,
|
|
56
|
+
* extensions and even existence change between `@diplodoc/client` releases
|
|
57
|
+
* (e.g. 5.7.11 → 5.7.13 added `572-*.css` / `572-*.rtl.css`). Asserting them
|
|
58
|
+
* makes snapshots depend on the exact client version, so a floating
|
|
59
|
+
* `npm install` (Arcadia) diverges from a locked `npm ci` (GitHub). Stripping
|
|
60
|
+
* them keeps snapshots stable across client patch releases while still
|
|
61
|
+
* asserting the named bundles (app/vendor/search/extensions).
|
|
62
|
+
*/
|
|
63
|
+
function stripDynamicChunks(text: string): string {
|
|
64
|
+
// Fast path. Besides being cheaper, this guard is essential: `bundleless` is
|
|
65
|
+
// also applied to binary asset content (fonts, images), and the punctuation
|
|
66
|
+
// cleanup below would otherwise corrupt random `,,`/`[,`/`,]` byte sequences.
|
|
67
|
+
// Binary content never contains a literal `_bundle/<id>-<hash>` reference.
|
|
68
|
+
if (!new RegExp(DYNAMIC_CHUNK).test(text)) {
|
|
69
|
+
return text;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// <script ... src="_bundle/572-hash.js"></script>
|
|
73
|
+
text = text.replace(
|
|
74
|
+
new RegExp(`<script\\b[^>]*?${DYNAMIC_CHUNK}[^>]*?>\\s*<\\/script>`, 'g'),
|
|
75
|
+
'',
|
|
76
|
+
);
|
|
77
|
+
// <link ... href="_bundle/572-hash.css" ...>
|
|
78
|
+
text = text.replace(new RegExp(`<link\\b[^>]*?${DYNAMIC_CHUNK}[^>]*?\\/?>`, 'g'), '');
|
|
79
|
+
// JSON/array string element: "_bundle/572-hash.css" (optionally escaped as \"...\").
|
|
80
|
+
text = text.replace(new RegExp(`\\\\?"${DYNAMIC_CHUNK}\\\\?",?`, 'g'), '');
|
|
81
|
+
// Any remaining bare reference (e.g. a file-list entry that is exactly the chunk).
|
|
82
|
+
text = text.replace(new RegExp(DYNAMIC_CHUNK, 'g'), '');
|
|
83
|
+
// Tidy up array punctuation left behind by removed elements.
|
|
84
|
+
return text
|
|
85
|
+
.replace(/\[\s*,/g, '[')
|
|
86
|
+
.replace(/,\s*\]/g, ']')
|
|
87
|
+
.replace(/,\s*,/g, ',');
|
|
88
|
+
}
|
|
89
|
+
|
|
46
90
|
export function bundleless(text: string): string {
|
|
47
91
|
// On Windows the CLI may emit `_bundle\file` or JSON-escaped `_bundle\\/file`.
|
|
48
92
|
// Collapse any mix of backslashes and forward slashes after `_bundle` into `/`.
|
|
49
93
|
text = text.replace(/_bundle[/\\]+/g, '_bundle/');
|
|
50
94
|
|
|
95
|
+
// Drop nondeterministic dynamic chunks before mapping named bundles.
|
|
96
|
+
text = stripDynamicChunks(text);
|
|
97
|
+
|
|
51
98
|
for (const entry of Object.values(assets)) {
|
|
52
99
|
for (const files of Object.values(entry)) {
|
|
53
100
|
for (const filename of files) {
|
|
@@ -57,9 +104,11 @@ export function bundleless(text: string): string {
|
|
|
57
104
|
if (!match) continue;
|
|
58
105
|
|
|
59
106
|
const [, rawBase, suffixes, ext] = match;
|
|
60
|
-
|
|
107
|
+
// Numeric (dynamic) chunks are handled by stripDynamicChunks above.
|
|
108
|
+
if (/^\d+$/.test(rawBase)) continue;
|
|
109
|
+
|
|
61
110
|
const suffixPart = suffixes.replace(/\./g, '-').slice(1); // ".rtl" → "rtl"
|
|
62
|
-
const label = suffixPart ? `${
|
|
111
|
+
const label = suffixPart ? `${rawBase}-${suffixPart}-${ext}` : `${rawBase}-${ext}`;
|
|
63
112
|
const escapedSuffixes = suffixes.replace(/\./g, '\\.');
|
|
64
113
|
const pattern = new RegExp(
|
|
65
114
|
`${rawBase}-[a-f0-9]{12,16}${escapedSuffixes}\\.${ext}`,
|