-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
921 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# `parcel-query` | ||
|
||
A REPL to investigate the Parcel graphs in the cache ("offline", after the build). | ||
|
||
## Installation | ||
|
||
Clone and run `yarn`, then `cd packages/dev/query && yarn link` to make the `parcel-query` binary | ||
globally available. | ||
|
||
## Usage | ||
|
||
Call `.help` to view a list of commands. | ||
|
||
In a project root containing a `.parcel-cache` folder: | ||
|
||
```sh | ||
$ parcel-query | ||
> .findBundleReason 27494aebac508bd8 TJbGI | ||
# Asset is main entry of bundle: false | ||
# Asset is an entry of bundle: false | ||
# Incoming dependencies contained in the bundle: | ||
{ | ||
id: '3fd182662e2a6fa9', | ||
type: 'dependency', | ||
value: { | ||
specifier: '../../foo', | ||
specifierType: 0, | ||
... | ||
``` | ||
In the `.getAsset 3Xzt5` variant, no quotes/parenthesis are | ||
needed. Alternatively, you can use proper JS: `getAsset("3Xzt5")`. | ||
The variables `assetGraph` and `bundleGraph` contain the deserialized objects. | ||
For a single query, the command (which has to be a JS call) can be specified as a CLI parameter (the | ||
disadvantage here is that the graphs have to be loaded on every call as opposed to once when | ||
starting the REPL): | ||
```sh | ||
$ parcel-query 'findBundleReason("b0696febf20b57ce", "bNAUZ")' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "parcel-query", | ||
"version": "2.8.1", | ||
"private": true, | ||
"bin": "src/bin.js", | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"@parcel/core": "2.8.1", | ||
"@parcel/graph": "2.8.1", | ||
"nullthrows": "^1.1.1", | ||
"v8-compile-cache": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@parcel/babel-register": "2.8.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
if ( | ||
process.env.PARCEL_BUILD_ENV !== 'production' || | ||
process.env.PARCEL_SELF_BUILD | ||
) { | ||
require('@parcel/babel-register'); | ||
} | ||
|
||
require('v8-compile-cache'); | ||
require('./cli'); |
Oops, something went wrong.