Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/dev/s2-docs/.parcelrc-s2-docs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
},
"packagers": {
"*.json": "parcel-packager-docs"
}
},
"namers": ["./S2DocsNamer.js", "..."]
}
12 changes: 12 additions & 0 deletions packages/dev/s2-docs/S2DocsNamer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const {Namer} = require('@parcel/plugin');
const path = require('path');

module.exports = new Namer({
name({bundle}) {
// Content hashing plant images messes up RSC parsing, and we don't expect these to ever change.
let asset = bundle.getMainEntry();
if (asset && asset.filePath.startsWith(path.join(__dirname, 'pages/react-aria/examples/plants/plants'))) {
return 'assets/plants/' + path.basename(asset.filePath);
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function App(): React.ReactNode {
};

return (
<div className="h-full flex flex-col gap-4 p-4 max-w-[600px] mx-auto">
<div className="flex flex-col gap-4 p-4 max-w-[600px] mx-auto">
<div className="grid grid-cols-[1fr_auto_auto] sm:grid-cols-[1.1fr_auto_auto_1fr_auto] gap-2 items-end">
<SearchField
aria-label="Search"
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/s2-docs/src/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-ignore
import assets from 'url:../pages/**/*.{png,jpg,svg}';
import assets from 'url:../pages/**/*.{png,jpg,svg}' with {env: 'react-client'};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensuring we only get one copy of the images, not one for the server environment and one for the client environment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find any documentation on this import, is it specific to parcel or one of our pipelines?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this is a secret parcel syntax. ideally images would not be specific to an environment in the first place but that will require an upstream change. this is a quick workaround.

import {cache, ReactNode} from 'react';
import {Code, ICodeProps} from './Code';
import {CodePlatter, FileProvider, Pre} from './CodePlatter';
Expand Down