Skip to content

Commit e5dac62

Browse files
committed
Simplify policy override
1 parent 3c82469 commit e5dac62

File tree

4 files changed

+45
-104
lines changed

4 files changed

+45
-104
lines changed

packages/snaps-execution-environments/lavamoat/build-system/policy-override.json

Lines changed: 7 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"resources": {
3+
"$root$": {
4+
"packages": {
5+
"ts-loader": true
6+
}
7+
},
38
"@swc/core": {
49
"packages": {
510
"@swc/core>@swc/core-darwin-arm64": true,
@@ -12,99 +17,11 @@
1217
}
1318
},
1419
"ts-loader": {
15-
"builtin": {
16-
"console": true,
17-
"crypto": true,
18-
"fs": true,
19-
"os": true,
20-
"path": true
21-
},
22-
"globals": {
23-
"console": true,
24-
"process": true
25-
},
26-
"packages": {
27-
"chalk": true,
28-
"depcheck>semver": true,
29-
"ts-loader>micromatch": true,
30-
"ts-loader>source-map": true,
31-
"typescript": true,
32-
"webpack": true
33-
}
34-
},
35-
"ts-loader>micromatch": {
36-
"builtin": {
37-
"util": true
38-
},
39-
"packages": {
40-
"ts-loader>micromatch>picomatch": true,
41-
"ts-loader>micromatch>braces": true
42-
}
43-
},
44-
"ts-loader>micromatch>braces": {
45-
"packages": {
46-
"ts-loader>micromatch>braces>fill-range": true
47-
}
48-
},
49-
"ts-loader>micromatch>picomatch": {
50-
"builtin": {
51-
"path": true
52-
},
53-
"globals": {
54-
"process": true
55-
}
56-
},
57-
"ts-loader>micromatch>braces>fill-range": {
58-
"builtin": {
59-
"util": true
60-
},
61-
"packages": {
62-
"ts-loader>micromatch>braces>fill-range>to-regex-range": true
63-
}
64-
},
65-
"ts-loader>micromatch>braces>fill-range>to-regex-range": {
66-
"packages": {
67-
"ts-loader>micromatch>braces>fill-range>to-regex-range>is-number": true
68-
}
69-
},
70-
"ts-loader>source-map": {
71-
"builtin": {
72-
"fs": true,
73-
"path": true
74-
}
75-
},
76-
"typescript": {
77-
"builtin": {
78-
"buffer.Buffer": true,
79-
"crypto": true,
80-
"fs": true,
81-
"inspector": true,
82-
"module.findPnpApi": true,
83-
"os.EOL": true,
84-
"os.platform": true,
85-
"path.dirname": true,
86-
"path.join": true,
87-
"path.resolve": true,
88-
"perf_hooks.PerformanceObserver": true,
89-
"perf_hooks.performance": true
90-
},
91-
"globals": {
92-
"Intl.Collator": true,
93-
"PerformanceObserver": true,
94-
"__dirname": true,
95-
"__filename": true,
96-
"clearTimeout": true,
97-
"console": true,
98-
"gc": true,
99-
"onProfilerEvent": true,
100-
"performance": true,
101-
"process": true,
102-
"setTimeout": true
103-
},
10420
"packages": {
105-
"jest>@jest/core>jest-runner>source-map-support": true
21+
"typescript": true
10622
}
10723
},
24+
"typescript": {},
10825
"webpack>loader-runner": {
10926
"packages": {
11027
"html-webpack-plugin": true,

packages/snaps-execution-environments/lavamoat/build-system/policy.json

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"resources": {
3+
"$root$": {
4+
"packages": {
5+
"ts-loader": true
6+
}
7+
},
38
"lavamoat>@babel/code-frame": {
49
"globals": {
510
"console.warn": true,
@@ -553,7 +558,7 @@
553558
},
554559
"ts-loader>micromatch>braces>fill-range": {
555560
"builtin": {
556-
"util": true
561+
"util.inspect": true
557562
},
558563
"packages": {
559564
"ts-loader>micromatch>braces>fill-range>to-regex-range": true
@@ -823,7 +828,7 @@
823828
},
824829
"ts-loader>micromatch": {
825830
"builtin": {
826-
"util": true
831+
"util.inspect": true
827832
},
828833
"packages": {
829834
"ts-loader>micromatch>braces": true,
@@ -871,10 +876,12 @@
871876
},
872877
"ts-loader>micromatch>picomatch": {
873878
"builtin": {
874-
"path": true
879+
"path.basename": true,
880+
"path.sep": true
875881
},
876882
"globals": {
877-
"process": true
883+
"process.platform": true,
884+
"process.version.slice": true
878885
}
879886
},
880887
"html-webpack-plugin>pretty-error": {
@@ -1019,8 +1026,8 @@
10191026
},
10201027
"ts-loader>source-map": {
10211028
"builtin": {
1022-
"fs": true,
1023-
"path": true
1029+
"fs.readFile": true,
1030+
"path.join": true
10241031
},
10251032
"globals": {
10261033
"WebAssembly.instantiate": true,
@@ -1113,16 +1120,22 @@
11131120
},
11141121
"ts-loader": {
11151122
"builtin": {
1116-
"console": true,
1117-
"crypto": true,
1118-
"fs": true,
1119-
"os": true,
1120-
"path": true
1123+
"console.Console": true,
1124+
"crypto.createHash": true,
1125+
"fs.readFileSync": true,
1126+
"os.EOL": true,
1127+
"path.dirname": true,
1128+
"path.isAbsolute": true,
1129+
"path.join": true,
1130+
"path.normalize": true,
1131+
"path.relative": true,
1132+
"path.resolve": true
11211133
},
11221134
"globals": {
11231135
"__dirname": true,
1124-
"console": true,
1125-
"process": true
1136+
"console.log.call": true,
1137+
"process.stderr": true,
1138+
"process.stdout": true
11261139
},
11271140
"packages": {
11281141
"chalk": true,

packages/snaps-execution-environments/scripts/build.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ webpack(config, (error, stats) => {
2929
return;
3030
}
3131

32+
if (stats.hasErrors()) {
33+
console.error(
34+
chalk.red(
35+
'Webpack finished with errors. See the error(s) below for more details.',
36+
),
37+
);
38+
39+
console.log(indent(chalk.red(stats.toString('errors-only')), 2));
40+
return;
41+
}
42+
3243
console.log(
3344
stats.toString({
3445
all: false,

packages/snaps-execution-environments/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ const configs = ENTRY_POINTS.map(
240240
apply: (compiler) => {
241241
const PLUGIN_NAME = 'InlinePlugin';
242242

243-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
243+
compiler.hooks.make.tap(PLUGIN_NAME, (compilation) => {
244244
compilation.hooks.processAssets.tap(
245245
{
246246
name: PLUGIN_NAME,

0 commit comments

Comments
 (0)