Skip to content

Commit

Permalink
update deps, fix types & add convenience sandbox types
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Feb 10, 2024
1 parent 2b34b1a commit d150391
Show file tree
Hide file tree
Showing 27 changed files with 348 additions and 683 deletions.
30 changes: 29 additions & 1 deletion esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
* PERFORMANCE OF THIS SOFTWARE.
*/

import cc from '@exact-realty/esbuild-plugin-closure-compiler';
import inlineScripts from '@exact-realty/esbuild-plugin-inline-js';
import esbuild from 'esbuild';
import cc from '@exact-realty/esbuild-plugin-closure-compiler';
import { readdir, readFile, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import defaultAllowedGlobalProps from './defaultAllowedGlobalProps.config.mjs';

/**
Expand Down Expand Up @@ -216,3 +218,29 @@ options.define['__buildtimeSettings__.isolationStategyIframeSole'] = 'true';
options.define['__buildtimeSettings__.isolationStategyIframeWorker'] = 'false';

await browserBuild(['./src/exports/browser-window.ts']);

const cjsDeclarationFiles = async (directoryPath) => {
const entries = await readdir(directoryPath, {
withFileTypes: true,
recursive: true,
});

await Promise.all(
entries
.filter((entry) => {
return entry.isFile() && entry.name.endsWith('.d.ts');
})
.map(async (file) => {
const name = join(file.path, file.name);
const newName = name.slice(0, -2) + 'cts';

const contents = await readFile(name, { encoding: 'utf-8' });
await writeFile(
newName,
contents.replace(/(?<=\.)js(?=['"])/g, 'cjs'),
);
}),
);
};

await cjsDeclarationFiles('dist');
Loading

0 comments on commit d150391

Please sign in to comment.