view-ignored 0.3.2 → 0.4.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.
- package/LICENSE.txt +21 -21
- package/README.md +95 -95
- package/bin/viewig +1 -1
- package/out/{src/browser → browser}/binds/index.d.ts +0 -19
- package/out/{src/browser → browser}/binds/index.js +2 -9
- package/out/browser/binds/plugins/git.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/git.js +7 -7
- package/out/browser/binds/plugins/npm.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/npm.js +8 -8
- package/out/browser/binds/plugins/vsce.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/vsce.js +5 -5
- package/out/browser/binds/plugins/yarn.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/yarn.js +3 -4
- package/out/{src/browser → browser}/binds/scanner.d.ts +0 -12
- package/out/{src/browser → browser}/binds/scanner.js +1 -7
- package/out/{src/browser → browser}/binds/targets.d.ts +2 -13
- package/out/{src/browser → browser}/binds/targets.js +2 -7
- package/out/{src/browser → browser}/errors.d.ts +0 -15
- package/out/{src/browser → browser}/errors.js +0 -15
- package/out/{src/browser → browser}/filtering.d.ts +0 -3
- package/out/{src/browser → browser}/filtering.js +0 -2
- package/out/{src/browser → browser}/fs/directory.d.ts +3 -56
- package/out/{src/browser → browser}/fs/directory.js +3 -6
- package/out/{src/browser → browser}/fs/file-info.d.ts +0 -5
- package/out/{src/browser → browser}/fs/file-info.js +13 -10
- package/out/{src/browser → browser}/fs/file.d.ts +0 -3
- package/out/{src/browser → browser}/fs/file.js +0 -3
- package/out/{src/browser → browser}/fs/source-info.d.ts +0 -1
- package/out/{src/browser → browser}/fs/source-info.js +0 -1
- package/out/{src/browser → browser}/lib.d.ts +1 -12
- package/out/{src/browser → browser}/lib.js +2 -5
- package/out/{src/browser → browser}/sorting.d.ts +0 -10
- package/out/{src/browser → browser}/sorting.js +0 -8
- package/out/{src/browser → browser}/styling.d.ts +0 -14
- package/out/{src/browser → browser}/styling.js +0 -7
- package/out/{src/cli.d.ts → cli.d.ts} +0 -47
- package/out/{src/cli.js → cli.js} +13 -45
- package/out/{src/config.d.ts → config.d.ts} +0 -57
- package/out/{src/config.js → config.js} +23 -50
- package/out/{src/errors.d.ts → errors.d.ts} +0 -1
- package/out/{src/styling.d.ts → styling.d.ts} +0 -6
- package/out/{src/styling.js → styling.js} +0 -6
- package/package.json +39 -47
- package/out/package.json +0 -122
- package/out/src/browser/binds/plugins/git.d.ts +0 -22
- package/out/src/browser/binds/plugins/npm.d.ts +0 -38
- package/out/src/browser/binds/plugins/vsce.d.ts +0 -25
- package/out/src/browser/binds/plugins/yarn.d.ts +0 -11
- /package/out/{src/browser → browser}/fs/index.d.ts +0 -0
- /package/out/{src/browser → browser}/fs/index.js +0 -0
- /package/out/{src/browser → browser}/index.d.ts +0 -0
- /package/out/{src/browser → browser}/index.js +0 -0
- /package/out/{src/errors.js → errors.js} +0 -0
- /package/out/{src/index.d.ts → index.d.ts} +0 -0
- /package/out/{src/index.js → index.js} +0 -0
- /package/out/{src/lib.d.ts → lib.d.ts} +0 -0
- /package/out/{src/lib.js → lib.js} +0 -0
package/LICENSE.txt
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Mopsgamer
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mopsgamer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
# view-ignored
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/view-ignored)
|
|
4
|
-
[](https://www.npmjs.com/package/view-ignored)
|
|
5
|
-
[](https://github.com/Mopsgamer/view-ignored)
|
|
6
|
-
[](https://github.com/Mopsgamer/view-ignored/issues)
|
|
7
|
-
|
|
8
|
-
Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.
|
|
9
|
-
|
|
10
|
-
## Highlights
|
|
11
|
-
|
|
12
|
-
- **Multi-target.** Get list of included files, using configuration files reader, not command-line wrapper.
|
|
13
|
-
- **Use in browser.** view-ignored supports file system adapter.
|
|
14
|
-
- **Command-line.** Supports no-color and multiple output styles, including [nerd fonts](https://github.com/ryanoasis/nerd-fonts).
|
|
15
|
-
- **Plugins.** view-ignored allows you to add new [targets](#targets) programmatically. Command-line interface supports plugins throught `--plugin` option.
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm i view-ignored
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### Command-line
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# get started
|
|
29
|
-
npm i -g view-ignored
|
|
30
|
-
viewig --help
|
|
31
|
-
view-ignored --help
|
|
32
|
-
|
|
33
|
-
# scan: git (default) and npm
|
|
34
|
-
viewig scan .
|
|
35
|
-
viewig scan . --target=npm
|
|
36
|
-
viewig scan . --parsable
|
|
37
|
-
|
|
38
|
-
# scan: plugins (space, comma or pipe separated)
|
|
39
|
-
# all built-in plugins loaded automatically
|
|
40
|
-
viewig scan . --plugins="example1, example2"
|
|
41
|
-
viewig scan . --plugins="example1 example2"
|
|
42
|
-
viewig scan . --plugins example1 example2
|
|
43
|
-
viewig scan . --plugins example1, example2
|
|
44
|
-
|
|
45
|
-
# config: print configuration entries
|
|
46
|
-
viewig config get
|
|
47
|
-
viewig config get --real
|
|
48
|
-
# config: set npm as default target and scan for npm
|
|
49
|
-
viewig config set target=npm
|
|
50
|
-
viewig scan .
|
|
51
|
-
# config: always use nerdfonts
|
|
52
|
-
viewig config set style=tree
|
|
53
|
-
# config: always use nerdfonts
|
|
54
|
-
viewig config set decor=nerdfonts
|
|
55
|
-
# config: always use plugins
|
|
56
|
-
viewig config set plugins=example1,example2
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Programmatically
|
|
60
|
-
|
|
61
|
-
All you need it to add
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
import * as vign from "view-ignored"; // or "view-ignored/browser"
|
|
65
|
-
|
|
66
|
-
await vign.Plugins.loadBuiltIns(["git", "npm"]); // load built-in plugins
|
|
67
|
-
await vign.Plugins.loadBuiltIns(); // load all built-in plugins
|
|
68
|
-
await vign.Plugins.loadPlugins(["example"]); // load third-party plugins
|
|
69
|
-
|
|
70
|
-
// scan - options available
|
|
71
|
-
const fileInfoList = await vign.scan(".", { target: "git", cwd: process.cwd() });
|
|
72
|
-
const fileInfoList = await vign.scan(["./path/to/file"], { target: "git", process.cwd() });
|
|
73
|
-
|
|
74
|
-
// use results
|
|
75
|
-
if (fileInfo.ignored) {
|
|
76
|
-
superCodeEditor.explorer.colorFile(fileInfo.relativePath, "gray");
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### Sorting
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
const sorter = vign.Sorting.firstFolders;
|
|
84
|
-
const fileInfoList = await vign.scan(".", {target: "npm"});
|
|
85
|
-
const fileInfoSorted = fileInfoList.sort((a, b) => sorter(String(a), String(b)));
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Targets
|
|
89
|
-
|
|
90
|
-
- `git`
|
|
91
|
-
- `npm` (use it for PNPM and Bun)
|
|
92
|
-
- `yarn`
|
|
93
|
-
- `vsce`
|
|
94
|
-
- `jsr` *planned*
|
|
95
|
-
- `deno` *planned*
|
|
1
|
+
# view-ignored
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/view-ignored)
|
|
4
|
+
[](https://www.npmjs.com/package/view-ignored)
|
|
5
|
+
[](https://github.com/Mopsgamer/view-ignored)
|
|
6
|
+
[](https://github.com/Mopsgamer/view-ignored/issues)
|
|
7
|
+
|
|
8
|
+
Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.
|
|
9
|
+
|
|
10
|
+
## Highlights
|
|
11
|
+
|
|
12
|
+
- **Multi-target.** Get list of included files, using configuration files reader, not command-line wrapper.
|
|
13
|
+
- **Use in browser.** view-ignored supports file system adapter.
|
|
14
|
+
- **Command-line.** Supports no-color and multiple output styles, including [nerd fonts](https://github.com/ryanoasis/nerd-fonts).
|
|
15
|
+
- **Plugins.** view-ignored allows you to add new [targets](#targets) programmatically. Command-line interface supports plugins throught `--plugin` option.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i view-ignored
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Command-line
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# get started
|
|
29
|
+
npm i -g view-ignored
|
|
30
|
+
viewig --help
|
|
31
|
+
view-ignored --help
|
|
32
|
+
|
|
33
|
+
# scan: git (default) and npm
|
|
34
|
+
viewig scan .
|
|
35
|
+
viewig scan . --target=npm
|
|
36
|
+
viewig scan . --parsable
|
|
37
|
+
|
|
38
|
+
# scan: plugins (space, comma or pipe separated)
|
|
39
|
+
# all built-in plugins loaded automatically
|
|
40
|
+
viewig scan . --plugins="example1, example2"
|
|
41
|
+
viewig scan . --plugins="example1 example2"
|
|
42
|
+
viewig scan . --plugins example1 example2
|
|
43
|
+
viewig scan . --plugins example1, example2
|
|
44
|
+
|
|
45
|
+
# config: print configuration entries
|
|
46
|
+
viewig config get
|
|
47
|
+
viewig config get --real
|
|
48
|
+
# config: set npm as default target and scan for npm
|
|
49
|
+
viewig config set target=npm
|
|
50
|
+
viewig scan .
|
|
51
|
+
# config: always use nerdfonts
|
|
52
|
+
viewig config set style=tree
|
|
53
|
+
# config: always use nerdfonts
|
|
54
|
+
viewig config set decor=nerdfonts
|
|
55
|
+
# config: always use plugins
|
|
56
|
+
viewig config set plugins=example1,example2
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Programmatically
|
|
60
|
+
|
|
61
|
+
All you need it to add
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import * as vign from "view-ignored"; // or "view-ignored/browser"
|
|
65
|
+
|
|
66
|
+
await vign.Plugins.loadBuiltIns(["git", "npm"]); // load built-in plugins
|
|
67
|
+
await vign.Plugins.loadBuiltIns(); // load all built-in plugins
|
|
68
|
+
await vign.Plugins.loadPlugins(["example"]); // load third-party plugins
|
|
69
|
+
|
|
70
|
+
// scan - options available
|
|
71
|
+
const fileInfoList = await vign.scan(".", { target: "git", cwd: process.cwd() });
|
|
72
|
+
const fileInfoList = await vign.scan(["./path/to/file"], { target: "git", cwd: process.cwd() });
|
|
73
|
+
|
|
74
|
+
// use results
|
|
75
|
+
if (fileInfo.ignored) {
|
|
76
|
+
superCodeEditor.explorer.colorFile(fileInfo.relativePath, "gray");
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Sorting
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const sorter = vign.Sorting.firstFolders;
|
|
84
|
+
const fileInfoList = await vign.scan(".", {target: "npm"});
|
|
85
|
+
const fileInfoSorted = fileInfoList.sort((a, b) => sorter(String(a), String(b)));
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Targets
|
|
89
|
+
|
|
90
|
+
- `git`
|
|
91
|
+
- `npm` (use it for PNPM and Bun)
|
|
92
|
+
- `yarn`
|
|
93
|
+
- `vsce`
|
|
94
|
+
- `jsr` *planned*
|
|
95
|
+
- `deno` *planned*
|
package/bin/viewig
CHANGED
|
@@ -1,64 +1,45 @@
|
|
|
1
|
-
import { type TargetBind } from './targets.js';
|
|
2
1
|
export * from './scanner.js';
|
|
3
2
|
export * from './targets.js';
|
|
4
3
|
/**
|
|
5
4
|
* Built-in name list.
|
|
6
|
-
* @public
|
|
7
5
|
*/
|
|
8
6
|
export declare const builtInNameList: readonly ["git", "npm", "vsce", "yarn"];
|
|
9
7
|
/**
|
|
10
8
|
* Built-in name type.
|
|
11
|
-
* @public
|
|
12
9
|
*/
|
|
13
10
|
export type BuiltInName = typeof builtInNameList[number];
|
|
14
11
|
/**
|
|
15
12
|
* The result of loading.
|
|
16
|
-
* @public
|
|
17
13
|
*/
|
|
18
14
|
export type PluginLoaded = {
|
|
19
15
|
resource: string;
|
|
20
16
|
isLoaded: boolean;
|
|
21
17
|
exports: unknown;
|
|
22
18
|
};
|
|
23
|
-
/**
|
|
24
|
-
* If a plugin wants to change something, it must export default.
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
export type PluginExport = {
|
|
28
|
-
viewignored: {
|
|
29
|
-
addTargets: TargetBind[];
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
19
|
/**
|
|
33
20
|
* Checks if the value is the {@link PluginExport}.
|
|
34
|
-
* @public
|
|
35
21
|
*/
|
|
36
22
|
export declare function isPluginExport(value: unknown): value is PluginExport;
|
|
37
23
|
/**
|
|
38
24
|
* Imports the plugin's exported data.
|
|
39
|
-
* @public
|
|
40
25
|
*/
|
|
41
26
|
export declare function importPlugin(exportData: PluginExport): void;
|
|
42
27
|
/**
|
|
43
28
|
* @param modulePath The plugin name.
|
|
44
29
|
* @returns The import result for the module.
|
|
45
|
-
* @public
|
|
46
30
|
*/
|
|
47
31
|
export declare function loadPlugin(modulePath: string, useImport?: boolean): Promise<PluginLoaded>;
|
|
48
32
|
/**
|
|
49
33
|
* @param modulePathList The plugin name list.
|
|
50
34
|
* @returns The import result for the list of modules.
|
|
51
|
-
* @public
|
|
52
35
|
*/
|
|
53
36
|
export declare function loadPlugins(modulePathList: string[]): Promise<PluginLoaded[]>;
|
|
54
37
|
/**
|
|
55
38
|
* Load any built-in plugin.
|
|
56
|
-
* @public
|
|
57
39
|
*/
|
|
58
40
|
export declare function loadBuiltIn(builtIn: BuiltInName): Promise<PluginLoaded>;
|
|
59
41
|
/**
|
|
60
42
|
* @param modulePathList The plugin name list.
|
|
61
43
|
* @returns The import result for the list of modules.
|
|
62
|
-
* @public
|
|
63
44
|
*/
|
|
64
45
|
export declare function loadBuiltIns(builtInList?: BuiltInName[]): Promise<PluginLoaded[]>;
|
|
@@ -4,7 +4,7 @@ import { isTargetBind, targetSet } from './targets.js';
|
|
|
4
4
|
export * from './scanner.js';
|
|
5
5
|
export * from './targets.js';
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
*/
|
|
9
9
|
const builtInImportMap = {
|
|
10
10
|
git: './plugins/git.js',
|
|
@@ -14,12 +14,10 @@ const builtInImportMap = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Built-in name list.
|
|
17
|
-
* @public
|
|
18
17
|
*/
|
|
19
18
|
export const builtInNameList = ['git', 'npm', 'vsce', 'yarn'];
|
|
20
19
|
/**
|
|
21
20
|
* Checks if the value is the {@link PluginExport}.
|
|
22
|
-
* @public
|
|
23
21
|
*/
|
|
24
22
|
export function isPluginExport(value) {
|
|
25
23
|
if (value?.constructor !== Object) {
|
|
@@ -31,7 +29,6 @@ export function isPluginExport(value) {
|
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Imports the plugin's exported data.
|
|
34
|
-
* @public
|
|
35
32
|
*/
|
|
36
33
|
export function importPlugin(exportData) {
|
|
37
34
|
const { addTargets } = exportData.viewignored;
|
|
@@ -42,7 +39,6 @@ export function importPlugin(exportData) {
|
|
|
42
39
|
/**
|
|
43
40
|
* @param modulePath The plugin name.
|
|
44
41
|
* @returns The import result for the module.
|
|
45
|
-
* @public
|
|
46
42
|
*/
|
|
47
43
|
export async function loadPlugin(modulePath, useImport = false) {
|
|
48
44
|
try {
|
|
@@ -66,7 +62,6 @@ export async function loadPlugin(modulePath, useImport = false) {
|
|
|
66
62
|
/**
|
|
67
63
|
* @param modulePathList The plugin name list.
|
|
68
64
|
* @returns The import result for the list of modules.
|
|
69
|
-
* @public
|
|
70
65
|
*/
|
|
71
66
|
export async function loadPlugins(modulePathList) {
|
|
72
67
|
const limit = pLimit(5);
|
|
@@ -75,7 +70,6 @@ export async function loadPlugins(modulePathList) {
|
|
|
75
70
|
}
|
|
76
71
|
/**
|
|
77
72
|
* Load any built-in plugin.
|
|
78
|
-
* @public
|
|
79
73
|
*/
|
|
80
74
|
export function loadBuiltIn(builtIn) {
|
|
81
75
|
return loadPlugin(builtInImportMap[builtIn], true);
|
|
@@ -83,9 +77,8 @@ export function loadBuiltIn(builtIn) {
|
|
|
83
77
|
/**
|
|
84
78
|
* @param modulePathList The plugin name list.
|
|
85
79
|
* @returns The import result for the list of modules.
|
|
86
|
-
* @public
|
|
87
80
|
*/
|
|
88
|
-
export async function loadBuiltIns(builtInList =
|
|
81
|
+
export async function loadBuiltIns(builtInList = [...builtInNameList]) {
|
|
89
82
|
const limit = pLimit(5);
|
|
90
83
|
const allLoaded = await Promise.all(builtInList.map(modulePath => limit(() => loadBuiltIn(modulePath))));
|
|
91
84
|
return allLoaded;
|
|
@@ -3,10 +3,10 @@ import { File, NoSourceError, SourceInfo, InvalidPatternError, Directory, } from
|
|
|
3
3
|
import { ScannerGitignore } from '../scanner.js';
|
|
4
4
|
const id = 'git';
|
|
5
5
|
const name = 'Git';
|
|
6
|
-
const icon = { ...icons['nf-seti-git'], color:
|
|
6
|
+
const icon = { ...icons['nf-seti-git'], color: '#F44E28' };
|
|
7
7
|
const testCommand = 'git ls-tree -r <git-branch-name> --name-only';
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export const matcherExclude = [
|
|
12
12
|
'**/.git/**',
|
|
@@ -17,7 +17,7 @@ export const matcherExclude = [
|
|
|
17
17
|
* @param map The output.
|
|
18
18
|
* @param scanner The scanner.
|
|
19
19
|
* @param sourceFile This file will be converted to a {@link SourceInfo}.
|
|
20
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export function useSourceFile(map, sourceFile, scanner) {
|
|
23
23
|
const sourceInfo = SourceInfo.from(sourceFile, scanner);
|
|
@@ -31,16 +31,16 @@ export function useSourceFile(map, sourceFile, scanner) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @param base The name for gitignore-like file.
|
|
34
|
-
* @
|
|
34
|
+
* @internal
|
|
35
35
|
*/
|
|
36
36
|
export const methodologyGitignoreLike = (base) => function (tree, o) {
|
|
37
37
|
const sourceList = tree.deep(File).filter(dirent => dirent.base === base);
|
|
38
38
|
const map = new Map();
|
|
39
|
+
if (sourceList.length === 0) {
|
|
40
|
+
throw new NoSourceError(base);
|
|
41
|
+
}
|
|
39
42
|
for (const sourceFile of sourceList) {
|
|
40
43
|
const scanner = new ScannerGitignore({ exclude: matcherExclude });
|
|
41
|
-
if (sourceFile === undefined) {
|
|
42
|
-
throw new NoSourceError(base);
|
|
43
|
-
}
|
|
44
44
|
const content = o.modules.fs.readFileSync(sourceFile.absolutePath).toString();
|
|
45
45
|
const pattern = content;
|
|
46
46
|
if (!scanner.isValid(pattern)) {
|
|
@@ -4,10 +4,10 @@ import { ScannerGitignore } from '../scanner.js';
|
|
|
4
4
|
import * as git from './git.js';
|
|
5
5
|
const id = 'npm';
|
|
6
6
|
const name = 'NPM';
|
|
7
|
-
const icon = { ...icons['nf-seti-npm'], color:
|
|
7
|
+
const icon = { ...icons['nf-seti-npm'], color: '#CA0404' };
|
|
8
8
|
const testCommand = 'npm pack --dry-run';
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export const matcherExclude = [
|
|
13
13
|
...git.matcherExclude,
|
|
@@ -28,7 +28,7 @@ export const matcherExclude = [
|
|
|
28
28
|
'**/npm-debug.log',
|
|
29
29
|
];
|
|
30
30
|
/**
|
|
31
|
-
* @
|
|
31
|
+
* @internal
|
|
32
32
|
*/
|
|
33
33
|
export const matcherInclude = [
|
|
34
34
|
'bin/**',
|
|
@@ -38,7 +38,7 @@ export const matcherInclude = [
|
|
|
38
38
|
'LICENCE*',
|
|
39
39
|
];
|
|
40
40
|
/**
|
|
41
|
-
* @
|
|
41
|
+
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export function isValidManifest(value) {
|
|
44
44
|
if (value?.constructor !== Object) {
|
|
@@ -50,10 +50,10 @@ export function isValidManifest(value) {
|
|
|
50
50
|
&& (value_.files === undefined || (Array.isArray(value_.files) && value_.files.every(element => typeof element === 'string')));
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* @
|
|
53
|
+
* @internal
|
|
54
54
|
*/
|
|
55
55
|
export function useChildren(tree, map, getMap) {
|
|
56
|
-
for (const child of
|
|
56
|
+
for (const child of tree.children.values()) {
|
|
57
57
|
if (!(child instanceof Directory)) {
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
@@ -65,7 +65,7 @@ export function useChildren(tree, map, getMap) {
|
|
|
65
65
|
return map;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* @
|
|
68
|
+
* @internal
|
|
69
69
|
*/
|
|
70
70
|
export const sourceSearch = (priority, scanner) => function (tree, o) {
|
|
71
71
|
const map = new Map();
|
|
@@ -105,7 +105,7 @@ export const sourceSearch = (priority, scanner) => function (tree, o) {
|
|
|
105
105
|
/**
|
|
106
106
|
* @param priority The list of file names from highest to lowest priority.
|
|
107
107
|
* @param scanner The pattern scanner.
|
|
108
|
-
* @
|
|
108
|
+
* @internal
|
|
109
109
|
*/
|
|
110
110
|
export const methodologyManifestNpmLike = (priority, scanner) => function (tree, o) {
|
|
111
111
|
const packageJson = tree.get('package.json');
|
|
@@ -3,16 +3,16 @@ import { NoSourceError, File, BadSourceError, } from '../../index.js';
|
|
|
3
3
|
import * as git from './git.js';
|
|
4
4
|
const id = 'vsce';
|
|
5
5
|
const name = 'VSCE';
|
|
6
|
-
const icon = { ...icons['nf-md-microsoft_visual_studio_code'], color:
|
|
6
|
+
const icon = { ...icons['nf-md-microsoft_visual_studio_code'], color: '#23A9F1' };
|
|
7
7
|
const testCommand = 'vsce ls';
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export const matcherExclude = [
|
|
12
12
|
...git.matcherExclude,
|
|
13
13
|
];
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
15
|
+
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export function isValidManifest(value) {
|
|
18
18
|
if (value?.constructor !== Object) {
|
|
@@ -29,10 +29,10 @@ export function isValidManifest(value) {
|
|
|
29
29
|
return 'vscode' in engines && typeof engines.vscode === 'string';
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* @
|
|
32
|
+
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export const methodologyManifestVsce = function (tree, o) {
|
|
35
|
-
const packageJson =
|
|
35
|
+
const packageJson = [...tree.deepIterator()].find(dirent => dirent instanceof File && dirent.base === 'package.json');
|
|
36
36
|
if (packageJson === undefined) {
|
|
37
37
|
throw new NoSourceError('package.json');
|
|
38
38
|
}
|
|
@@ -3,10 +3,9 @@ import { ScannerGitignore } from '../scanner.js';
|
|
|
3
3
|
import * as npm from './npm.js';
|
|
4
4
|
const id = 'yarn';
|
|
5
5
|
const name = 'Yarn';
|
|
6
|
-
const icon = { ...icons['nf-seti-yarn'], color:
|
|
7
|
-
// FIXME: Yarn can all this stuff another way.
|
|
6
|
+
const icon = { ...icons['nf-seti-yarn'], color: '#2E2A65' };
|
|
8
7
|
/**
|
|
9
|
-
* @
|
|
8
|
+
* @internal
|
|
10
9
|
*/
|
|
11
10
|
export const matcherExclude = [
|
|
12
11
|
...npm.matcherExclude,
|
|
@@ -14,7 +13,7 @@ export const matcherExclude = [
|
|
|
14
13
|
'.yarnrc',
|
|
15
14
|
];
|
|
16
15
|
/**
|
|
17
|
-
* @
|
|
16
|
+
* @internal
|
|
18
17
|
*/
|
|
19
18
|
export const matcherInclude = [
|
|
20
19
|
...npm.matcherInclude,
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { type Scanner } from '../lib.js';
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
2
|
export type PatternScannerOptions = {
|
|
6
3
|
pattern?: string | string[];
|
|
7
4
|
exclude?: string | string[];
|
|
8
5
|
include?: string | string[];
|
|
9
6
|
negated?: boolean;
|
|
10
7
|
};
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
8
|
export type PatternScanner = Scanner & {
|
|
15
9
|
pattern: string | string[];
|
|
16
10
|
exclude: string | string[];
|
|
@@ -21,9 +15,6 @@ export type PatternScanner = Scanner & {
|
|
|
21
15
|
ignores(path: string, options?: PatternScannerOptions): boolean;
|
|
22
16
|
ignores(path: string, argument?: PatternScannerOptions | string | string[]): boolean;
|
|
23
17
|
};
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
18
|
export declare class ScannerMinimatch implements PatternScanner {
|
|
28
19
|
negated: boolean;
|
|
29
20
|
protected _pattern: string | string[];
|
|
@@ -40,9 +31,6 @@ export declare class ScannerMinimatch implements PatternScanner {
|
|
|
40
31
|
ignores(path: string, pattern: string | string[]): boolean;
|
|
41
32
|
ignores(path: string, options?: PatternScannerOptions): boolean;
|
|
42
33
|
}
|
|
43
|
-
/**
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
34
|
export declare class ScannerGitignore extends ScannerMinimatch {
|
|
47
35
|
private static gitignoreToMinimatch;
|
|
48
36
|
constructor(options?: PatternScannerOptions);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { minimatch } from 'minimatch';
|
|
2
2
|
import { gitignoreToMinimatch } from '@humanwhocodes/gitignore-to-minimatch';
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
3
|
export class ScannerMinimatch {
|
|
7
4
|
negated;
|
|
8
5
|
_pattern;
|
|
9
6
|
get pattern() {
|
|
10
|
-
return this.
|
|
7
|
+
return this._pattern;
|
|
11
8
|
}
|
|
12
9
|
set pattern(value) {
|
|
13
10
|
this._pattern = value;
|
|
@@ -69,9 +66,6 @@ export class ScannerMinimatch {
|
|
|
69
66
|
return (argument?.negated ?? this.negated) ? !check : check;
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
/**
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
69
|
export class ScannerGitignore extends ScannerMinimatch {
|
|
76
70
|
static gitignoreToMinimatch(argument) {
|
|
77
71
|
if (typeof argument === 'string') {
|