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
1 parent
90447b7
commit 8b9d1b8
Showing
29 changed files
with
1,411 additions
and
30 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
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 @@ | ||
# Welcome to Remix! | ||
|
||
[Remix](https://remix.run) is a web framework that helps you build better websites with React. | ||
|
||
To get started, open a new shell and run: | ||
|
||
```sh | ||
npx create-remix@latest | ||
``` | ||
|
||
Then follow the prompts you see in your terminal. | ||
|
||
For more information about Remix, [visit remix.run](https://remix.run)! |
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,3 @@ | ||
import type { AssetsManifest } from "@remix-run/dev/assets-manifest"; | ||
let assetsManifest: AssetsManifest = (window as any).__remixManifest; | ||
export default assetsManifest.cssBundleHref; |
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,23 @@ | ||
{ | ||
"name": "@remix-run/css-bundle", | ||
"description": "Entrypoint for the CSS bundle created by Remix", | ||
"version": "1.7.5", | ||
"license": "MIT", | ||
"main": "./server.js", | ||
"module": "./esm/server.js", | ||
"browser": { | ||
"./server.js": "./browser.js", | ||
"./esm/server.js": "./esm/browser.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/remix-run/remix", | ||
"directory": "packages/remix-css-bundle" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/remix-run/remix/issues" | ||
}, | ||
"dependencies": { | ||
"@remix-run/dev": "1.7.6" | ||
} | ||
} |
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,69 @@ | ||
const babel = require("@rollup/plugin-babel").default; | ||
const nodeResolve = require("@rollup/plugin-node-resolve").default; | ||
const copy = require("rollup-plugin-copy"); | ||
|
||
const { | ||
copyToPlaygrounds, | ||
createBanner, | ||
getOutputDir, | ||
isBareModuleId, | ||
} = require("../../rollup.utils"); | ||
const { name: packageName, version } = require("./package.json"); | ||
|
||
/** @returns {import("rollup").RollupOptions[]} */ | ||
module.exports = function rollup() { | ||
let sourceDir = "packages/remix-css-bundle"; | ||
let outputDir = getOutputDir(packageName); | ||
|
||
return [ | ||
{ | ||
external(id) { | ||
return isBareModuleId(id); | ||
}, | ||
input: [`${sourceDir}/browser.ts`, `${sourceDir}/server.ts`], | ||
output: { | ||
banner: createBanner(packageName, version), | ||
dir: outputDir, | ||
format: "cjs", | ||
preserveModules: true, | ||
exports: "named", | ||
}, | ||
plugins: [ | ||
babel({ | ||
babelHelpers: "bundled", | ||
exclude: /node_modules/, | ||
extensions: [".ts"], | ||
}), | ||
nodeResolve({ extensions: [".ts"] }), | ||
copy({ | ||
targets: [ | ||
{ src: `LICENSE.md`, dest: outputDir }, | ||
{ src: `${sourceDir}/package.json`, dest: outputDir }, | ||
{ src: `${sourceDir}/README.md`, dest: outputDir }, | ||
], | ||
}), | ||
], | ||
}, | ||
{ | ||
external(id) { | ||
return isBareModuleId(id); | ||
}, | ||
input: [`${sourceDir}/browser.ts`, `${sourceDir}/server.ts`], | ||
output: { | ||
banner: createBanner(packageName, version), | ||
dir: `${outputDir}/esm`, | ||
format: "esm", | ||
preserveModules: true, | ||
}, | ||
plugins: [ | ||
babel({ | ||
babelHelpers: "bundled", | ||
exclude: /node_modules/, | ||
extensions: [".ts"], | ||
}), | ||
nodeResolve({ extensions: [".ts"] }), | ||
copyToPlaygrounds(), | ||
], | ||
}, | ||
]; | ||
}; |
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,2 @@ | ||
import assetsManifest from "@remix-run/dev/assets-manifest"; | ||
export default assetsManifest.cssBundleHref; |
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,18 @@ | ||
{ | ||
"exclude": ["__tests__"], | ||
"compilerOptions": { | ||
"lib": ["ES2019", "DOM.Iterable"], | ||
"target": "ES2019", | ||
|
||
"module": "CommonJS", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
"outDir": "../../build/node_modules/@remix-run/css-bundle", | ||
"rootDir": "." | ||
} | ||
} |
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,4 @@ | ||
import type { AssetsManifest } from "@remix-run/dev"; | ||
declare const manifest: AssetsManifest; | ||
export type { AssetsManifest }; | ||
export default manifest; |
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
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
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
43 changes: 43 additions & 0 deletions
43
packages/remix-dev/compiler/plugins/cssEntryModulePlugin.ts
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,43 @@ | ||
import type { Plugin } from "esbuild"; | ||
|
||
import type { RemixConfig } from "../../config"; | ||
import { cssBuildVirtualModule } from "../virtualModules"; | ||
|
||
/** | ||
* Creates a virtual module called `@remix-run/dev/css-build` that imports all | ||
* browser build entry points so that any reachable CSS can be included in a | ||
* single file at the end of the build. | ||
*/ | ||
export function cssEntryModulePlugin(config: RemixConfig): Plugin { | ||
let filter = cssBuildVirtualModule.filter; | ||
|
||
return { | ||
name: "css-entry-module", | ||
setup(build) { | ||
build.onResolve({ filter }, ({ path }) => { | ||
return { | ||
path, | ||
namespace: "css-entry-module", | ||
}; | ||
}); | ||
|
||
build.onLoad({ filter }, async () => { | ||
return { | ||
resolveDir: config.appDirectory, | ||
loader: "js", | ||
contents: [ | ||
`export * as entryClient from ${JSON.stringify( | ||
`./${config.entryClientFile}` | ||
)};`, | ||
...Object.keys(config.routes).map((key, index) => { | ||
let route = config.routes[key]; | ||
return `export * as route${index} from ${JSON.stringify( | ||
`./${route.file}` | ||
)};`; | ||
}), | ||
].join("\n"), | ||
}; | ||
}); | ||
}, | ||
}; | ||
} |
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 @@ | ||
import { type CompileOptions } from "../options"; | ||
import esbuildCssModulesPlugin from "./esbuild-plugin-css-modules/index.js"; | ||
|
||
export function cssModulesPlugin({ mode }: { mode: CompileOptions["mode"] }) { | ||
return esbuildCssModulesPlugin({ | ||
inject: false, | ||
filter: /\.module\.css$/i, // The default includes support for "*.modules.css", so we're limiting the scope here | ||
v2: true, | ||
v2CssModulesOption: { | ||
pattern: mode === "production" ? "[hash]" : "[name]_[local]_[hash]", | ||
}, | ||
}); | ||
} |
Oops, something went wrong.