From f5236c1d880da51d70a8ac24a0922d2e5ded7416 Mon Sep 17 00:00:00 2001 From: Katsuyuki Omuro Date: Fri, 24 Feb 2023 23:49:03 +0900 Subject: [PATCH 1/7] docs: add reference to Fastly's runtime (#5370) Co-authored-by: Logan McAnsh --- contributors.yml | 1 + docs/other-api/adapter.md | 5 ++++- docs/pages/stacks.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contributors.yml b/contributors.yml index 1100adb6314..cec7e6f16bd 100644 --- a/contributors.yml +++ b/contributors.yml @@ -166,6 +166,7 @@ - gyx1000 - hadizz - hardingmatt +- harmony7 - helderburato - HenryVogt - hicksy diff --git a/docs/other-api/adapter.md b/docs/other-api/adapter.md index 1388e403fda..91e58c67a01 100644 --- a/docs/other-api/adapter.md +++ b/docs/other-api/adapter.md @@ -7,7 +7,7 @@ order: 2 ## Official Adapters -Idiomatic Remix apps can generally be deployed anywhere because Remix adapt's the server's request/response to the [Web Fetch API][web-fetch-api]. It does this through adapters. We maintain a few adapters: +Idiomatic Remix apps can generally be deployed anywhere because Remix adapts the server's request/response to the [Web Fetch API][web-fetch-api]. It does this through adapters. We maintain a few adapters: - `@remix-run/architect` - `@remix-run/cloudflare-pages` @@ -26,6 +26,7 @@ Each adapter has the same API. In the future we may have helpers specific to the ## Community Adapters +- [`@fastly/remix-server-adapter`][fastly-remix-server-adapter] - For [Fastly Compute@Edge][fastly-compute-at-edge]. - [`@mcansh/remix-fastify`][remix-fastify] - For [Fastify][fastify]. - [`@mcansh/remix-raw-http`][remix-raw-http] - For a good ol barebones Node server. - [`remix-google-cloud-functions`][remix-google-cloud-functions] - For [Google Cloud][google-cloud-functions] and [Firebase][firebase-functions] functions. @@ -179,6 +180,8 @@ addEventListener("fetch", (event) => { ``` [web-fetch-api]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API +[fastly-remix-server-adapter]: https://github.com/fastly/remix-compute-js/tree/main/packages/remix-server-adapter +[fastly-compute-at-edge]: https://developer.fastly.com/learning/compute/ [remix-google-cloud-functions]: https://github.com/penx/remix-google-cloud-functions [google-cloud-functions]: https://cloud.google.com/functions [firebase-functions]: https://firebase.google.com/docs/functions diff --git a/docs/pages/stacks.md b/docs/pages/stacks.md index 5894e5fa335..a5d10ddb81c 100644 --- a/docs/pages/stacks.md +++ b/docs/pages/stacks.md @@ -63,7 +63,7 @@ The [token just needs `repo` access][repo access token]. #### Dependency versions -If you set the any dependencies in package.json to `*`, the Remix CLI will change it to a semver caret of the latest released version: +If you set any dependencies in package.json to `*`, the Remix CLI will change it to a semver caret of the latest released version: ```diff - "remix": "*", From 48ec9437c4e36b2c9e4311124fa3624d226ca916 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Fri, 24 Feb 2023 14:57:51 -0800 Subject: [PATCH 2/7] Add support for mjs and cjs extensions with CSS imports --- integration/css-side-effect-imports-test.ts | 14 +++++++++----- .../compiler/plugins/cssSideEffectImportsPlugin.ts | 10 ++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/integration/css-side-effect-imports-test.ts b/integration/css-side-effect-imports-test.ts index 3a72c4d10d5..957daf9e24b 100644 --- a/integration/css-side-effect-imports-test.ts +++ b/integration/css-side-effect-imports-test.ts @@ -7,6 +7,7 @@ import { createFixture, css, js, + json, } from "./helpers/create-fixture"; const TEST_PADDING_VALUE = "20px"; @@ -75,7 +76,7 @@ test.describe("CSS side-effect imports", () => { `, "app/routes/basic-side-effect-test.jsx": js` import "../basicSideEffect/styles.css"; - + export default function() { return (
@@ -104,7 +105,7 @@ test.describe("CSS side-effect imports", () => { `, "app/routes/root-relative-test.jsx": js` import "~/rootRelative/styles.css"; - + export default function() { return (
@@ -139,7 +140,7 @@ test.describe("CSS side-effect imports", () => { `, "app/routes/image-urls-test.jsx": js` import "../imageUrls/styles.css"; - + export default function() { return (
@@ -179,7 +180,7 @@ test.describe("CSS side-effect imports", () => { `, "app/routes/root-relative-image-urls-test.jsx": js` import "../rootRelativeImageUrls/styles.css"; - + export default function() { return (
@@ -252,7 +253,7 @@ test.describe("CSS side-effect imports", () => { padding: ${TEST_PADDING_VALUE}; } `, - "node_modules/@test-package/esm/index.js": js` + "node_modules/@test-package/esm/index.mjs": js` import React from 'react'; import './styles.css'; @@ -267,6 +268,9 @@ test.describe("CSS side-effect imports", () => { ); }; `, + "node_modules/@test-package/esm/package.json": json({ + exports: './index.mjs' + }), "app/routes/esm-package-test.jsx": js` import { Test } from "@test-package/esm"; export default function() { diff --git a/packages/remix-dev/compiler/plugins/cssSideEffectImportsPlugin.ts b/packages/remix-dev/compiler/plugins/cssSideEffectImportsPlugin.ts index 57ff4653d52..cf9b1705077 100644 --- a/packages/remix-dev/compiler/plugins/cssSideEffectImportsPlugin.ts +++ b/packages/remix-dev/compiler/plugins/cssSideEffectImportsPlugin.ts @@ -21,17 +21,19 @@ export function isCssSideEffectImportPath(path: string): boolean { return cssSideEffectFilter.test(path); } -const loaders = ["js", "jsx", "ts", "tsx"] as const; -const allJsFilesFilter = new RegExp(`\\.(${loaders.join("|")})$`); +const extensions = ["js", "jsx", "ts", "tsx", "mjs", "cjs"] as const; +const allJsFilesFilter = new RegExp(`\\.(${extensions.join("|")})$`); -type Loader = typeof loaders[number]; -type Extension = `.${Loader}`; +type Loader = 'js' | 'jsx' | 'ts' | 'tsx'; +type Extension = `.${typeof extensions[number]}`; const loaderForExtension: Record = { ".js": "js", ".jsx": "jsx", ".ts": "ts", ".tsx": "tsx", + ".mjs": "js", + ".cjs": "js" }; /** From 041ab6217b7d8b69ed18550945a7152178f689d1 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Fri, 24 Feb 2023 15:02:44 -0800 Subject: [PATCH 3/7] Sign CLA --- contributors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.yml b/contributors.yml index cec7e6f16bd..b8ca8c69158 100644 --- a/contributors.yml +++ b/contributors.yml @@ -105,6 +105,7 @@ - derekr - derenge - developit +- devongovett - dgurns - dhargitai - dhmacs From efaf34fb4b2c74002e33086d44cfc155009bfd75 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 28 Feb 2023 12:04:27 -0500 Subject: [PATCH 4/7] Create .changeset/gorgeous-swans-end.md --- .changeset/gorgeous-swans-end.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/gorgeous-swans-end.md diff --git a/.changeset/gorgeous-swans-end.md b/.changeset/gorgeous-swans-end.md new file mode 100644 index 00000000000..7b35cf6bb56 --- /dev/null +++ b/.changeset/gorgeous-swans-end.md @@ -0,0 +1,6 @@ +--- +"remix": patch +"@remix-run/dev": patch +--- + +Add support for mjs and cjs extensions with CSS imports From 738387fa0c65dc7845fb6183d42036b37ae1451a Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Tue, 14 Mar 2023 09:43:46 +1100 Subject: [PATCH 5/7] Remove `remix` package from changeset --- .changeset/gorgeous-swans-end.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/gorgeous-swans-end.md b/.changeset/gorgeous-swans-end.md index 7b35cf6bb56..8fdc6d2dd10 100644 --- a/.changeset/gorgeous-swans-end.md +++ b/.changeset/gorgeous-swans-end.md @@ -1,5 +1,4 @@ --- -"remix": patch "@remix-run/dev": patch --- From f702a99304ccc529c3215d4e0d7bc4c1d8601ffe Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Tue, 14 Mar 2023 10:30:06 +1100 Subject: [PATCH 6/7] Roll back changes from main --- contributors.yml | 1 - docs/other-api/adapter.md | 5 +---- docs/pages/stacks.md | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/contributors.yml b/contributors.yml index b8ca8c69158..7fe2b66ff95 100644 --- a/contributors.yml +++ b/contributors.yml @@ -167,7 +167,6 @@ - gyx1000 - hadizz - hardingmatt -- harmony7 - helderburato - HenryVogt - hicksy diff --git a/docs/other-api/adapter.md b/docs/other-api/adapter.md index 91e58c67a01..1388e403fda 100644 --- a/docs/other-api/adapter.md +++ b/docs/other-api/adapter.md @@ -7,7 +7,7 @@ order: 2 ## Official Adapters -Idiomatic Remix apps can generally be deployed anywhere because Remix adapts the server's request/response to the [Web Fetch API][web-fetch-api]. It does this through adapters. We maintain a few adapters: +Idiomatic Remix apps can generally be deployed anywhere because Remix adapt's the server's request/response to the [Web Fetch API][web-fetch-api]. It does this through adapters. We maintain a few adapters: - `@remix-run/architect` - `@remix-run/cloudflare-pages` @@ -26,7 +26,6 @@ Each adapter has the same API. In the future we may have helpers specific to the ## Community Adapters -- [`@fastly/remix-server-adapter`][fastly-remix-server-adapter] - For [Fastly Compute@Edge][fastly-compute-at-edge]. - [`@mcansh/remix-fastify`][remix-fastify] - For [Fastify][fastify]. - [`@mcansh/remix-raw-http`][remix-raw-http] - For a good ol barebones Node server. - [`remix-google-cloud-functions`][remix-google-cloud-functions] - For [Google Cloud][google-cloud-functions] and [Firebase][firebase-functions] functions. @@ -180,8 +179,6 @@ addEventListener("fetch", (event) => { ``` [web-fetch-api]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API -[fastly-remix-server-adapter]: https://github.com/fastly/remix-compute-js/tree/main/packages/remix-server-adapter -[fastly-compute-at-edge]: https://developer.fastly.com/learning/compute/ [remix-google-cloud-functions]: https://github.com/penx/remix-google-cloud-functions [google-cloud-functions]: https://cloud.google.com/functions [firebase-functions]: https://firebase.google.com/docs/functions diff --git a/docs/pages/stacks.md b/docs/pages/stacks.md index a5d10ddb81c..5894e5fa335 100644 --- a/docs/pages/stacks.md +++ b/docs/pages/stacks.md @@ -63,7 +63,7 @@ The [token just needs `repo` access][repo access token]. #### Dependency versions -If you set any dependencies in package.json to `*`, the Remix CLI will change it to a semver caret of the latest released version: +If you set the any dependencies in package.json to `*`, the Remix CLI will change it to a semver caret of the latest released version: ```diff - "remix": "*", From ad1fede94e76a3237a260261ed5bfc901207bc90 Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Tue, 14 Mar 2023 10:48:30 +1100 Subject: [PATCH 7/7] Rename and update changeset --- .changeset/css-side-effect-import-extensions.md | 5 +++++ .changeset/gorgeous-swans-end.md | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .changeset/css-side-effect-import-extensions.md delete mode 100644 .changeset/gorgeous-swans-end.md diff --git a/.changeset/css-side-effect-import-extensions.md b/.changeset/css-side-effect-import-extensions.md new file mode 100644 index 00000000000..16699b0394e --- /dev/null +++ b/.changeset/css-side-effect-import-extensions.md @@ -0,0 +1,5 @@ +--- +"@remix-run/dev": patch +--- + +Add support for `.mjs` and `.cjs` extensions when detecting CSS side-effect imports diff --git a/.changeset/gorgeous-swans-end.md b/.changeset/gorgeous-swans-end.md deleted file mode 100644 index 8fdc6d2dd10..00000000000 --- a/.changeset/gorgeous-swans-end.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@remix-run/dev": patch ---- - -Add support for mjs and cjs extensions with CSS imports