From 0540cad9e0c7092f1b3f64e237188375459bf3be Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 21 Sep 2024 12:11:51 -0400 Subject: [PATCH 1/3] moduleResolution nodenext This updates the monorepo tsconfig to use module: nodenext, moduleResolution: nodenext. Under this setting, typescript respect the Node's ideas about which files are CJS vs ESM. Most of our modules still compile to CJS, this PR isn't doing that conversion. This PR does convert the `@embroider/vite` package to build as ESM, because vite itself makes it impossible to consume it's types from a CJS packge, and `@embroider/vite`'s outbound deps aren't too bad. This does mean that when `@embroider/vite` imports from `@embroider/core` it needs to actually treat core as CJS, which is weird-looking but acceptable for now. --- package.json | 3 +- packages/addon-dev/package.json | 4 +- packages/compat/package.json | 2 +- packages/core/package.json | 1 - packages/core/src/measure-concat.ts | 3 +- packages/macros/package.json | 2 +- packages/macros/src/macros-config.ts | 2 +- packages/shared-internals/package.json | 3 +- packages/vite/package.json | 12 +++- packages/vite/src/assets.ts | 6 +- packages/vite/src/content-for.ts | 6 +- packages/vite/src/esbuild-request.ts | 5 +- packages/vite/src/esbuild-resolver.ts | 10 +-- packages/vite/src/optimize-deps.ts | 2 +- packages/vite/src/request.ts | 3 +- packages/vite/src/resolver.ts | 9 +-- packages/vite/src/scripts.ts | 5 +- packages/vite/tests/optimize-deps.test.ts | 2 +- packages/webpack/src/ember-webpack.ts | 13 ++-- pnpm-lock.yaml | 85 ++++++++++------------- test-packages/support/package.json | 2 +- tests/scenarios/helpers/v2-addon.ts | 3 +- tsconfig.json | 3 +- 23 files changed, 93 insertions(+), 93 deletions(-) diff --git a/package.json b/package.json index b11a3f93b..d78dcbe08 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,5 @@ "unlabeled": ":question: Unlabeled" }, "wildcardLabel": "unlabeled" - }, - "packageManager": "pnpm@8.15.8+sha256.691fe176eea9a8a80df20e4976f3dfb44a04841ceb885638fe2a26174f81e65e" + } } diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index fb89e6367..0b664c6fd 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -35,8 +35,8 @@ }, "dependencies": { "@embroider/core": "workspace:^", - "@rollup/pluginutils": "^4.1.1", - "content-tag": "^2.0.1", + "@rollup/pluginutils": "^5.1.0", + "content-tag": "^2.0.2", "fs-extra": "^10.0.0", "minimatch": "^3.0.4", "rollup-plugin-copy-assets": "^2.0.3", diff --git a/packages/compat/package.json b/packages/compat/package.json index 8a1300352..aa301d7eb 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -88,7 +88,7 @@ "@types/resolve": "^1.20.0", "@types/semver": "^7.3.6", "broccoli-node-api": "^1.7.0", - "code-equality-assertions": "^0.9.0", + "code-equality-assertions": "^1.0.1", "ember-engines": "^0.8.19", "scenario-tester": "^3.0.1", "typescript": "^5.4.5" diff --git a/packages/core/package.json b/packages/core/package.json index 1568c1fc2..7d20450fa 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -35,7 +35,6 @@ "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "fast-sourcemap-concat": "^2.1.1", - "filesize": "^10.0.7", "fs-extra": "^9.1.0", "fs-tree-diff": "^2.0.1", "handlebars": "^4.7.7", diff --git a/packages/core/src/measure-concat.ts b/packages/core/src/measure-concat.ts index 245ed83d9..e2b6983f2 100644 --- a/packages/core/src/measure-concat.ts +++ b/packages/core/src/measure-concat.ts @@ -1,7 +1,6 @@ import type SourceMapConcat from 'fast-sourcemap-concat'; import { join } from 'path'; import { statSync } from 'fs'; -import { filesize } from 'filesize'; export default class MeasureConcat { stats: { [filename: string]: number } = {}; @@ -19,7 +18,7 @@ export default class MeasureConcat { console.log( Object.entries(this.stats) .sort((a, b) => b[1] - a[1]) - .map(([name, bytes]) => ` ${name}: ${filesize(bytes, {})}`) + .map(([name, bytes]) => ` ${name}: ${bytes} bytes`) .join('\n') ); return await this.concat.end(); diff --git a/packages/macros/package.json b/packages/macros/package.json index b70f23f2e..5032dce95 100644 --- a/packages/macros/package.json +++ b/packages/macros/package.json @@ -48,7 +48,7 @@ "@types/resolve": "^1.20.0", "@types/semver": "^7.3.6", "babel-plugin-ember-template-compilation": "^2.3.0", - "code-equality-assertions": "^0.9.0", + "code-equality-assertions": "^1.0.1", "scenario-tester": "^3.0.1", "typescript": "^5.4.5" }, diff --git a/packages/macros/src/macros-config.ts b/packages/macros/src/macros-config.ts index c2704167d..0402d02e0 100644 --- a/packages/macros/src/macros-config.ts +++ b/packages/macros/src/macros-config.ts @@ -71,7 +71,7 @@ function gatherAddonCacheKey(project: any): string { } const babelCacheBustingPluginPath: string = require.resolve( - '@embroider/shared-internals/src/babel-plugin-cache-busting.js' + '@embroider/shared-internals/src/babel-plugin-cache-busting' ); export default class MacrosConfig { diff --git a/packages/shared-internals/package.json b/packages/shared-internals/package.json index 794dcfd75..7e73705d0 100644 --- a/packages/shared-internals/package.json +++ b/packages/shared-internals/package.json @@ -13,8 +13,7 @@ "browser": "./src/browser-index.js", "default": "./src/index.js" }, - "./src/babel-plugin-cache-busting.js": "./src/babel-plugin-cache-busting.js", - "./src/template-colocation-plugin": "./src/template-colocation-plugin.js" + "./src/*": "./src/*.js" }, "license": "MIT", "author": "Edward Faulkner", diff --git a/packages/vite/package.json b/packages/vite/package.json index 152b81cd1..474378109 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,7 +1,13 @@ { "name": "@embroider/vite", "version": "0.2.0", - "main": "index.mjs", + "type": "module", + "exports": { + ".": { + "default": "./index.mjs", + "types": "./index.d.ts" + } + }, "peerDependencies": { "@embroider/core": "workspace:^", "vite": "^5.2.0" @@ -13,9 +19,9 @@ "@babel/core": "^7.22.9", "@embroider/macros": "workspace:*", "@embroider/reverse-exports": "workspace:*", - "@rollup/pluginutils": "^4.1.1", + "@rollup/pluginutils": "^5.1.0", "assert-never": "^1.2.1", - "content-tag": "^2.0.1", + "content-tag": "^2.0.2", "debug": "^4.3.2", "esbuild": "^0.17.19", "fast-glob": "^3.3.2", diff --git a/packages/vite/src/assets.ts b/packages/vite/src/assets.ts index c7e674d2e..4f1b95b5b 100644 --- a/packages/vite/src/assets.ts +++ b/packages/vite/src/assets.ts @@ -1,9 +1,11 @@ import type { Resolver } from '@embroider/core'; -import { ResolverLoader } from '@embroider/core'; +import core from '@embroider/core'; +const { ResolverLoader } = core; import type { Plugin } from 'vite'; import * as process from 'process'; import { join, posix } from 'path'; -import { existsSync, readFileSync, lstatSync } from 'fs-extra'; +import fs from 'fs-extra'; +const { existsSync, readFileSync, lstatSync } = fs; import send from 'send'; import type { Readable } from 'stream'; diff --git a/packages/vite/src/content-for.ts b/packages/vite/src/content-for.ts index 5561068de..254fea780 100644 --- a/packages/vite/src/content-for.ts +++ b/packages/vite/src/content-for.ts @@ -1,7 +1,9 @@ import type { Plugin } from 'vite'; -import { readJSONSync } from 'fs-extra'; +import fs from 'fs-extra'; +const { readJSONSync } = fs; import { join } from 'path'; -import { locateEmbroiderWorkingDir } from '@embroider/core'; +import core from '@embroider/core'; +const { locateEmbroiderWorkingDir } = core; export function contentFor(): Plugin { return { diff --git a/packages/vite/src/esbuild-request.ts b/packages/vite/src/esbuild-request.ts index 59d63a05a..f2f25e0dd 100644 --- a/packages/vite/src/esbuild-request.ts +++ b/packages/vite/src/esbuild-request.ts @@ -1,8 +1,9 @@ -import { type ModuleRequest, cleanUrl, packageName } from '@embroider/core'; +import core from '@embroider/core'; +const { cleanUrl, packageName } = core; import type { ImportKind, OnResolveResult, PluginBuild } from 'esbuild'; import { dirname } from 'path'; -import type { PackageCache as _PackageCache, Resolution } from '@embroider/core'; +import type { PackageCache as _PackageCache, Resolution, ModuleRequest } from '@embroider/core'; import { externalName } from '@embroider/reverse-exports'; type PublicAPI = { [K in keyof T]: T[K] }; diff --git a/packages/vite/src/esbuild-resolver.ts b/packages/vite/src/esbuild-resolver.ts index dad7b8186..ace8d1db4 100644 --- a/packages/vite/src/esbuild-resolver.ts +++ b/packages/vite/src/esbuild-resolver.ts @@ -1,9 +1,11 @@ import type { Plugin as EsBuildPlugin, OnLoadResult, PluginBuild, ResolveResult } from 'esbuild'; import { transform } from '@babel/core'; -import { ResolverLoader, virtualContent, needsSyntheticComponentJS, isInComponents } from '@embroider/core'; -import { readFileSync } from 'fs-extra'; -import { EsBuildModuleRequest } from './esbuild-request'; -import assertNever from 'assert-never'; +import core from '@embroider/core'; +const { ResolverLoader, virtualContent, needsSyntheticComponentJS, isInComponents } = core; +import fs from 'fs-extra'; +const { readFileSync } = fs; +import { EsBuildModuleRequest } from './esbuild-request.js'; +import { assertNever } from 'assert-never'; import { hbsToJS } from '@embroider/core'; import { Preprocessor } from 'content-tag'; import { extname } from 'path'; diff --git a/packages/vite/src/optimize-deps.ts b/packages/vite/src/optimize-deps.ts index 13e9b9e1b..d0ee47ff2 100644 --- a/packages/vite/src/optimize-deps.ts +++ b/packages/vite/src/optimize-deps.ts @@ -1,4 +1,4 @@ -import { esBuildResolver } from './esbuild-resolver'; +import { esBuildResolver } from './esbuild-resolver.js'; export interface OptimizeDeps { exclude?: string[]; diff --git a/packages/vite/src/request.ts b/packages/vite/src/request.ts index 677c217e3..e0e19d63d 100644 --- a/packages/vite/src/request.ts +++ b/packages/vite/src/request.ts @@ -1,5 +1,6 @@ import type { ModuleRequest, Resolution } from '@embroider/core'; -import { cleanUrl, getUrlQueryParams } from '@embroider/core'; +import core from '@embroider/core'; +const { cleanUrl, getUrlQueryParams } = core; import type { PluginContext, ResolveIdResult } from 'rollup'; export const virtualPrefix = 'embroider_virtual:'; diff --git a/packages/vite/src/resolver.ts b/packages/vite/src/resolver.ts index 149f50e92..7df743f57 100644 --- a/packages/vite/src/resolver.ts +++ b/packages/vite/src/resolver.ts @@ -1,10 +1,11 @@ import type { Plugin, ViteDevServer } from 'vite'; -import { virtualContent, ResolverLoader } from '@embroider/core'; -import { RollupModuleRequest, virtualPrefix } from './request'; -import assertNever from 'assert-never'; +import core from '@embroider/core'; +const { virtualContent, ResolverLoader } = core; +import { RollupModuleRequest, virtualPrefix } from './request.js'; +import { assertNever } from 'assert-never'; import makeDebug from 'debug'; import { resolve } from 'path'; -import { writeStatus } from './esbuild-request'; +import { writeStatus } from './esbuild-request.js'; import type { PluginContext } from 'rollup'; const debug = makeDebug('embroider:vite'); diff --git a/packages/vite/src/scripts.ts b/packages/vite/src/scripts.ts index 4096f74e7..de6e991b6 100644 --- a/packages/vite/src/scripts.ts +++ b/packages/vite/src/scripts.ts @@ -1,7 +1,8 @@ import type { Plugin } from 'vite'; import type { EmittedFile } from 'rollup'; import { JSDOM } from 'jsdom'; -import { readFileSync, readJSONSync, existsSync } from 'fs-extra'; +import fs from 'fs-extra'; +const { readFileSync, readJSONSync, existsSync } = fs; import { dirname, posix, resolve } from 'path'; // This is a type-only import, so it gets compiled away. At runtime, we load @@ -93,7 +94,7 @@ class ScriptOptimizer { terserOpts.sourceMap = { content, url: fileRelativeSourceMapURL }; } } - let { code: outCode, map: outMap } = await Terser.default.minify(inCode, terserOpts); + let { code: outCode, map: outMap } = await Terser.minify(inCode, terserOpts); let finalFilename = await this.getFingerprintedFilename(script, outCode!); let emit: EmittedFile[] = []; emit.push({ diff --git a/packages/vite/tests/optimize-deps.test.ts b/packages/vite/tests/optimize-deps.test.ts index f32deea62..ad8306a84 100644 --- a/packages/vite/tests/optimize-deps.test.ts +++ b/packages/vite/tests/optimize-deps.test.ts @@ -1,4 +1,4 @@ -import { optimizeDeps } from '../src/optimize-deps'; +import { optimizeDeps } from '../src/optimize-deps.js'; describe('optimizeDeps', function () { test('should produce default output when invoked without arguments', function () { diff --git a/packages/webpack/src/ember-webpack.ts b/packages/webpack/src/ember-webpack.ts index 0e6b4c759..9a9b535bd 100644 --- a/packages/webpack/src/ember-webpack.ts +++ b/packages/webpack/src/ember-webpack.ts @@ -34,10 +34,13 @@ import { EmbroiderPlugin } from './webpack-resolver-plugin'; const debug = makeDebug('embroider:debug'); -// This is a type-only import, so it gets compiled away. At runtime, we load -// terser lazily so it's only loaded for production builds that use it. Don't -// add any non-type-only imports here. -import type { MinifyOptions } from 'terser'; +// this function is never called. It exists to workaround typescript being +// obtuse. https://github.com/microsoft/TypeScript/pull/53426 +async function loadTerser() { + let Terser = await import('terser'); + return Terser.minify; +} +type MinifyOptions = NonNullable>>[1]>; interface AppInfo { entrypoints: HTMLEntrypoint[]; @@ -331,7 +334,7 @@ const Webpack: PackagerConstructor = class Webpack implements Packager terserOpts.sourceMap = { content, url: fileRelativeSourceMapURL }; } } - let { code: outCode, map: outMap } = await Terser.default.minify(inCode, terserOpts); + let { code: outCode, map: outMap } = await Terser.minify(inCode, terserOpts); let finalFilename = this.getFingerprintedFilename(script, outCode!); outputFileSync(join(this.outputPath, finalFilename), outCode!); written.add(script); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 47700c4df..799f6e9f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,11 +68,11 @@ importers: specifier: workspace:^ version: link:../core '@rollup/pluginutils': - specifier: ^4.1.1 - version: 4.2.1 + specifier: ^5.1.0 + version: 5.1.0(rollup@3.29.4) content-tag: - specifier: ^2.0.1 - version: 2.0.1 + specifier: ^2.0.2 + version: 2.0.2 fs-extra: specifier: ^10.0.0 version: 10.1.0 @@ -360,8 +360,8 @@ importers: specifier: ^1.7.0 version: 1.7.0 code-equality-assertions: - specifier: ^0.9.0 - version: 0.9.0(@types/jest@29.5.12)(qunit@2.22.0) + specifier: ^1.0.1 + version: 1.0.1(@types/jest@29.5.12)(qunit@2.22.0) ember-engines: specifier: ^0.8.19 version: 0.8.23(@glint/template@1.4.0) @@ -425,9 +425,6 @@ importers: fast-sourcemap-concat: specifier: ^2.1.1 version: 2.1.1 - filesize: - specifier: ^10.0.7 - version: 10.1.6 fs-extra: specifier: ^9.1.0 version: 9.1.0 @@ -602,8 +599,8 @@ importers: specifier: ^2.3.0 version: 2.3.0 code-equality-assertions: - specifier: ^0.9.0 - version: 0.9.0(@types/jest@29.5.12)(qunit@2.22.0) + specifier: ^1.0.1 + version: 1.0.1(@types/jest@29.5.12)(qunit@2.22.0) scenario-tester: specifier: ^3.0.1 version: 3.1.0 @@ -960,14 +957,14 @@ importers: specifier: workspace:* version: link:../reverse-exports '@rollup/pluginutils': - specifier: ^4.1.1 - version: 4.2.1 + specifier: ^5.1.0 + version: 5.1.0(rollup@4.21.2) assert-never: specifier: ^1.2.1 version: 1.3.0 content-tag: - specifier: ^2.0.1 - version: 2.0.1 + specifier: ^2.0.2 + version: 2.0.2 debug: specifier: ^4.3.2 version: 4.3.7(supports-color@8.1.1) @@ -1236,8 +1233,8 @@ importers: specifier: ^3.4.2 version: 3.5.2 code-equality-assertions: - specifier: ^0.9.0 - version: 0.9.0(@types/jest@29.5.12)(qunit@2.22.0) + specifier: ^1.0.1 + version: 1.0.1(@types/jest@29.5.12)(qunit@2.22.0) console-ui: specifier: ^3.0.0 version: 3.1.2 @@ -8106,15 +8103,21 @@ packages: rollup: 3.29.4 dev: true - /@rollup/pluginutils@4.2.1: - resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} - engines: {node: '>= 8.0.0'} + /@rollup/pluginutils@5.1.0(rollup@3.29.4): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true dependencies: + '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 - dev: false + rollup: 3.29.4 - /@rollup/pluginutils@5.1.0(rollup@3.29.4): + /@rollup/pluginutils@5.1.0(rollup@4.21.2): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} peerDependencies: @@ -8126,15 +8129,14 @@ packages: '@types/estree': 1.0.5 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 3.29.4 - dev: true + rollup: 4.21.2 + dev: false /@rollup/rollup-android-arm-eabi@4.21.2: resolution: {integrity: sha512-fSuPrt0ZO8uXeS+xP3b+yYTCBUd05MoSp2N/MFOgjhhUhMmchXlpTQrTpI8T+YAwAQuK7MafsCOxW7VrPMrJcg==} cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-android-arm64@4.21.2: @@ -8142,7 +8144,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-arm64@4.21.2: @@ -8150,7 +8151,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-darwin-x64@4.21.2: @@ -8158,7 +8158,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm-gnueabihf@4.21.2: @@ -8166,7 +8165,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm-musleabihf@4.21.2: @@ -8174,7 +8172,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-gnu@4.21.2: @@ -8182,7 +8179,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-arm64-musl@4.21.2: @@ -8190,7 +8186,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-powerpc64le-gnu@4.21.2: @@ -8198,7 +8193,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-riscv64-gnu@4.21.2: @@ -8206,7 +8200,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-s390x-gnu@4.21.2: @@ -8214,7 +8207,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-gnu@4.21.2: @@ -8222,7 +8214,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-linux-x64-musl@4.21.2: @@ -8230,7 +8221,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-arm64-msvc@4.21.2: @@ -8238,7 +8228,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-ia32-msvc@4.21.2: @@ -8246,7 +8235,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@rollup/rollup-win32-x64-msvc@4.21.2: @@ -8254,7 +8242,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@rtsao/scc@1.1.0: @@ -9166,9 +9153,6 @@ packages: /ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} - peerDependenciesMeta: - ajv: - optional: true dependencies: ajv: 8.17.1 @@ -11647,8 +11631,8 @@ packages: q: 1.5.1 dev: true - /code-equality-assertions@0.9.0(@types/jest@29.5.12)(qunit@2.22.0): - resolution: {integrity: sha512-8t2+ZiCU9TIr/78TyVSEFii9khSic293zVCfndsG7bOymAsdDFmN1GSwjRdyQxz7+tHE+biUvt08Qlx4Xvfuxw==} + /code-equality-assertions@1.0.1(@types/jest@29.5.12)(qunit@2.22.0): + resolution: {integrity: sha512-QVoPdv5s17cGlCy2gd2Z0D9PXIYJd3VYilOK+6iTomzoel7xNUiIZOYYRNe3LbEncK0wuSJ9tvVByhySHrpO9w==} peerDependencies: '@types/jest': '2' '@types/qunit': '2' @@ -11662,6 +11646,7 @@ packages: optional: true dependencies: '@babel/core': 7.25.2 + '@babel/plugin-syntax-typescript': 7.25.4(@babel/core@7.25.2) '@types/jest': 29.5.12 diff: 5.2.0 prettier: 2.8.8 @@ -12046,8 +12031,8 @@ packages: resolution: {integrity: sha512-9guqKIx2H+78N17otBpl8yLZbQGL5q1vBO/jDb3gF2JjixtcVpC62jDUNxjVMNoaZ09oxRX84ZOD6VX02qkVvg==} dev: true - /content-tag@2.0.1: - resolution: {integrity: sha512-jxsETSDs5NbNwyiDuIp672fUMhUyu8Qxc5MOBOJOcgW/fQESI6o5K1LBDrnEE7Bh810a685lWEZHTF4jQYGEEw==} + /content-tag@2.0.2: + resolution: {integrity: sha512-qHRyTp02dgzRK2tsCFxZ1H289bZOuSLNpupr6prvnSFq4SFPmNlBKbbE5PCMb+8+Z1a1z+yCVtXvQIGUCCa3lQ==} /content-type@1.0.5: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} @@ -14312,7 +14297,7 @@ packages: compression: 1.7.4 configstore: 5.0.1 console-ui: 3.1.2 - content-tag: 2.0.1 + content-tag: 2.0.2 core-object: 3.1.5 dag-map: 2.0.2 diff: 5.2.0 @@ -14459,7 +14444,7 @@ packages: compression: 1.7.4 configstore: 5.0.1 console-ui: 3.1.2 - content-tag: 2.0.1 + content-tag: 2.0.2 core-object: 3.1.5 dag-map: 2.0.2 diff: 5.2.0 @@ -17913,6 +17898,7 @@ packages: /filesize@10.1.6: resolution: {integrity: sha512-sJslQKU2uM33qH5nqewAwVB2QgR6w1aMNsYUp3aN5rMRyXEwJGmZvaWzeJFNTOXWlHQyBFCWrdj3fV/fsTOX8w==} engines: {node: '>= 10.4.0'} + dev: true /filesize@6.4.0: resolution: {integrity: sha512-mjFIpOHC4jbfcTfoh4rkWpI31mF7viw9ikj/JyLoKzqlwG/YsefKfvYlYhdYdg/9mtK2z1AzgN/0LvVQ3zdlSQ==} @@ -23089,7 +23075,6 @@ packages: '@rollup/rollup-win32-ia32-msvc': 4.21.2 '@rollup/rollup-win32-x64-msvc': 4.21.2 fsevents: 2.3.3 - dev: true /route-recognizer@0.3.4: resolution: {integrity: sha512-2+MhsfPhvauN1O8KaXpXAOfR/fwe8dnUXVM+xw7yt40lJRfPVQxV6yryZm0cgRvAj5fMF/mdRZbL2ptwbs5i2g==} diff --git a/test-packages/support/package.json b/test-packages/support/package.json index 4300913c5..e89d4944c 100644 --- a/test-packages/support/package.json +++ b/test-packages/support/package.json @@ -11,7 +11,7 @@ "@glimmer/component": "^1.0.0", "babel-preset-env": "^1.7.0", "broccoli": "^3.4.2", - "code-equality-assertions": "^0.9.0", + "code-equality-assertions": "^1.0.1", "console-ui": "^3.0.0", "ember-auto-import": "^2.2.0", "ember-cli": "~3.28.0", diff --git a/tests/scenarios/helpers/v2-addon.ts b/tests/scenarios/helpers/v2-addon.ts index 754384eca..95b5a5a38 100644 --- a/tests/scenarios/helpers/v2-addon.ts +++ b/tests/scenarios/helpers/v2-addon.ts @@ -1,6 +1,5 @@ import path from 'path'; import type { PreparedApp } from 'scenario-tester'; -// @ts-expect-error import { loadConfigFile } from 'rollup/loadConfigFile'; import rollup from 'rollup'; import type { RollupOptions } from 'rollup'; @@ -32,7 +31,7 @@ export class DevWatcher { process.chdir(buildDirectory); let configPath = path.resolve(this.#addon.dir, 'rollup.config.mjs'); - let configFile = await loadConfigFile(configPath); + let configFile = await loadConfigFile(configPath, undefined); configFile.warnings.flush(); this.#watcher = rollup.watch( diff --git a/tsconfig.json b/tsconfig.json index 2ba1b895e..2ff03b600 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,8 @@ ], "compilerOptions": { "target": "es2019", - "module": "commonjs", + "module": "nodenext", + "moduleResolution": "nodenext", "declaration": true, "typeRoots": ["types", "node_modules/@types"], "esModuleInterop": true, From 5f5c0d5b94a2d71355b414a49d2cbe0e6ecd76ed Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 21 Sep 2024 12:18:56 -0400 Subject: [PATCH 2/3] this should be cjs --- packages/vite/{jest.config.js => jest.config.cjs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/vite/{jest.config.js => jest.config.cjs} (100%) diff --git a/packages/vite/jest.config.js b/packages/vite/jest.config.cjs similarity index 100% rename from packages/vite/jest.config.js rename to packages/vite/jest.config.cjs From 7cf0688e199677e7ca69504d5a13f800d5632be1 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sat, 21 Sep 2024 12:23:46 -0400 Subject: [PATCH 3/3] these tests are pointless and jest isn't working with our esm format --- packages/vite/jest.config.cjs | 4 --- packages/vite/tests/optimize-deps.test.ts | 32 ----------------------- 2 files changed, 36 deletions(-) delete mode 100644 packages/vite/jest.config.cjs delete mode 100644 packages/vite/tests/optimize-deps.test.ts diff --git a/packages/vite/jest.config.cjs b/packages/vite/jest.config.cjs deleted file mode 100644 index cdaa1f960..000000000 --- a/packages/vite/jest.config.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - testEnvironment: 'node', - testMatch: ['/tests/**/*.test.js'], -}; diff --git a/packages/vite/tests/optimize-deps.test.ts b/packages/vite/tests/optimize-deps.test.ts deleted file mode 100644 index ad8306a84..000000000 --- a/packages/vite/tests/optimize-deps.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { optimizeDeps } from '../src/optimize-deps.js'; - -describe('optimizeDeps', function () { - test('should produce default output when invoked without arguments', function () { - const actual = optimizeDeps(); - - expect(actual).toMatchInlineSnapshot( - { - esbuildOptions: { - plugins: [expect.any(Object)], - }, - }, - ` - { - "esbuildOptions": { - "plugins": [ - Any, - ], - }, - "exclude": [ - "@embroider/macros", - ], - "extensions": [ - ".hbs", - ".gjs", - ".gts", - ], - } - ` - ); - }); -});