File tree Expand file tree Collapse file tree 6 files changed +921
-0
lines changed Expand file tree Collapse file tree 6 files changed +921
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ` parcel-query `
2
+
3
+ A REPL to investigate the Parcel graphs in the cache ("offline", after the build).
4
+
5
+ ## Installation
6
+
7
+ Clone and run ` yarn ` , then ` cd packages/dev/query && yarn link ` to make the ` parcel-query ` binary
8
+ globally available.
9
+
10
+ ## Usage
11
+
12
+ Call ` .help ` to view a list of commands.
13
+
14
+ In a project root containing a ` .parcel-cache ` folder:
15
+
16
+ ``` sh
17
+ $ parcel-query
18
+ > .findBundleReason 27494aebac508bd8 TJbGI
19
+ # Asset is main entry of bundle: false
20
+ # Asset is an entry of bundle: false
21
+ # Incoming dependencies contained in the bundle:
22
+ {
23
+ id: ' 3fd182662e2a6fa9' ,
24
+ type: ' dependency' ,
25
+ value: {
26
+ specifier: ' ../../foo' ,
27
+ specifierType: 0,
28
+ ...
29
+ ` ` `
30
+
31
+ In the ` .getAsset 3Xzt5` variant, no quotes/parenthesis are
32
+ needed. Alternatively, you can use proper JS: ` getAsset(" 3Xzt5" )` .
33
+
34
+ The variables ` assetGraph` and ` bundleGraph` contain the deserialized objects.
35
+
36
+ For a single query, the command (which has to be a JS call) can be specified as a CLI parameter (the
37
+ disadvantage here is that the graphs have to be loaded on every call as opposed to once when
38
+ starting the REPL):
39
+
40
+ ` ` ` sh
41
+ $ parcel-query ' findBundleReason("b0696febf20b57ce", "bNAUZ")'
42
+ ` ` `
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " parcel-query" ,
3
+ "version" : " 2.8.1" ,
4
+ "private" : true ,
5
+ "bin" : " src/bin.js" ,
6
+ "main" : " src/index.js" ,
7
+ "dependencies" : {
8
+ "@parcel/core" : " 2.8.1" ,
9
+ "@parcel/graph" : " 2.8.1" ,
10
+ "nullthrows" : " ^1.1.1" ,
11
+ "v8-compile-cache" : " ^2.0.0"
12
+ },
13
+ "devDependencies" : {
14
+ "@babel/core" : " ^7.0.0" ,
15
+ "@parcel/babel-register" : " 2.8.1"
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict' ;
4
+
5
+ if (
6
+ process . env . PARCEL_BUILD_ENV !== 'production' ||
7
+ process . env . PARCEL_SELF_BUILD
8
+ ) {
9
+ require ( '@parcel/babel-register' ) ;
10
+ }
11
+
12
+ require ( 'v8-compile-cache' ) ;
13
+ require ( './cli' ) ;
You can’t perform that action at this time.
0 commit comments