Skip to content

Commit 235127f

Browse files
committed
add ponyfill
1 parent 60d0a6c commit 235127f

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

build.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as esbuild from 'esbuild';
22
import * as fs from 'fs';
33

4-
const out = esbuild.buildSync({
4+
esbuild.buildSync({
55
entryPoints: ['src/polyfill.js'],
66
bundle: true,
77
format: 'esm',
@@ -21,5 +21,22 @@ const out = esbuild.buildSync({
2121
// confirm it imports
2222
await import('./text.min.js');
2323

24-
const stat = fs.statSync('text.min.js');
25-
console.info(`text.min.js: ${stat.size}`);
24+
const polyfillStat = fs.statSync('text.min.js');
25+
console.info(`text.min.js: ${polyfillStat.size}`);
26+
27+
esbuild.buildSync({
28+
entryPoints: ['src/ponyfill.js'],
29+
bundle: true,
30+
format: 'cjs',
31+
platform: 'neutral',
32+
sourcemap: 'external',
33+
outfile: './package/ponyfill.js',
34+
target: 'es5',
35+
minify: true,
36+
});
37+
38+
// confirm it imports
39+
await import('./package/ponyfill.js');
40+
41+
const ponyfillStat = fs.statSync('ponyfill.js');
42+
console.info(`ponyfill.js: ${ponyfillStat.size}`);

ponyfill.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ponyfill.js.map

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ponyfill.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { FastTextEncoder } from './o-encoder.js';
2+
export { FastTextDecoder } from './o-decoder.js';

0 commit comments

Comments
 (0)