view-ignored 0.8.1 → 0.9.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/README.md +5 -3
- package/out/browser_stream.d.ts +1 -1
- package/out/patterns/gitignore.js +10 -3
- package/out/patterns/index.d.ts +0 -1
- package/out/patterns/index.js +0 -1
- package/out/patterns/jsrjson.d.ts +1 -1
- package/out/patterns/jsrjson.js +31 -17
- 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/resolveSources.js +3 -6
- package/out/patterns/signedPattern.d.ts +53 -58
- package/out/patterns/signedPattern.js +44 -95
- package/out/patterns/source.d.ts +2 -4
- 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/patterns/patternMatcher.d.ts +0 -23
- package/out/patterns/patternMatcher.js +0 -1
|
@@ -17,7 +17,9 @@ export function stringCompile(pattern, context = [], options) {
|
|
|
17
17
|
else if (!pattern.startsWith("**/")) {
|
|
18
18
|
pattern = "**/" + pattern;
|
|
19
19
|
}
|
|
20
|
-
pattern
|
|
20
|
+
if (!pattern.endsWith("/**")) {
|
|
21
|
+
pattern += "/**";
|
|
22
|
+
}
|
|
21
23
|
const re = makeRe(pattern, {
|
|
22
24
|
dot: true,
|
|
23
25
|
nonegate: true,
|
package/out/targets/bun.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
1
2
|
import { signedPatternIgnores, signedPatternCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
|
|
3
|
+
import { join, unixify } from "../unixify.js";
|
|
4
|
+
import { npmManifestParse } from "./npmManifest.js";
|
|
2
5
|
const extractors = [
|
|
3
6
|
{
|
|
4
7
|
extract: extractPackageJson,
|
|
@@ -13,59 +16,101 @@ const extractors = [
|
|
|
13
16
|
path: ".gitignore",
|
|
14
17
|
},
|
|
15
18
|
];
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"yarn.lock",
|
|
21
|
-
"pnpm-lock.yaml",
|
|
22
|
-
"bun.lockb",
|
|
23
|
-
"bun.lock", // npm includes it
|
|
24
|
-
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L189
|
|
25
|
-
".*.swp",
|
|
26
|
-
"._*",
|
|
27
|
-
".DS_Store",
|
|
28
|
-
".git",
|
|
29
|
-
".gitignore",
|
|
30
|
-
".hg",
|
|
31
|
-
".npmignore",
|
|
32
|
-
".npmrc",
|
|
33
|
-
".lock-wscript",
|
|
34
|
-
".svn",
|
|
35
|
-
"wafpickle-*",
|
|
36
|
-
"CVS",
|
|
37
|
-
"npm-debug.log",
|
|
38
|
-
// bun says it is "mentioned in the docs but does not appear to be ignored by default"
|
|
39
|
-
// but we know it should be /build/config.gypi, not just config.gypi, haha
|
|
40
|
-
// "config.gypi",
|
|
41
|
-
".env.production", // npm includes it
|
|
42
|
-
"bunfig.toml", // npm includes it
|
|
43
|
-
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L284
|
|
44
|
-
// manifest should be included, but bun ignores it on this line
|
|
45
|
-
// bun forces it later: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
|
|
46
|
-
// "package.json",
|
|
47
|
-
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L285
|
|
48
|
-
"node_modules",
|
|
49
|
-
],
|
|
50
|
-
include: [
|
|
51
|
-
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
|
|
52
|
-
"package.json",
|
|
53
|
-
// the special?.* check works this way: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2599
|
|
54
|
-
"LICENSE",
|
|
55
|
-
"LICENSE.*",
|
|
56
|
-
"LICENCE",
|
|
57
|
-
"LICENCE.*",
|
|
58
|
-
"README",
|
|
59
|
-
"README.*",
|
|
60
|
-
],
|
|
61
|
-
compiled: null,
|
|
19
|
+
const internalInclude = {
|
|
20
|
+
excludes: false,
|
|
21
|
+
pattern: [], // filled within init
|
|
22
|
+
compiled: [],
|
|
62
23
|
};
|
|
63
|
-
|
|
24
|
+
const internal = [
|
|
25
|
+
internalInclude,
|
|
26
|
+
signedPatternCompile({
|
|
27
|
+
excludes: true,
|
|
28
|
+
pattern: [
|
|
29
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L180
|
|
30
|
+
"package-lock.json",
|
|
31
|
+
"yarn.lock",
|
|
32
|
+
"pnpm-lock.yaml",
|
|
33
|
+
"bun.lockb",
|
|
34
|
+
"bun.lock", // npm includes it
|
|
35
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L189
|
|
36
|
+
".*.swp",
|
|
37
|
+
"._*",
|
|
38
|
+
".DS_Store",
|
|
39
|
+
".git",
|
|
40
|
+
".gitignore",
|
|
41
|
+
".hg",
|
|
42
|
+
".npmignore",
|
|
43
|
+
".npmrc",
|
|
44
|
+
".lock-wscript",
|
|
45
|
+
".svn",
|
|
46
|
+
"wafpickle-*",
|
|
47
|
+
"CVS",
|
|
48
|
+
"npm-debug.log",
|
|
49
|
+
// bun says it is "mentioned in the docs but does not appear to be ignored by default"
|
|
50
|
+
// but we know it should be /build/config.gypi, not just config.gypi, haha
|
|
51
|
+
// "config.gypi",
|
|
52
|
+
".env.production", // npm includes it
|
|
53
|
+
"bunfig.toml", // npm includes it
|
|
54
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L284
|
|
55
|
+
// manifest should be included, but bun ignores it on this line
|
|
56
|
+
// bun forces it later: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
|
|
57
|
+
// "package.json",
|
|
58
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L285
|
|
59
|
+
"node_modules",
|
|
60
|
+
],
|
|
61
|
+
compiled: null,
|
|
62
|
+
}), // nocase should be false here
|
|
63
|
+
signedPatternCompile({
|
|
64
|
+
excludes: true,
|
|
65
|
+
pattern: [
|
|
66
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
|
|
67
|
+
"package.json",
|
|
68
|
+
// the special?.* check works this way: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2599
|
|
69
|
+
"LICENSE",
|
|
70
|
+
"LICENSE.*",
|
|
71
|
+
"LICENCE",
|
|
72
|
+
"LICENCE.*",
|
|
73
|
+
"README",
|
|
74
|
+
"README.*",
|
|
75
|
+
],
|
|
76
|
+
compiled: null,
|
|
77
|
+
}, { nocase: true }),
|
|
78
|
+
];
|
|
64
79
|
/**
|
|
65
80
|
* @since 0.8.1
|
|
66
81
|
*/
|
|
67
82
|
export const Bun = {
|
|
68
|
-
|
|
83
|
+
async init({ fs, cwd }) {
|
|
84
|
+
let content;
|
|
85
|
+
const normalCwd = unixify(cwd);
|
|
86
|
+
try {
|
|
87
|
+
content = await fs.promises.readFile(normalCwd + "/" + "package.json");
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw new Error("Error while initializing Bun", { cause: error });
|
|
91
|
+
}
|
|
92
|
+
const dist = npmManifestParse(content.toString());
|
|
93
|
+
if (dist instanceof type.errors) {
|
|
94
|
+
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
95
|
+
}
|
|
96
|
+
const set = new Set();
|
|
97
|
+
function normal(path) {
|
|
98
|
+
const result = unixify(join(normalCwd, path)).substring(normalCwd.length);
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L1440
|
|
102
|
+
if (typeof dist.bin === "string") {
|
|
103
|
+
set.add(normal(dist.bin));
|
|
104
|
+
}
|
|
105
|
+
else if (typeof dist.bin === "object" && dist.bin !== null) {
|
|
106
|
+
Object.values(dist.bin).forEach((binPath) => set.add(normal(binPath)));
|
|
107
|
+
}
|
|
108
|
+
// TODO: Bun should include bundled deps
|
|
109
|
+
// nothing else
|
|
110
|
+
// link zig code
|
|
111
|
+
internalInclude.pattern = Array.from(set);
|
|
112
|
+
signedPatternCompile(internalInclude, { nocase: true });
|
|
113
|
+
},
|
|
69
114
|
extractors,
|
|
70
115
|
ignores(o) {
|
|
71
116
|
return signedPatternIgnores({
|
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({
|