view-ignored 0.8.1 → 0.9.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/README.md +5 -3
- package/out/browser_stream.d.ts +1 -1
- package/out/patterns/gitignore.js +10 -3
- package/out/patterns/jsrjson.js +9 -5
- package/out/patterns/matcherStream.d.ts +1 -1
- package/out/patterns/packagejson.js +16 -12
- package/out/patterns/pattern.d.ts +5 -0
- package/out/patterns/patternMatcher.d.ts +2 -2
- package/out/patterns/resolveSources.js +3 -6
- package/out/patterns/signedPattern.d.ts +8 -37
- package/out/patterns/signedPattern.js +21 -64
- package/out/patterns/source.d.ts +2 -2
- package/out/patterns/source.js +3 -4
- package/out/patterns/stringCompile.js +3 -1
- package/out/targets/bun.js +93 -48
- package/out/targets/deno.js +38 -8
- package/out/targets/git.js +7 -6
- package/out/targets/jsr.js +33 -7
- package/out/targets/jsrManifest.d.ts +10 -0
- package/out/targets/jsrManifest.js +9 -0
- package/out/targets/npm.js +78 -46
- package/out/targets/npmManifest.d.ts +46 -0
- package/out/targets/npmManifest.js +23 -0
- package/out/targets/vsce.js +66 -39
- package/out/targets/yarn.js +43 -44
- package/out/targets/yarnClassic.js +67 -44
- package/out/unixify.d.ts +1 -0
- package/out/unixify.js +3 -0
- package/package.json +10 -7
package/out/targets/deno.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import { signedPatternIgnores, signedPatternCompile, extractJsrJson, extractJsrJsonc, extractPackageJson, } from "../patterns/index.js";
|
|
3
|
+
import { unixify } from "../unixify.js";
|
|
4
|
+
import { jsrManifestParse } from "./jsrManifest.js";
|
|
2
5
|
const extractors = [
|
|
3
6
|
{
|
|
4
7
|
extract: extractJsrJson,
|
|
@@ -16,18 +19,45 @@ const extractors = [
|
|
|
16
19
|
extract: extractJsrJsonc,
|
|
17
20
|
path: "jsr.jsonc",
|
|
18
21
|
},
|
|
22
|
+
{
|
|
23
|
+
extract: extractPackageJson,
|
|
24
|
+
path: "package.json",
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const internal = [
|
|
28
|
+
signedPatternCompile({
|
|
29
|
+
excludes: true,
|
|
30
|
+
pattern: [".git", ".DS_Store"],
|
|
31
|
+
compiled: null,
|
|
32
|
+
}),
|
|
19
33
|
];
|
|
20
|
-
const internal = {
|
|
21
|
-
exclude: [".git", ".DS_Store"],
|
|
22
|
-
include: [],
|
|
23
|
-
compiled: null,
|
|
24
|
-
};
|
|
25
|
-
signedPatternCompile(internal);
|
|
26
34
|
/**
|
|
27
35
|
* @since 0.8.1
|
|
28
36
|
*/
|
|
29
37
|
export const Deno = {
|
|
30
|
-
|
|
38
|
+
async init({ fs, cwd }) {
|
|
39
|
+
let content;
|
|
40
|
+
const normalCwd = unixify(cwd);
|
|
41
|
+
let path;
|
|
42
|
+
for (const [i, { path: p }] of extractors.entries()) {
|
|
43
|
+
path = p;
|
|
44
|
+
try {
|
|
45
|
+
content = await fs.promises.readFile(normalCwd + "/" + path);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error.code === "ENOENT") {
|
|
49
|
+
if (i < extractors.length - 1) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw new Error("Error while initializing Deno", { cause: error });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const dist = jsrManifestParse(content.toString());
|
|
57
|
+
if (dist instanceof type.errors) {
|
|
58
|
+
throw new Error("Invalid '" + path + "': " + dist.summary, { cause: dist });
|
|
59
|
+
}
|
|
60
|
+
},
|
|
31
61
|
extractors,
|
|
32
62
|
ignores(o) {
|
|
33
63
|
return signedPatternIgnores({
|
package/out/targets/git.js
CHANGED
|
@@ -9,12 +9,13 @@ const extractors = [
|
|
|
9
9
|
path: ".git/info/exclude",
|
|
10
10
|
},
|
|
11
11
|
];
|
|
12
|
-
const internal =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const internal = [
|
|
13
|
+
signedPatternCompile({
|
|
14
|
+
excludes: true,
|
|
15
|
+
pattern: [".git", ".DS_Store"],
|
|
16
|
+
compiled: null,
|
|
17
|
+
}),
|
|
18
|
+
];
|
|
18
19
|
/**
|
|
19
20
|
* @since 0.6.0
|
|
20
21
|
*/
|
package/out/targets/jsr.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
1
2
|
import { signedPatternIgnores, signedPatternCompile, extractJsrJson, extractJsrJsonc, } from "../patterns/index.js";
|
|
3
|
+
import { unixify } from "../unixify.js";
|
|
4
|
+
import { jsrManifestParse } from "./jsrManifest.js";
|
|
2
5
|
const extractors = [
|
|
3
6
|
{
|
|
4
7
|
extract: extractJsrJson,
|
|
@@ -9,17 +12,40 @@ const extractors = [
|
|
|
9
12
|
path: "jsr.jsonc",
|
|
10
13
|
},
|
|
11
14
|
];
|
|
12
|
-
const internal =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const internal = [
|
|
16
|
+
signedPatternCompile({
|
|
17
|
+
excludes: true,
|
|
18
|
+
pattern: [".git", ".DS_Store"],
|
|
19
|
+
compiled: null,
|
|
20
|
+
}),
|
|
21
|
+
];
|
|
18
22
|
/**
|
|
19
23
|
* @since 0.6.0
|
|
20
24
|
*/
|
|
21
25
|
export const JSR = {
|
|
22
|
-
|
|
26
|
+
async init({ fs, cwd }) {
|
|
27
|
+
let content;
|
|
28
|
+
const normalCwd = unixify(cwd);
|
|
29
|
+
let path;
|
|
30
|
+
for (const [i, { path: p }] of extractors.entries()) {
|
|
31
|
+
path = p;
|
|
32
|
+
try {
|
|
33
|
+
content = await fs.promises.readFile(normalCwd + "/" + path);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if (error.code === "ENOENT") {
|
|
37
|
+
if (i < extractors.length - 1) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
throw new Error("Error while initializing Deno", { cause: error });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const dist = jsrManifestParse(content.toString());
|
|
45
|
+
if (dist instanceof type.errors) {
|
|
46
|
+
throw new Error("Invalid '" + path + "': " + dist.summary, { cause: dist });
|
|
47
|
+
}
|
|
48
|
+
},
|
|
23
49
|
extractors,
|
|
24
50
|
ignores(o) {
|
|
25
51
|
return signedPatternIgnores({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const jsrManifest: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
exports: string | Record<string, string>;
|
|
5
|
+
}, {}>;
|
|
6
|
+
export declare const jsrManifestParse: import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype/internal/attributes.ts").To<{
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
exports: string | Record<string, string>;
|
|
10
|
+
}>, {}>;
|
package/out/targets/npm.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
1
2
|
import { signedPatternIgnores, signedPatternCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
|
|
3
|
+
import { unixify } from "../unixify.js";
|
|
4
|
+
import { npmManifestParse } from "./npmManifest.js";
|
|
2
5
|
const extractors = [
|
|
3
6
|
{
|
|
4
7
|
extract: extractPackageJson,
|
|
@@ -13,57 +16,86 @@ const extractors = [
|
|
|
13
16
|
path: ".gitignore",
|
|
14
17
|
},
|
|
15
18
|
];
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
".gitignore",
|
|
21
|
-
".git",
|
|
22
|
-
".svn",
|
|
23
|
-
".hg",
|
|
24
|
-
"CVS",
|
|
25
|
-
".git",
|
|
26
|
-
".svn",
|
|
27
|
-
".hg",
|
|
28
|
-
"CVS",
|
|
29
|
-
"/.lock-wscript",
|
|
30
|
-
"/.wafpickle-*",
|
|
31
|
-
"/build/config.gypi",
|
|
32
|
-
"npm-debug.log",
|
|
33
|
-
".npmrc",
|
|
34
|
-
".*.swp",
|
|
35
|
-
".DS_Store",
|
|
36
|
-
"._*",
|
|
37
|
-
"*.orig",
|
|
38
|
-
"/archived-packages/**",
|
|
39
|
-
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L294
|
|
40
|
-
"/node_modules",
|
|
41
|
-
"/package-lock.json",
|
|
42
|
-
"/yarn.lock",
|
|
43
|
-
"/pnpm-lock.yaml",
|
|
44
|
-
"/bun.lockb",
|
|
45
|
-
],
|
|
46
|
-
include: [
|
|
47
|
-
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L287
|
|
48
|
-
"bin",
|
|
49
|
-
"package.json",
|
|
50
|
-
"README",
|
|
51
|
-
"COPYING",
|
|
52
|
-
"LICENSE",
|
|
53
|
-
"LICENCE",
|
|
54
|
-
"README.*",
|
|
55
|
-
"COPYING.*",
|
|
56
|
-
"LICENSE.*",
|
|
57
|
-
"LICENCE.*",
|
|
58
|
-
],
|
|
59
|
-
compiled: null,
|
|
19
|
+
const internalInclude = {
|
|
20
|
+
excludes: false,
|
|
21
|
+
pattern: [], // filled within init
|
|
22
|
+
compiled: [],
|
|
60
23
|
};
|
|
61
|
-
|
|
24
|
+
const internal = [
|
|
25
|
+
internalInclude,
|
|
26
|
+
signedPatternCompile({
|
|
27
|
+
excludes: true,
|
|
28
|
+
pattern: [
|
|
29
|
+
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L16
|
|
30
|
+
".npmignore",
|
|
31
|
+
".gitignore",
|
|
32
|
+
".git",
|
|
33
|
+
".svn",
|
|
34
|
+
".hg",
|
|
35
|
+
"CVS",
|
|
36
|
+
".git",
|
|
37
|
+
".svn",
|
|
38
|
+
".hg",
|
|
39
|
+
"CVS",
|
|
40
|
+
"/.lock-wscript",
|
|
41
|
+
"/.wafpickle-*",
|
|
42
|
+
"/build/config.gypi",
|
|
43
|
+
"npm-debug.log",
|
|
44
|
+
".npmrc",
|
|
45
|
+
".*.swp",
|
|
46
|
+
".DS_Store",
|
|
47
|
+
"._*",
|
|
48
|
+
"*.orig",
|
|
49
|
+
"/archived-packages/**",
|
|
50
|
+
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L294
|
|
51
|
+
"/node_modules",
|
|
52
|
+
"/package-lock.json",
|
|
53
|
+
"/yarn.lock",
|
|
54
|
+
"/pnpm-lock.yaml",
|
|
55
|
+
"/bun.lockb",
|
|
56
|
+
],
|
|
57
|
+
compiled: null,
|
|
58
|
+
}),
|
|
59
|
+
signedPatternCompile({
|
|
60
|
+
excludes: false,
|
|
61
|
+
pattern: [
|
|
62
|
+
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L287
|
|
63
|
+
"bin",
|
|
64
|
+
"package.json",
|
|
65
|
+
"README",
|
|
66
|
+
"COPYING",
|
|
67
|
+
"LICENSE",
|
|
68
|
+
"LICENCE",
|
|
69
|
+
"README.*",
|
|
70
|
+
"COPYING.*",
|
|
71
|
+
"LICENSE.*",
|
|
72
|
+
"LICENCE.*",
|
|
73
|
+
],
|
|
74
|
+
compiled: null,
|
|
75
|
+
}),
|
|
76
|
+
];
|
|
62
77
|
/**
|
|
63
78
|
* @since 0.6.0
|
|
64
79
|
*/
|
|
65
80
|
export const NPM = {
|
|
66
|
-
|
|
81
|
+
async init({ fs, cwd }) {
|
|
82
|
+
let content;
|
|
83
|
+
const normalCwd = unixify(cwd);
|
|
84
|
+
try {
|
|
85
|
+
content = await fs.promises.readFile(normalCwd + "/" + "package.json");
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
throw new Error("Error while initializing NPM", { cause: error });
|
|
89
|
+
}
|
|
90
|
+
const dist = npmManifestParse(content.toString());
|
|
91
|
+
if (dist instanceof type.errors) {
|
|
92
|
+
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
93
|
+
}
|
|
94
|
+
// const set = new Set<string>()
|
|
95
|
+
// TODO: NPM should include bundled deps
|
|
96
|
+
// internalInclude.pattern = Array.from(set)
|
|
97
|
+
// signedPatternCompile(internalInclude, { nocase: true })
|
|
98
|
+
},
|
|
67
99
|
extractors,
|
|
68
100
|
ignores(o) {
|
|
69
101
|
return signedPatternIgnores({
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const npmManifest: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
2
|
+
main?: string | undefined;
|
|
3
|
+
module?: string | undefined;
|
|
4
|
+
browser?: string | undefined;
|
|
5
|
+
files?: string[] | undefined;
|
|
6
|
+
bin?: string | Record<string, string> | undefined;
|
|
7
|
+
optionalDependencies?: Record<string, string> | undefined;
|
|
8
|
+
devDependencies?: Record<string, string> | undefined;
|
|
9
|
+
dependencies?: Record<string, string> | undefined;
|
|
10
|
+
bundleDependencies?: string[] | undefined;
|
|
11
|
+
bundledDependencies?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
main?: string | undefined;
|
|
14
|
+
module?: string | undefined;
|
|
15
|
+
browser?: string | undefined;
|
|
16
|
+
files?: string[] | undefined;
|
|
17
|
+
bin?: string | Record<string, string> | undefined;
|
|
18
|
+
optionalDependencies?: Record<string, string> | undefined;
|
|
19
|
+
devDependencies?: Record<string, string> | undefined;
|
|
20
|
+
dependencies?: Record<string, string> | undefined;
|
|
21
|
+
bundledDependencies?: string[] | undefined;
|
|
22
|
+
bundleDependencies?: undefined;
|
|
23
|
+
}, {}>;
|
|
24
|
+
export declare const npmManifestParse: import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype/internal/attributes.ts").To<{
|
|
25
|
+
main?: string | undefined;
|
|
26
|
+
module?: string | undefined;
|
|
27
|
+
browser?: string | undefined;
|
|
28
|
+
files?: string[] | undefined;
|
|
29
|
+
bin?: string | Record<string, string> | undefined;
|
|
30
|
+
optionalDependencies?: Record<string, string> | undefined;
|
|
31
|
+
devDependencies?: Record<string, string> | undefined;
|
|
32
|
+
dependencies?: Record<string, string> | undefined;
|
|
33
|
+
bundleDependencies?: string[] | undefined;
|
|
34
|
+
bundledDependencies?: undefined;
|
|
35
|
+
}> | import("arktype/internal/attributes.ts").To<{
|
|
36
|
+
main?: string | undefined;
|
|
37
|
+
module?: string | undefined;
|
|
38
|
+
browser?: string | undefined;
|
|
39
|
+
files?: string[] | undefined;
|
|
40
|
+
bin?: string | Record<string, string> | undefined;
|
|
41
|
+
optionalDependencies?: Record<string, string> | undefined;
|
|
42
|
+
devDependencies?: Record<string, string> | undefined;
|
|
43
|
+
dependencies?: Record<string, string> | undefined;
|
|
44
|
+
bundledDependencies?: string[] | undefined;
|
|
45
|
+
bundleDependencies?: undefined;
|
|
46
|
+
}>, {}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
const baseManifest = type({
|
|
3
|
+
"main?": "string",
|
|
4
|
+
"module?": "string",
|
|
5
|
+
"browser?": "string",
|
|
6
|
+
"files?": "string[]",
|
|
7
|
+
"bin?": "string | Record<string, string>",
|
|
8
|
+
"optionalDependencies?": "Record<string, string>",
|
|
9
|
+
"devDependencies?": "Record<string, string>",
|
|
10
|
+
"dependencies?": "Record<string, string>",
|
|
11
|
+
});
|
|
12
|
+
const withBundle = baseManifest.and({
|
|
13
|
+
"bundleDependencies?": "string[]",
|
|
14
|
+
"bundledDependencies?": "never",
|
|
15
|
+
});
|
|
16
|
+
const withBundled = baseManifest.and({
|
|
17
|
+
"bundledDependencies?": "string[]",
|
|
18
|
+
"bundleDependencies?": "never",
|
|
19
|
+
});
|
|
20
|
+
export const npmManifest = withBundle.or(withBundled);
|
|
21
|
+
export const npmManifestParse = type("string")
|
|
22
|
+
.pipe((s) => JSON.parse(s))
|
|
23
|
+
.pipe(npmManifest);
|
package/out/targets/vsce.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
1
2
|
import { signedPatternIgnores, signedPatternCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
|
|
3
|
+
import { unixify } from "../unixify.js";
|
|
4
|
+
import { npmManifest } from "./npmManifest.js";
|
|
2
5
|
const extractors = [
|
|
3
6
|
{
|
|
4
7
|
extract: extractPackageJson,
|
|
@@ -13,49 +16,73 @@ const extractors = [
|
|
|
13
16
|
path: ".gitignore",
|
|
14
17
|
},
|
|
15
18
|
];
|
|
16
|
-
const internal =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
19
|
+
const internal = [
|
|
20
|
+
signedPatternCompile({
|
|
21
|
+
excludes: true,
|
|
22
|
+
pattern: [
|
|
23
|
+
// https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1633
|
|
24
|
+
".vscodeignore",
|
|
25
|
+
"package-lock.json",
|
|
26
|
+
"npm-debug.log",
|
|
27
|
+
"yarn.lock",
|
|
28
|
+
"yarn-error.log",
|
|
29
|
+
"npm-shrinkwrap.json",
|
|
30
|
+
".editorconfig",
|
|
31
|
+
".npmrc",
|
|
32
|
+
".yarnrc",
|
|
33
|
+
".gitattributes",
|
|
34
|
+
"*.todo",
|
|
35
|
+
"tslint.yaml",
|
|
36
|
+
".eslintrc*",
|
|
37
|
+
".babelrc*",
|
|
38
|
+
".prettierrc*",
|
|
39
|
+
".cz-config.js",
|
|
40
|
+
".commitlintrc*",
|
|
41
|
+
"webpack.config.js",
|
|
42
|
+
"ISSUE_TEMPLATE.md",
|
|
43
|
+
"CONTRIBUTING.md",
|
|
44
|
+
"PULL_REQUEST_TEMPLATE.md",
|
|
45
|
+
"CODE_OF_CONDUCT.md",
|
|
46
|
+
".github",
|
|
47
|
+
".travis.yml",
|
|
48
|
+
"appveyor.yml",
|
|
49
|
+
".git",
|
|
50
|
+
"*.vsix",
|
|
51
|
+
".DS_Store",
|
|
52
|
+
"*.vsixmanifest",
|
|
53
|
+
".vscode-test",
|
|
54
|
+
".vscode-test-web",
|
|
55
|
+
],
|
|
56
|
+
compiled: null,
|
|
57
|
+
}),
|
|
58
|
+
];
|
|
59
|
+
const vsceManifest = npmManifest.and({
|
|
60
|
+
engines: {
|
|
61
|
+
// https://github.com/microsoft/vscode-vsce/blob/main/src/validation.ts#L52
|
|
62
|
+
vscode: "/^\\*$|^(\\^|>=)?((\\d+)|x)\\.((\\d+)|x)\\.((\\d+)|x)(\\-.*)?$/",
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
const vsceManifestParse = type("string")
|
|
66
|
+
.pipe((s) => JSON.parse(s))
|
|
67
|
+
.pipe(vsceManifest);
|
|
55
68
|
/**
|
|
56
69
|
* @since 0.6.0
|
|
57
70
|
*/
|
|
58
71
|
export const VSCE = {
|
|
72
|
+
async init({ fs, cwd }) {
|
|
73
|
+
let content;
|
|
74
|
+
const normalCwd = unixify(cwd);
|
|
75
|
+
try {
|
|
76
|
+
content = await fs.promises.readFile(normalCwd + "/" + "package.json");
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
throw new Error("Error while initializing VSCE", { cause: error });
|
|
80
|
+
}
|
|
81
|
+
const dist = vsceManifestParse(content.toString());
|
|
82
|
+
if (dist instanceof type.errors) {
|
|
83
|
+
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
84
|
+
}
|
|
85
|
+
},
|
|
59
86
|
extractors,
|
|
60
87
|
ignores(o) {
|
|
61
88
|
return signedPatternIgnores({
|
package/out/targets/yarn.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
2
|
import { signedPatternIgnores, signedPatternCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
|
|
3
3
|
import { join, unixify } from "../unixify.js";
|
|
4
|
+
import { npmManifestParse } from "./npmManifest.js";
|
|
4
5
|
const extractors = [
|
|
5
6
|
{
|
|
6
7
|
extract: extractPackageJsonNocase,
|
|
@@ -15,42 +16,44 @@ const extractors = [
|
|
|
15
16
|
path: ".gitignore",
|
|
16
17
|
},
|
|
17
18
|
];
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"/README.*",
|
|
23
|
-
"/LICENSE",
|
|
24
|
-
"/LICENSE.*",
|
|
25
|
-
"/LICENCE",
|
|
26
|
-
"/LICENCE.*",
|
|
27
|
-
];
|
|
28
|
-
const internal = {
|
|
29
|
-
exclude: [
|
|
30
|
-
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
|
|
31
|
-
"/package.tgz",
|
|
32
|
-
".github",
|
|
33
|
-
".git",
|
|
34
|
-
".hg",
|
|
35
|
-
"node_modules",
|
|
36
|
-
".npmignore",
|
|
37
|
-
".gitignore",
|
|
38
|
-
".#*",
|
|
39
|
-
".DS_Store",
|
|
40
|
-
],
|
|
41
|
-
include: [...include],
|
|
42
|
-
compiled: null,
|
|
19
|
+
const internalInclude = {
|
|
20
|
+
excludes: false,
|
|
21
|
+
pattern: [],
|
|
22
|
+
compiled: [],
|
|
43
23
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
const internal = [
|
|
25
|
+
internalInclude,
|
|
26
|
+
signedPatternCompile({
|
|
27
|
+
excludes: true,
|
|
28
|
+
pattern: [
|
|
29
|
+
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
|
|
30
|
+
"/package.tgz",
|
|
31
|
+
".github",
|
|
32
|
+
".git",
|
|
33
|
+
".hg",
|
|
34
|
+
"node_modules",
|
|
35
|
+
".npmignore",
|
|
36
|
+
".gitignore",
|
|
37
|
+
".#*",
|
|
38
|
+
".DS_Store",
|
|
39
|
+
],
|
|
40
|
+
compiled: null,
|
|
41
|
+
}),
|
|
42
|
+
signedPatternCompile({
|
|
43
|
+
excludes: false,
|
|
44
|
+
pattern: [
|
|
45
|
+
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
|
|
46
|
+
"/package.json",
|
|
47
|
+
"/README",
|
|
48
|
+
"/README.*",
|
|
49
|
+
"/LICENSE",
|
|
50
|
+
"/LICENSE.*",
|
|
51
|
+
"/LICENCE",
|
|
52
|
+
"/LICENCE.*",
|
|
53
|
+
],
|
|
54
|
+
compiled: null,
|
|
55
|
+
}, { nocase: true }),
|
|
56
|
+
];
|
|
54
57
|
/**
|
|
55
58
|
* @since 0.6.0
|
|
56
59
|
*/
|
|
@@ -62,17 +65,14 @@ export const Yarn = {
|
|
|
62
65
|
content = await fs.promises.readFile(normalCwd + "/" + "package.json");
|
|
63
66
|
}
|
|
64
67
|
catch (error) {
|
|
65
|
-
|
|
66
|
-
return; // no package.json
|
|
67
|
-
}
|
|
68
|
-
throw new Error("Error while initializing Yarn's ignoring implementation", { cause: error });
|
|
68
|
+
throw new Error("Error while initializing Yarn", { cause: error });
|
|
69
69
|
}
|
|
70
|
-
const dist =
|
|
70
|
+
const dist = npmManifestParse(content.toString());
|
|
71
71
|
if (dist instanceof type.errors) {
|
|
72
72
|
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
73
73
|
}
|
|
74
74
|
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L215-L231
|
|
75
|
-
const set = new Set(
|
|
75
|
+
const set = new Set();
|
|
76
76
|
function normal(path) {
|
|
77
77
|
const result = unixify(join(normalCwd, path)).substring(normalCwd.length);
|
|
78
78
|
return result;
|
|
@@ -89,9 +89,8 @@ export const Yarn = {
|
|
|
89
89
|
else if (typeof dist.bin === "object" && dist.bin !== null) {
|
|
90
90
|
Object.values(dist.bin).forEach((binPath) => set.add(normal(binPath)));
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
signedPatternCompile(internal, { nocase: true });
|
|
92
|
+
internalInclude.pattern = Array.from(set);
|
|
93
|
+
signedPatternCompile(internalInclude, { nocase: true });
|
|
95
94
|
},
|
|
96
95
|
extractors,
|
|
97
96
|
ignores(o) {
|