Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency styled-components to v5.2.0 #4

Merged
merged 7 commits into from
Sep 9, 2020
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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ Upstream repo at https://github.com/styled-components/styled-components.

### Production

https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/esm/styled-components.min.js
https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/esm/styled-components.browser.min.js

https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/system/styled-components.min.js
https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/system/styled-components.browser.min.js

### Development

https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/esm/styled-components.js
https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/esm/styled-components.browser.js

https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/system/styled-components.js
https://cdn.jsdelivr.net/npm/@esm-bundle/styled-components/system/styled-components.browser.js

## Unpkg

### Production

https://unpkg.com/@esm-bundle/styled-components/esm/styled-components.min.js
https://unpkg.com/@esm-bundle/styled-components/esm/styled-components.browser.min.js

https://unpkg.com/@esm-bundle/styled-components/system/styled-components.min.js
https://unpkg.com/@esm-bundle/styled-components/system/styled-components.browser.min.js

### Development

https://unpkg.com/@esm-bundle/styled-components/esm/styled-components.js
https://unpkg.com/@esm-bundle/styled-components/esm/styled-components.browser.js

https://unpkg.com/@esm-bundle/styled-components/system/styled-components.js
https://unpkg.com/@esm-bundle/styled-components/system/styled-components.browser.js

## Npm

Expand Down
20 changes: 11 additions & 9 deletions browser-test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ describe("@esm-bundle/styled-components esm import", () => {

describe("@esm-bundle/styled-components System.register import", () => {
it("can load", () => {
return System.import("/base/system/styled-components.js").then((module) => {
expect(module.default).toBeDefined();
expect(module.__esModule).toEqual(true);
// Default export
expect(typeof module.default.div).toBe("function");
// Named export
expect(typeof module.keyframes).toBe("function");
});
return System.import("/base/system/styled-components.browser.js").then(
(module) => {
expect(module.default).toBeDefined();
expect(module.__esModule).toEqual(true);
// Default export
expect(typeof module.default.div).toBe("function");
// Named export
expect(typeof module.keyframes).toBe("function");
}
);
});

it("can load", () => {
return System.import("/base/system/styled-components.min.js").then(
return System.import("/base/system/styled-components.browser.min.js").then(
(module) => {
expect(module.default).toBeDefined();
expect(module.__esModule).toEqual(true);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@esm-bundle/styled-components",
"version": "5.1.1",
"description": "Repo to autopublish esm-bundle version of styled-components",
"main": "esm/styled-components.js",
"main": "esm/styled-components.browser.js",
"module": "esm/styled-components.js",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -42,6 +42,6 @@
"karma-parallel": "0.3.1",
"react": "npm:@esm-bundle/react",
"react-is": "npm:@esm-bundle/react-is",
"styled-components": "5.1.1"
"styled-components": "5.2.0"
}
}
35 changes: 24 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ import { terser } from "rollup-plugin-terser";

function createConfig(format, options = {}) {
const dir = format === "module" ? "esm" : format;
const { resolved = false, min = false } = options;
const { resolved = false, min = false, browser = false } = options;
const input = browser || resolved ? "src/browser.js" : "src/index.js";
const file = [
dir,
"/styled-components",
browser && ".browser",
resolved && ".resolved",
min && ".min",
".js",
]
.filter(Boolean)
.join("");

return {
input: `src/index.js`,
input,
output: {
file: `${dir}/styled-components${resolved ? ".resolved" : ""}${
min ? ".min" : ""
}.js`,
file,
sourcemap: true,
format,
paths: {
Expand All @@ -21,29 +31,32 @@ function createConfig(format, options = {}) {
"react-is": resolved
? "//cdn.jsdelivr.net/npm/@esm-bundle/[email protected]/esm/react-is.production.min.js"
: "react-is",
stream: resolved ? "//cdn.jsdelivr.net/npm/[email protected]" : "stream",
},
exports: "named",
},
plugins: [
resolve(),
commonjs(),
replace({
values: {
"process.env.NODE_ENV": JSON.stringify(
min ? "production" : "development"
),
},
"process.env.NODE_ENV": JSON.stringify(
min ? "production" : "development"
),
}),
min && terser(),
],
external: ["react-is", "react"],
external: ["react-is", "react", "stream"],
};
}

export default [
createConfig("module"),
createConfig("module", { browser: true }),
createConfig("module", { min: true }),
createConfig("module", { min: true, browser: true }),
createConfig("module", { resolved: true }),
createConfig("system"),
createConfig("system", { browser: true }),
createConfig("system", { min: true }),
createConfig("system", { min: true, browser: true }),
];
5 changes: 5 additions & 0 deletions src/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Using the browser build that removes the need for node streams (for server rendering)
import styled from "styled-components/dist/styled-components.browser.esm.js";
export default styled;
export * from "styled-components/dist/styled-components.browser.esm.js";
export const __esModule = true;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Using the browser build that removes the need for node streams (for server rendering)
import styled from "styled-components/dist/styled-components.browser.esm.js";
import styled from "styled-components/dist/styled-components.esm.js";
export default styled;
export * from "styled-components/dist/styled-components.browser.esm.js";
export * from "styled-components/dist/styled-components.esm.js";
export const __esModule = true;
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5822,10 +5822,10 @@ [email protected], strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=

styled-components@5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.1.1.tgz#96dfb02a8025794960863b9e8e365e3b6be5518d"
integrity sha512-1ps8ZAYu2Husx+Vz8D+MvXwEwvMwFv+hqqUwhNlDN5ybg6A+3xyW1ECrAgywhvXapNfXiz79jJyU0x22z0FFTg==
styled-components@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.2.0.tgz#6dcb5aa8a629c84b8d5ab34b7167e3e0c6f7ed74"
integrity sha512-9qE8Vgp8C5cpGAIdFaQVAl89Zgx1TDM4Yf4tlHbO9cPijtpSXTMLHy9lmP0lb+yImhgPFb1AmZ1qMUubmg3HLg==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/traverse" "^7.4.5"
Expand Down