Merge branch 'main' into dylan/ref-string

This commit is contained in:
Dylan Conway
2024-10-12 00:49:20 -07:00
committed by GitHub
2 changed files with 7 additions and 483 deletions

View File

@@ -58,486 +58,11 @@ NS.then(({ fn: fn2 }) => {
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"r6c8x1cc"`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"d1c7nm6t"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"vanwb97w"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"rm7e36cf"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"r6c8x1cc"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;
exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build Bun.write(BuildArtifact) 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build outdir + reading out blobs works 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"r6c8x1cc"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"vanwb97w"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"r6c8x1cc"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;
exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build Bun.write(BuildArtifact) 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build outdir + reading out blobs works 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;
exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build Bun.write(BuildArtifact) 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build outdir + reading out blobs works 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;
exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build Bun.write(BuildArtifact) 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build outdir + reading out blobs works 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;
exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build Bun.write(BuildArtifact) 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build outdir + reading out blobs works 1`] = `
"var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: (newValue) => all[name] = () => newValue
});
};
// test/bundler/fixtures/trivial/fn.js
var exports_fn = {};
__export(exports_fn, {
fn: () => fn
});
function fn(a) {
return a + 42;
}
// test/bundler/fixtures/trivial/index.js
var NS = Promise.resolve().then(() => exports_fn);
NS.then(({ fn: fn2 }) => {
console.log(fn2(42));
});
"
`;
exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"d1c7nm6t"`;
exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`;

View File

@@ -24,11 +24,11 @@ describe("Bun.build", () => {
entrypoints: [join(dir, "a.css")],
experimentalCss: true,
minify: true,
})
});
expect(build.outputs).toHaveLength(1);
expect(build.outputs[0].kind).toBe("entry-point");
expect(await build.outputs[0].text()).toEqualIgnoringWhitespace('.hello{color:#00f}.hi{color:red}\n');
expect(await build.outputs[0].text()).toEqualIgnoringWhitespace(".hello{color:#00f}.hi{color:red}\n");
});
test("experimentalCss = false works", async () => {
@@ -51,12 +51,11 @@ describe("Bun.build", () => {
entrypoints: [join(dir, "a.css")],
outdir: join(dir, "out"),
minify: true,
})
});
console.log(build.outputs);
expect(build.outputs).toHaveLength(2);
expect(build.outputs[0].kind).toBe("entry-point");
expect(await build.outputs[0].text()).not.toEqualIgnoringWhitespace('.hello{color:#00f}.hi{color:red}\n');
expect(await build.outputs[0].text()).not.toEqualIgnoringWhitespace(".hello{color:#00f}.hi{color:red}\n");
});
test("bytecode works", async () => {