diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 507327191..3232dfbb2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,18 +8,17 @@ jobs: fail-fast: false matrix: node: - - 18 - - 20 + - node-version-file: 'package.json' + - node-version: 20.x - name: Unit tests w/ Node.js ${{matrix.node}}.x + name: Unit tests w/ Node.js ${{matrix.node.node-version || matrix.node.node-version-file}} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Install Node ${{matrix.node}}.x + - name: Install Node ${{matrix.node.node-version || matrix.node.node-version-file}} uses: actions/setup-node@v4 - with: - node-version: ${{matrix.node}}.x + with: ${{matrix.node}} - run: yarn install - run: yarn build:all - run: yarn test @@ -33,7 +32,7 @@ jobs: - name: Install node uses: actions/setup-node@v4 with: - node-version: '18.19.0' + node-version-file: 'package.json' - run: yarn install - run: yarn build:all - run: yarn typecheck:all diff --git a/.node-version b/.node-version deleted file mode 100644 index 1117d417c..000000000 --- a/.node-version +++ /dev/null @@ -1 +0,0 @@ -18.20.5 diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 4982a9c06..686abc9e9 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -7,10 +7,10 @@ export const INJECTED_FILE = '__datadog-helper-file'; export const ALL_BUNDLERS = ['webpack', 'vite', 'esbuild', 'rollup', 'rspack', 'rolldown', 'farm']; export const SUPPORTED_BUNDLERS = ['webpack', 'vite', 'esbuild', 'rollup', 'rspack'] as const; export const FULL_NAME_BUNDLERS = [ - 'webpack4', - 'webpack5', - 'vite', 'esbuild', 'rollup', 'rspack', + 'vite', + 'webpack4', + 'webpack5', ] as const; diff --git a/packages/core/src/helpers.ts b/packages/core/src/helpers.ts index e43b17e35..3b0fcd1f2 100644 --- a/packages/core/src/helpers.ts +++ b/packages/core/src/helpers.ts @@ -53,7 +53,7 @@ export const getEsbuildEntries = async ( const fullPath = entry && typeof entry === 'object' ? entry.in : entry; entryPaths.push({ path: fullPath }); } - } else if (typeof entryPoints === 'object') { + } else if (entryPoints && typeof entryPoints === 'object') { entryPaths.push( ...Object.entries(entryPoints).map(([name, filepath]) => ({ name, path: filepath })), ); diff --git a/packages/plugins/bundler-report/src/index.ts b/packages/plugins/bundler-report/src/index.ts index 7684fd8f4..04f34f7d4 100644 --- a/packages/plugins/bundler-report/src/index.ts +++ b/packages/plugins/bundler-report/src/index.ts @@ -135,6 +135,7 @@ export const getBundlerReportPlugins = (context: GlobalContext): PluginOptions[] // so we have to compute it based on existing configurations. // The basic idea is to compare input vs output and keep the common part of the paths. vite: { + ...rollupPlugin(), config(config) { if (config.root) { context.cwd = config.root; @@ -142,7 +143,6 @@ export const getBundlerReportPlugins = (context: GlobalContext): PluginOptions[] handleCwd(Array.from(directories), context); } }, - ...rollupPlugin(), }, rollup: rollupPlugin(), }; diff --git a/packages/published/esbuild-plugin/package.json b/packages/published/esbuild-plugin/package.json index 5656ea06b..8103f50a4 100644 --- a/packages/published/esbuild-plugin/package.json +++ b/packages/published/esbuild-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@datadog/esbuild-plugin", "packageManager": "yarn@4.0.2", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "author": "Datadog", "description": "Datadog ESBuild Plugin", diff --git a/packages/published/esbuild-plugin/src/index.ts b/packages/published/esbuild-plugin/src/index.ts index 800da8c93..2d2be69ee 100644 --- a/packages/published/esbuild-plugin/src/index.ts +++ b/packages/published/esbuild-plugin/src/index.ts @@ -6,6 +6,7 @@ // Anything between #types-export-injection-marker // will be updated using the 'yarn cli integrity' command. +import type { Options } from '@dd/core/types'; import * as factory from '@dd/factory'; import esbuild from 'esbuild'; @@ -16,7 +17,7 @@ export const datadogEsbuildPlugin = factory.buildPluginFactory({ version: pkg.version, }).esbuild; -export type { Options as EsbuildPluginOptions } from '@dd/core/types'; +export type EsbuildPluginOptions = Options; export type { // #types-export-injection-marker diff --git a/packages/published/rollup-plugin/package.json b/packages/published/rollup-plugin/package.json index e2f467f8a..3a2d8ff8d 100644 --- a/packages/published/rollup-plugin/package.json +++ b/packages/published/rollup-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@datadog/rollup-plugin", "packageManager": "yarn@4.0.2", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "author": "Datadog", "description": "Datadog Rollup Plugin", diff --git a/packages/published/rollup-plugin/src/index.ts b/packages/published/rollup-plugin/src/index.ts index 2c44db0a6..cf0023c89 100644 --- a/packages/published/rollup-plugin/src/index.ts +++ b/packages/published/rollup-plugin/src/index.ts @@ -6,6 +6,7 @@ // Anything between #types-export-injection-marker // will be updated using the 'yarn cli integrity' command. +import type { Options } from '@dd/core/types'; import * as factory from '@dd/factory'; import rollup from 'rollup'; @@ -16,7 +17,7 @@ export const datadogRollupPlugin = factory.buildPluginFactory({ version: pkg.version, }).rollup; -export type { Options as RollupPluginOptions } from '@dd/core/types'; +export type RollupPluginOptions = Options; export type { // #types-export-injection-marker diff --git a/packages/published/rspack-plugin/package.json b/packages/published/rspack-plugin/package.json index 83ac23d80..1fe2b1c30 100644 --- a/packages/published/rspack-plugin/package.json +++ b/packages/published/rspack-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@datadog/rspack-plugin", "packageManager": "yarn@4.0.2", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "author": "Datadog", "description": "Datadog Rspack Plugin", diff --git a/packages/published/rspack-plugin/src/index.ts b/packages/published/rspack-plugin/src/index.ts index ef854fb9a..bc0d3a6d3 100644 --- a/packages/published/rspack-plugin/src/index.ts +++ b/packages/published/rspack-plugin/src/index.ts @@ -6,6 +6,7 @@ // Anything between #types-export-injection-marker // will be updated using the 'yarn cli integrity' command. +import type { Options } from '@dd/core/types'; import * as factory from '@dd/factory'; import rspack from '@rspack/core'; @@ -16,7 +17,7 @@ export const datadogRspackPlugin = factory.buildPluginFactory({ version: pkg.version, }).rspack; -export type { Options as RspackPluginOptions } from '@dd/core/types'; +export type RspackPluginOptions = Options; export type { // #types-export-injection-marker diff --git a/packages/published/vite-plugin/package.json b/packages/published/vite-plugin/package.json index 82cf1c26b..e7349d11f 100644 --- a/packages/published/vite-plugin/package.json +++ b/packages/published/vite-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@datadog/vite-plugin", "packageManager": "yarn@4.0.2", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "author": "Datadog", "description": "Datadog Vite Plugin", diff --git a/packages/published/vite-plugin/src/index.ts b/packages/published/vite-plugin/src/index.ts index d2572a616..45f149a65 100644 --- a/packages/published/vite-plugin/src/index.ts +++ b/packages/published/vite-plugin/src/index.ts @@ -6,6 +6,7 @@ // Anything between #types-export-injection-marker // will be updated using the 'yarn cli integrity' command. +import type { Options } from '@dd/core/types'; import * as factory from '@dd/factory'; import vite from 'vite'; @@ -16,7 +17,7 @@ export const datadogVitePlugin = factory.buildPluginFactory({ version: pkg.version, }).vite; -export type { Options as VitePluginOptions } from '@dd/core/types'; +export type VitePluginOptions = Options; export type { // #types-export-injection-marker diff --git a/packages/published/webpack-plugin/package.json b/packages/published/webpack-plugin/package.json index 902221583..890d9026b 100644 --- a/packages/published/webpack-plugin/package.json +++ b/packages/published/webpack-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@datadog/webpack-plugin", "packageManager": "yarn@4.0.2", - "version": "2.4.0", + "version": "2.4.1", "license": "MIT", "author": "Datadog", "description": "Datadog Webpack Plugin", diff --git a/packages/published/webpack-plugin/src/index.ts b/packages/published/webpack-plugin/src/index.ts index a6bddb853..0c490b337 100644 --- a/packages/published/webpack-plugin/src/index.ts +++ b/packages/published/webpack-plugin/src/index.ts @@ -6,6 +6,7 @@ // Anything between #types-export-injection-marker // will be updated using the 'yarn cli integrity' command. +import type { Options } from '@dd/core/types'; import * as factory from '@dd/factory'; import webpack from 'webpack'; @@ -16,7 +17,7 @@ export const datadogWebpackPlugin = factory.buildPluginFactory({ version: pkg.version, }).webpack; -export type { Options as WebpackPluginOptions } from '@dd/core/types'; +export type WebpackPluginOptions = Options; export type { // #types-export-injection-marker diff --git a/packages/tests/src/_jest/helpers/env.ts b/packages/tests/src/_jest/helpers/env.ts index 61b0e7bbf..6f87a3c9b 100644 --- a/packages/tests/src/_jest/helpers/env.ts +++ b/packages/tests/src/_jest/helpers/env.ts @@ -76,9 +76,7 @@ export const logEnv = (env: TestEnv) => { throw new Error( `Invalid "${red(`--bundlers ${REQUESTED_BUNDLERS.join(',')}`)}".\nValid bundlers are ${FULL_NAME_BUNDLERS.map( (b) => green(b), - ) - .sort() - .join(', ')}.`, + ).join(', ')}.`, ); } const bundlersList = REQUESTED_BUNDLERS.map((bundler) => green(bundler)).join(', '); diff --git a/packages/tests/src/_jest/helpers/mocks.ts b/packages/tests/src/_jest/helpers/mocks.ts index fe381e626..0318f267e 100644 --- a/packages/tests/src/_jest/helpers/mocks.ts +++ b/packages/tests/src/_jest/helpers/mocks.ts @@ -58,7 +58,7 @@ const logFn: Logger = { }; export const mockLogger: Logger = logFn; -export const getEsbuildMock = (options: Partial = {}): PluginBuild => { +export const getEsbuildMock = (overrides: Partial = {}): PluginBuild => { return { resolve: async (filepath) => { return { @@ -77,7 +77,7 @@ export const getEsbuildMock = (options: Partial = {}): PluginBuild onResolve: jest.fn(), onLoad: jest.fn(), onDispose: jest.fn(), - ...options, + ...overrides, esbuild: { context: jest.fn(), build: jest.fn(), @@ -90,15 +90,15 @@ export const getEsbuildMock = (options: Partial = {}): PluginBuild analyzeMetafileSync: jest.fn(), initialize: jest.fn(), version: '1.0.0', - ...(options.esbuild || {}), + ...(overrides.esbuild || {}), }, initialOptions: { - ...(options.initialOptions || {}), + ...(overrides.initialOptions || {}), }, }; }; -export const getContextMock = (options: Partial = {}): GlobalContext => { +export const getContextMock = (overrides: Partial = {}): GlobalContext => { return { auth: { apiKey: 'FAKE_API_KEY' }, bundler: { @@ -117,7 +117,7 @@ export const getContextMock = (options: Partial = {}): GlobalCont pluginNames: [], start: Date.now(), version: 'FAKE_VERSION', - ...options, + ...overrides, }; };