Skip to content

Commit

Permalink
Merge branch 'master' into yoann/lighten-readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet authored Feb 6, 2025
2 parents 517d291 + 0558ca7 commit 3909d18
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 32 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion .node-version

This file was deleted.

6 changes: 3 additions & 3 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion packages/core/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/bundler-report/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ 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;
} else {
handleCwd(Array.from(directories), context);
}
},
...rollupPlugin(),
},
rollup: rollupPlugin(),
};
Expand Down
2 changes: 1 addition & 1 deletion packages/published/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@datadog/esbuild-plugin",
"packageManager": "[email protected]",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"author": "Datadog",
"description": "Datadog ESBuild Plugin",
Expand Down
3 changes: 2 additions & 1 deletion packages/published/esbuild-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/published/rollup-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@datadog/rollup-plugin",
"packageManager": "[email protected]",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"author": "Datadog",
"description": "Datadog Rollup Plugin",
Expand Down
3 changes: 2 additions & 1 deletion packages/published/rollup-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/published/rspack-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@datadog/rspack-plugin",
"packageManager": "[email protected]",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"author": "Datadog",
"description": "Datadog Rspack Plugin",
Expand Down
3 changes: 2 additions & 1 deletion packages/published/rspack-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/published/vite-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@datadog/vite-plugin",
"packageManager": "[email protected]",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"author": "Datadog",
"description": "Datadog Vite Plugin",
Expand Down
3 changes: 2 additions & 1 deletion packages/published/vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/published/webpack-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@datadog/webpack-plugin",
"packageManager": "[email protected]",
"version": "2.4.0",
"version": "2.4.1",
"license": "MIT",
"author": "Datadog",
"description": "Datadog Webpack Plugin",
Expand Down
3 changes: 2 additions & 1 deletion packages/published/webpack-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/src/_jest/helpers/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ');
Expand Down
12 changes: 6 additions & 6 deletions packages/tests/src/_jest/helpers/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const logFn: Logger = {
};
export const mockLogger: Logger = logFn;

export const getEsbuildMock = (options: Partial<PluginBuild> = {}): PluginBuild => {
export const getEsbuildMock = (overrides: Partial<PluginBuild> = {}): PluginBuild => {
return {
resolve: async (filepath) => {
return {
Expand All @@ -77,7 +77,7 @@ export const getEsbuildMock = (options: Partial<PluginBuild> = {}): PluginBuild
onResolve: jest.fn(),
onLoad: jest.fn(),
onDispose: jest.fn(),
...options,
...overrides,
esbuild: {
context: jest.fn(),
build: jest.fn(),
Expand All @@ -90,15 +90,15 @@ export const getEsbuildMock = (options: Partial<PluginBuild> = {}): 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> = {}): GlobalContext => {
export const getContextMock = (overrides: Partial<GlobalContext> = {}): GlobalContext => {
return {
auth: { apiKey: 'FAKE_API_KEY' },
bundler: {
Expand All @@ -117,7 +117,7 @@ export const getContextMock = (options: Partial<GlobalContext> = {}): GlobalCont
pluginNames: [],
start: Date.now(),
version: 'FAKE_VERSION',
...options,
...overrides,
};
};

Expand Down

0 comments on commit 3909d18

Please sign in to comment.