-
Notifications
You must be signed in to change notification settings - Fork 131
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
6abc075
commit f63baa3
Showing
26 changed files
with
135 additions
and
104 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
import assert from "node:assert"; | ||
import { test } from "node:test"; | ||
|
||
import * as tslibJs from "tslib/tslib.js"; | ||
import * as tslibEs6Js from "tslib/tslib.es6.js"; | ||
import * as tslibEs6Mjs from "tslib/tslib.es6.mjs"; | ||
import * as tslibModulesIndex from "tslib/modules/index.js"; | ||
|
||
test("all helpers available as named exports", () => { | ||
compareKeys("tslib.js", tslibJs, "tslib.es6.js", tslibEs6Js); | ||
compareKeys("tslib.js", tslibJs, "tslib.es6.mjs", tslibEs6Mjs); | ||
compareKeys("tslib.js", tslibJs, "modules/index.js", tslibModulesIndex); | ||
}); | ||
|
||
test("default export contains all named exports", () => { | ||
assert.ok(tslibJs.default); | ||
compareKeys("tslib.js (default export)", tslibJs.default, "tslib.js (namespace)", tslibJs); | ||
assert.ok(tslibEs6Js.default); | ||
compareKeys("tslib.es6.js (default export)", tslibEs6Js.default, "tslib.es6.js (namespace)", tslibEs6Js); | ||
assert.ok(tslibEs6Mjs.default); | ||
compareKeys("tslib.es6.mjs (default export)", tslibEs6Mjs.default, "tslib.es6.mjs (namespace)", tslibEs6Mjs); | ||
}); | ||
|
||
/** | ||
* @param {string} name1 | ||
* @param {object} tslib1 | ||
* @param {string} name2 | ||
* @param {object} tslib2 | ||
*/ | ||
function compareKeys(name1, tslib1, name2, tslib2) { | ||
const difference = new Set(Object.keys(tslib1)).symmetricDifference(new Set(Object.keys(tslib2))); | ||
difference.delete("__esModule"); | ||
difference.delete("default"); // Asserted separately where expected | ||
const messages = Array.from(difference).map(missing => `'${missing}' missing in ${missing in tslib1 ? name2 : name1}`); | ||
if (messages.length > 0) { | ||
assert.fail(`Mismatch between ${name1} and ${name2}:\n\n ${messages.join("\n ")}\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,6 @@ | ||
{ | ||
"type": "module", | ||
"scripts": { | ||
"test": "node --test --experimental-detect-module" | ||
} | ||
} |
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,24 @@ | ||
import { describe } from "node:test"; | ||
|
||
import * as tslibJs from "tslib/tslib.js"; | ||
import * as tslibEs6Js from "tslib/tslib.es6.js"; | ||
import * as tslibEs6Mjs from "tslib/tslib.es6.mjs"; | ||
|
||
/** | ||
* @template {keyof tslibJs} K | ||
* @param {K} helperName | ||
* @param {(helper: tslibJs[K]) => any} test | ||
*/ | ||
export function testHelper(helperName, test) { | ||
describe(helperName, () => { | ||
describe("tslib.js", () => { | ||
test(tslibJs[helperName]); | ||
}); | ||
describe("tslib.es6.js", () => { | ||
test(tslibEs6Js[helperName]); | ||
}); | ||
describe("tslib.es6.mjs", () => { | ||
test(tslibEs6Mjs[helperName]); | ||
}); | ||
}); | ||
} |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "NodeNext", | ||
"checkJs": true, | ||
"noEmit": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"types": ["node"], | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
{ | ||
"dependencies": { | ||
"chalk": "^4.1.2", | ||
"rollup": "4.22.0", | ||
"tslib": "file:..", | ||
"rollup": "2.28.2", | ||
"@rollup/plugin-node-resolve": "9.0.0", | ||
"webpack": "4.44.2", | ||
"webpack-cli": "3.3.12", | ||
"snowpack": "2.12.1", | ||
"vite": "2.8.0" | ||
"vite": "5.4.6", | ||
"webpack": "5.94.0", | ||
"webpack-cli": "5.1.4" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
|
||
export default { | ||
input: 'index.js', | ||
output: { | ||
dir: 'build', | ||
format: 'cjs' | ||
}, | ||
plugins: [nodeResolve()] | ||
}; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,5 @@ | ||
{ | ||
"scripts": { | ||
"test": "webpack && node build/main.js" | ||
} | ||
} |
File renamed without changes.
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