Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update deps, fix types & add convenience sandbox types #31

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading