Skip to content

Commit

Permalink
Implement a Parcel importer for bundle buddy
Browse files Browse the repository at this point in the history
  • Loading branch information
raika-dev committed May 23, 2020
1 parent 5055834 commit 7d3d033
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
Binary file added public/img/parcel_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ class Home extends Component<ImportResolveState & { history: ImportHistory }> {
);
}}
/>
<Route
exact
path="/parcel"
component={(h: { history: History }) => {
return (
<Importer
importType={ImportTypes.PARCEL}
graphFileName="bundle-buddy.json"
history={h.history as any}
/>
);
}}
/>
<Route
path="/:importer/resolve"
component={(h: { history: History }) => {
Expand Down
16 changes: 16 additions & 0 deletions src/import/Describe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ class DescribeImport extends Component<{ history: ImportHistory }> {
Rome
</button>
</Link>
<Link
to="/parcel"
aria-label="parcel project import"
className="no-link-underline"
>
<button className={`type-button project-import parcel-import`}>
<img
width="35px"
height="26px"
alt="parcel logo"
src="/img/parcel_logo.png"
className="parcel-logo"
/>{" "}
Parcel
</button>
</Link>
</div>
<div className="flex">
<button className="project-import" tabIndex={-1}>
Expand Down
14 changes: 14 additions & 0 deletions src/import/Importer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ plugins: [{
);
}

if (type === ImportTypes.PARCEL) {
return (
<div>
<p>
run <code>BUNDLE_BUDDY=true parcel build</code>&nbsp; to generate
the sourcemap files and bundle-buddy.json file for your project
</p>
<code>
<pre>BUNDLE_BUDDY=true parcel build</pre>
</code>
</div>
);
}

return <div />;
}

Expand Down
4 changes: 4 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ img.rome-logo {
zoom: 0.9;
}

img.parcel-logo {
margin: -10px 0 -10px -2px;
}

button.rome-import {
display: flex;
align-items: center;
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type GraphEdges = Edge[];

export enum ImportTypes {
ROLLUP,
PARCEL,
ROME,
WEBPACK
}
Expand Down

0 comments on commit 7d3d033

Please sign in to comment.