Snapshots

This commit is contained in:
Jarred Sumner
2021-10-06 20:02:40 -07:00
parent 4ee2fdf1c6
commit 0d79435ce2
12 changed files with 82 additions and 25 deletions

View File

@@ -7,7 +7,7 @@ __require as require
import {
__HMRModule as HMR
} from "http://localhost:8080/__runtime.js";
import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js";
import * as JSX from "http://localhost:8080/node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js";
var jsx = require(JSX).jsxDEV;
import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js";
@@ -18,12 +18,12 @@ var hmr = new HMR(2497996991, "custom-emotion-jsx/file.jsx"), exports = hmr.expo
(hmr._load = function() {
var Foo = () => jsx("div", {
css: {content: '"it worked!"' }
}, undefined, true, undefined, this);
}, undefined, false, undefined, this);
function test() {
const element = document.createElement("div");
element.id = "custom-emotion-jsx";
document.body.appendChild(element);
ReactDOM.render(jsx(Foo, {}, undefined, true, undefined, this), element);
ReactDOM.render(jsx(Foo, {}, undefined, false, undefined, this), element);
const style = window.getComputedStyle(element.firstChild);
if (!(style["content"] ?? "").includes("it worked!"))
throw new Error('Expected "it worked!" but received: ' + style["content"]);

View File

@@ -0,0 +1,22 @@
import {
__require as require
} from "http://localhost:8080/__runtime.js";
import * as JSX from "http://localhost:8080/node_modules/@emotion/react/jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js";
var jsx = require(JSX).jsxDEV;
import * as $5b3cea55 from "http://localhost:8080/node_modules/react-dom/index.js";
var ReactDOM = require($5b3cea55);
export const Foo = () => jsx("div", {
css: {content: '"it worked!"' }
}, undefined, false, undefined, this);
export function test() {
const element = document.createElement("div");
element.id = "custom-emotion-jsx";
document.body.appendChild(element);
ReactDOM.render(jsx(Foo, {}, undefined, false, undefined, this), element);
const style = window.getComputedStyle(element.firstChild);
if (!(style["content"] ?? "").includes("it worked!"))
throw new Error('Expected "it worked!" but received: ' + style["content"]);
return testDone(import.meta.url);
}

View File

@@ -20,8 +20,8 @@ var hmr = new HMR(2165509932, "multiple-imports.js"), exports = hmr.exports;
(hmr._load = function() {
const bacon = React;
const bacon2 = jsx(JSXFrag, {
children: ["hello"]
}, undefined, true, undefined, this);
children: "hello"
}, undefined, false, undefined, this);
function test() {
console.assert(bacon === React);
console.assert(bacon === React2);

View File

@@ -11,8 +11,8 @@ var { default: React2} = require($bbcd215f);
const bacon = React;
const bacon2 = jsx(JSXFrag, {
children: ["hello"]
}, undefined, true, undefined, this);
children: "hello"
}, undefined, false, undefined, this);
export function test() {
console.assert(bacon === React);
console.assert(bacon === React2);

View File

@@ -23,23 +23,23 @@ var hmr = new HMR(3514348331, "react-context-value-func.tsx"), exports = hmr.exp
const foo = true;
return jsx(Context.Provider, {
value: cb,
children: [children(foo)]
}, undefined, true, undefined, this);
children: children(foo)
}, undefined, false, undefined, this);
};
const ContextValue = ({}) => jsx(Context.Consumer, {
children: [(foo) => {
children: (foo) => {
if (foo)
return jsx("div", {
children: ["Worked!"]
}, undefined, true, undefined, this);
children: "Worked!"
}, undefined, false, undefined, this);
throw `Value "${foo}"" should be true`;
}]
}, undefined, true, undefined, this);
}
}, undefined, false, undefined, this);
const TestComponent = () => jsx(ContextProvider, {
children: [jsx(ContextValue, {}, undefined, true, undefined, this)]
}, undefined, true, undefined, this);
children: jsx(ContextValue, {}, undefined, false, undefined, this)
}, undefined, false, undefined, this);
function test() {
const foo = jsx(TestComponent, {}, undefined, true, undefined, this);
const foo = jsx(TestComponent, {}, undefined, false, undefined, this);
return testDone(import.meta.url);
}
hmr.exportAll({

View File

@@ -0,0 +1,35 @@
import {
__require as require
} from "http://localhost:8080/__runtime.js";
import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js";
var jsx = require(JSX).jsxDEV;
import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
var { default: React} = require($bbcd215f);
const Context = React.createContext({});
const ContextProvider = ({ children }) => {
const [cb, setCB] = React.useState(function() {
});
const foo = true;
return jsx(Context.Provider, {
value: cb,
children: children(foo)
}, undefined, false, undefined, this);
};
const ContextValue = ({}) => jsx(Context.Consumer, {
children: (foo) => {
if (foo)
return jsx("div", {
children: "Worked!"
}, undefined, false, undefined, this);
throw `Value "${foo}"" should be true`;
}
}, undefined, false, undefined, this);
const TestComponent = () => jsx(ContextProvider, {
children: jsx(ContextValue, {}, undefined, false, undefined, this)
}, undefined, false, undefined, this);
export function test() {
const foo = jsx(TestComponent, {}, undefined, false, undefined, this);
return testDone(import.meta.url);
}

View File

@@ -31,7 +31,7 @@ var hmr = new HMR(2717584935, "spread_with_key.tsx"), exports = hmr.exports;
function test() {
console.assert(React.isValidElement(jsx(SpreadWithTheKey, {
className: "foo"
}, undefined, true, undefined, this)));
}, undefined, false, undefined, this)));
return testDone(import.meta.url);
}
hmr.exportAll({

View File

@@ -23,6 +23,6 @@ export function SpreadWithTheKey({
export function test() {
console.assert(React.isValidElement(jsx(SpreadWithTheKey, {
className: "foo"
}, undefined, true, undefined, this)));
}, undefined, false, undefined, this)));
return testDone(import.meta.url);
}

View File

@@ -53,8 +53,8 @@ var hmr = new HMR(1290604342, "styledcomponents-output.js"), exports = hmr.expor
document.body.appendChild(reactEl);
ReactDOM.render(jsx(ErrorScreenRoot, {
id: "error-el",
children: ["The react child should have this text"]
}, undefined, true, undefined, this), reactEl);
children: "The react child should have this text"
}, undefined, false, undefined, this), reactEl);
const style = document.querySelector("style[data-styled]");
console.assert(style, "style tag should exist");
console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints");

View File

@@ -44,8 +44,8 @@ export function test() {
document.body.appendChild(reactEl);
ReactDOM.render(jsx(ErrorScreenRoot, {
id: "error-el",
children: ["The react child should have this text"]
}, undefined, true, undefined, this), reactEl);
children: "The react child should have this text"
}, undefined, false, undefined, this), reactEl);
const style = document.querySelector("style[data-styled]");
console.assert(style, "style tag should exist");
console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints");

View File

@@ -4,5 +4,5 @@
},
"name": "bun-cli-darwin-x64",
"repository": "https://github.com/jarred-sumner/bun",
"version": "0.0.32"
"version": "0.0.34"
}

View File

@@ -9,5 +9,5 @@
"postinstall": "node postinstall.js",
"prepublishOnly": "rm -rf ./bin/bun; chmod +x ./reset-bin.js; cp ./reset-bin.js ./bin/bun"
},
"version": "0.0.32"
"version": "0.0.34"
}