@pnpm/text.sanitize 1100.0.0
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/CHANGELOG.md +7 -0
- package/LICENSE +22 -0
- package/README.md +3 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +28 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @pnpm/text.sanitize
|
|
2
|
+
|
|
3
|
+
## 1100.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `pnpm stage approve` now approves several staged packages at once. Run it without a stage id to pick from the staged versions interactively, or pass a list of stage ids. The whole batch is approved with a single one-time password, and pnpm asks for a new one only once the registry stops accepting it. Inside a workspace, the selected packages are approved in dependency order, and a package whose workspace dependency could not be approved is skipped instead of being published against a dependency that never reached the registry.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
+
Copyright (c) 2016-2026 Zoltan Kochan and other contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips control and formatting characters from text embedded in a
|
|
3
|
+
* single-line field that reaches the terminal.
|
|
4
|
+
*
|
|
5
|
+
* Registry- and store-derived strings (package names, versions, tags,
|
|
6
|
+
* usernames) can carry escape sequences, bidi overrides, or zero-width
|
|
7
|
+
* joiners that make rendered output misrepresent what is installed or
|
|
8
|
+
* published, so every such string is filtered before it is printed.
|
|
9
|
+
*
|
|
10
|
+
* The TypeScript counterpart of the Rust `pnpm-text-sanitize` crate's
|
|
11
|
+
* `sanitize_inline`; the two strip the same characters.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeInline(text: string): string;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control and formatting characters {@link sanitizeInline} strips: C0/C1
|
|
3
|
+
* controls, soft hyphens, bidi overrides and isolates, zero-width joiners,
|
|
4
|
+
* and the other invisible formatting characters that can make a rendered
|
|
5
|
+
* line read as something else.
|
|
6
|
+
*
|
|
7
|
+
* Variation selectors are deliberately absent: they change how the character
|
|
8
|
+
* before them is drawn rather than where the rest of the line goes, and they
|
|
9
|
+
* are part of the emoji a package description may legitimately carry.
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line no-control-regex
|
|
12
|
+
const CONTROL_AND_FORMAT_CHARACTERS = /[\u0000-\u001F\u007F-\u009F\u00AD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB\u{110BD}\u{110CD}\u{13430}-\u{1343F}\u{1BCA0}-\u{1BCA3}\u{1D173}-\u{1D17A}\u{E0001}\u{E0020}-\u{E007F}]/gu;
|
|
13
|
+
/**
|
|
14
|
+
* Strips control and formatting characters from text embedded in a
|
|
15
|
+
* single-line field that reaches the terminal.
|
|
16
|
+
*
|
|
17
|
+
* Registry- and store-derived strings (package names, versions, tags,
|
|
18
|
+
* usernames) can carry escape sequences, bidi overrides, or zero-width
|
|
19
|
+
* joiners that make rendered output misrepresent what is installed or
|
|
20
|
+
* published, so every such string is filtered before it is printed.
|
|
21
|
+
*
|
|
22
|
+
* The TypeScript counterpart of the Rust `pnpm-text-sanitize` crate's
|
|
23
|
+
* `sanitize_inline`; the two strip the same characters.
|
|
24
|
+
*/
|
|
25
|
+
export function sanitizeInline(text) {
|
|
26
|
+
return text.replace(CONTROL_AND_FORMAT_CHARACTERS, '');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pnpm/text.sanitize",
|
|
3
|
+
"version": "1100.0.0",
|
|
4
|
+
"description": "Strips control and formatting characters from text that reaches the terminal",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pnpm",
|
|
7
|
+
"pnpm11",
|
|
8
|
+
"sanitize"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"funding": "https://opencollective.com/pnpm",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/text/sanitize"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/text/sanitize#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/pnpm/pnpm/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "lib/index.js",
|
|
22
|
+
"types": "lib/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./lib/index.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"lib",
|
|
28
|
+
"!*.map"
|
|
29
|
+
],
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@jest/globals": "30.4.1",
|
|
32
|
+
"@pnpm/text.sanitize": "1100.0.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22.13"
|
|
36
|
+
},
|
|
37
|
+
"jest": {
|
|
38
|
+
"preset": "@pnpm/jest-config"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
42
|
+
"test": "pn compile && pn .test",
|
|
43
|
+
"compile": "tsgo --build && pn lint --fix",
|
|
44
|
+
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
45
|
+
}
|
|
46
|
+
}
|