Skip to content

Commit

Permalink
chore: upgrade rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 14, 2023
1 parent 05eca46 commit f5ed32d
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 207 deletions.
433 changes: 264 additions & 169 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,18 @@
"devDependencies": {
"@microsoft/api-extractor": "^7.19.5",
"@playwright/test": "^1.17.1",
"@types/fs-extra": "^9.0.13",
"@rollup/plugin-terser": "^0.4.3",
"@types/fs-extra": "^11.0.2",
"@types/node": "^18.17.15",
"@types/react": "^17.0.42",
"concurrently": "^7.0.0",
"domino": "^2.1.6",
"fs-extra": "^10.0.1",
"fs-extra": "^11.1.1",
"gzip-size": "^6.0.0",
"np": "^7.6.1",
"playwright": "^1.17.2",
"prettier": "^2.6.0",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.29.1",
"tslib": "^2.3.1",
"tsm": "^2.2.1",
"typescript": "^4.6.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BuildOptions } from './utils';
import type { BuildOptions } from './utils.js';
import { join } from 'path';
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';

Expand Down
6 changes: 3 additions & 3 deletions scripts/build-atomics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
syncCommunicationModulesPlugin,
versionPlugin,
watchDir,
} from './utils';
} from './utils.js';
import { join } from 'path';
import { minifyPlugin } from './minify';
import { webWorkerBlobUrlPlugin } from './build-web-worker';
import { minifyPlugin } from './minify.js';
import { webWorkerBlobUrlPlugin } from './build-web-worker.js';

export function buildAtomics(opts: BuildOptions): RollupOptions[] {
const rollups: RollupOptions[] = [];
Expand Down
6 changes: 4 additions & 2 deletions scripts/build-integration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { BuildOptions, submodulePackageJson } from './utils';
import { BuildOptions, submodulePackageJson } from './utils.js';
import { join } from 'path';
import type { OutputOptions, RollupOptions } from 'rollup';
import { readFile } from 'fs-extra';
import fsExtra from 'fs-extra';

const { readFile } = fsExtra;

export function buildIntegration(opts: BuildOptions): RollupOptions {
const output: OutputOptions[] = [
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-main-snippet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BuildOptions, fileSize, jsBannerPlugin, versionPlugin } from './utils';
import { BuildOptions, fileSize, jsBannerPlugin, versionPlugin } from './utils.js';
import { join } from 'path';
import { minifyPlugin } from './minify';
import { minifyPlugin } from './minify.js';
import type { OutputOptions, Plugin, RollupOptions } from 'rollup';

export function buildMainSnippet(opts: BuildOptions): RollupOptions {
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-media-implementations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { OutputOptions, RollupOptions } from 'rollup';
import { BuildOptions, fileSize, jsBannerPlugin, versionPlugin, watchDir } from './utils';
import { BuildOptions, fileSize, jsBannerPlugin, versionPlugin, watchDir } from './utils.js';
import { join } from 'path';
import { minifyPlugin } from './minify';
import { minifyPlugin } from './minify.js';

export function buildMediaImplementation(opts: BuildOptions): RollupOptions {
const debugOutput: OutputOptions = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-react.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BuildOptions, submodulePackageJson, submodulePath } from './utils';
import { BuildOptions, submodulePackageJson, submodulePath } from './utils.js';
import { join } from 'path';
import type { RollupOptions } from 'rollup';

Expand Down
10 changes: 6 additions & 4 deletions scripts/build-service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {
syncCommunicationModulesPlugin,
versionPlugin,
watchDir,
} from './utils';
} from './utils.js';
import { join } from 'path';
import { minifyPlugin } from './minify';
import { writeFile } from 'fs-extra';
import { webWorkerBlobUrlPlugin } from './build-web-worker';
import { minifyPlugin } from './minify.js';
import fsExtra from 'fs-extra';
import { webWorkerBlobUrlPlugin } from './build-web-worker.js';

const { writeFile } = fsExtra;

export function buildServiceWorker(opts: BuildOptions): RollupOptions {
const swDebug: OutputOptions = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-services.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BuildOptions, submodulePackageJson } from './utils';
import { BuildOptions, submodulePackageJson } from './utils.js';
import { join } from 'path';
import type { OutputOptions, RollupOptions } from 'rollup';

Expand Down
2 changes: 1 addition & 1 deletion scripts/build-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BuildOptions, submodulePackageJson } from './utils';
import { BuildOptions, submodulePackageJson } from './utils.js';
import { join } from 'path';
import type { RollupOptions } from 'rollup';

Expand Down
8 changes: 5 additions & 3 deletions scripts/build-web-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import {
onwarn,
syncCommunicationModulesPlugin,
versionPlugin,
} from './utils';
} from './utils.js';
import { join } from 'path';
import { writeFile } from 'fs-extra';
import { minifyPlugin } from './minify';
import fsExtra from 'fs-extra';
import { minifyPlugin } from './minify.js';

const { writeFile } = fsExtra;

export async function buildWebWorker(opts: BuildOptions, msgType: MessageType, debug: boolean) {
const build = await rollup({
Expand Down
24 changes: 13 additions & 11 deletions scripts/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import type { BuildOptions, PackageJson } from './utils';
import { buildApi } from './build-api';
import { buildAtomics } from './build-atomics';
import { buildIntegration } from './build-integration';
import { buildMediaImplementation } from './build-media-implementations';
import { buildMainSnippet } from './build-main-snippet';
import { buildReact } from './build-react';
import { buildServiceWorker } from './build-service-worker';
import { buildServices } from './build-services';
import { buildUtils } from './build-utils';
import { emptyDir, ensureDir, readJsonSync, writeFile } from 'fs-extra';
import type { BuildOptions, PackageJson } from './utils.js';
import { buildApi } from './build-api.js';
import { buildAtomics } from './build-atomics.js';
import { buildIntegration } from './build-integration.js';
import { buildMediaImplementation } from './build-media-implementations.js';
import { buildMainSnippet } from './build-main-snippet.js';
import { buildReact } from './build-react.js';
import { buildServiceWorker } from './build-service-worker.js';
import { buildServices } from './build-services.js';
import { buildUtils } from './build-utils.js';
import fsExtra from 'fs-extra';
import { join } from 'path';

const { emptyDir, ensureDir, readJsonSync, writeFile } = fsExtra;

export async function runBuild(rootDir: string, isDev: boolean, isReleaseBuild: boolean) {
const opts = createBuildOptions(rootDir, isDev, isReleaseBuild);

Expand Down
2 changes: 1 addition & 1 deletion scripts/minify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BuildOptions } from './utils';
import type { Plugin } from 'rollup';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';
import type { MinifyOptions } from 'terser';

export function minifyPlugin(opts: BuildOptions, debug: boolean) {
Expand Down
5 changes: 4 additions & 1 deletion scripts/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// build scripts are generated after tsc runs
import { runBuild } from '../tsc/scripts/index.js';
import { join } from 'path';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));

export default function (cmdArgs) {
const rootDir = join(__dirname, '..');
Expand Down
4 changes: 3 additions & 1 deletion scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import gzipSize from 'gzip-size';
import { basename, join } from 'path';
import { readdirSync, readFileSync, readJson, statSync, writeJson } from 'fs-extra';
import fsExtra from 'fs-extra';
import type { Plugin, RollupWarning } from 'rollup';

const { readdirSync, readFileSync, readJson, statSync, writeJson } = fsExtra;

export function syncCommunicationModulesPlugin(opts: BuildOptions, msgType: MessageType): Plugin {
return {
name: 'syncCommunicationModulesPlugin',
Expand Down

0 comments on commit f5ed32d

Please sign in to comment.