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

[bundle] Add vite and rollup #86

Merged
merged 29 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2975c7d
Add rollup plugin
yoannmoinet Jul 9, 2024
398bcde
Add vite plugin
yoannmoinet Jul 9, 2024
586d8e3
Integrate vite and rollup to testing
yoannmoinet Jul 9, 2024
a0c3649
Fix webpack4 lack of pnp support
yoannmoinet Jul 11, 2024
9d0af43
Change how we run bundlers
yoannmoinet Jul 11, 2024
25b0f7e
Add host name for esbuild
yoannmoinet Jul 12, 2024
595a06a
Update how we run bundlers again
yoannmoinet Jul 17, 2024
38da537
Configure Jest
yoannmoinet Jul 17, 2024
9cfc221
Update global context to add rollup and vite
yoannmoinet Jul 17, 2024
e59e258
Update sourcemaps tests
yoannmoinet Jul 17, 2024
5ca2187
Make bundlers length dynamic
yoannmoinet Jul 17, 2024
62c6c3b
Update vite run
yoannmoinet Jul 17, 2024
dd632cf
Ensure we delete the dist folder
yoannmoinet Jul 17, 2024
965adb4
Remove node warnings
yoannmoinet Jul 17, 2024
7ebb7dc
Integrity
yoannmoinet Jul 17, 2024
fa68c18
Add more info to plugins in the readme
yoannmoinet Jul 17, 2024
4f49283
Add bundlers documentation to top-level readme
yoannmoinet Jul 17, 2024
f4dd7ca
Update README
yoannmoinet Jul 17, 2024
a74cdf5
No more collapses
yoannmoinet Jul 17, 2024
2c910d2
Remove useless await
yoannmoinet Jul 17, 2024
d984bca
Remove unused helpers
yoannmoinet Jul 18, 2024
9cd160f
Add bundlers support informations
yoannmoinet Jul 18, 2024
7996927
Update validation error on plugin
yoannmoinet Jul 18, 2024
5a894cb
Update readme
yoannmoinet Jul 18, 2024
0e89134
Remove pictures from TOC
yoannmoinet Jul 19, 2024
0c9a6d2
Add and fix some typings
yoannmoinet Jul 19, 2024
fd34f8b
Update API key link
yoannmoinet Jul 19, 2024
1d8b004
Add more details to RUM readme
yoannmoinet Jul 19, 2024
fc88f6e
Slight move of things in README
yoannmoinet Jul 19, 2024
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions LICENSES-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ move-concurrently,npm,ISC,Rebecca Turner (https://www.npmjs.com/package/move-con
ms,npm,MIT,(https://www.npmjs.com/package/ms)
mute-stream,npm,ISC,GitHub Inc. (https://www.npmjs.com/package/mute-stream)
nan,npm,MIT,(https://www.npmjs.com/package/nan)
nanoid,npm,MIT,Andrey Sitnik (https://www.npmjs.com/package/nanoid)
nanomatch,npm,MIT,Jon Schlinkert (https://github.com/micromatch/nanomatch)
natural-compare,npm,MIT,Lauri Rooden (https://github.com/litejs/natural-compare-lite)
neo-async,npm,MIT,(https://github.com/suguru03/neo-async)
Expand Down Expand Up @@ -729,6 +730,7 @@ pkg-dir,npm,MIT,Sindre Sorhus (sindresorhus.com)
please-upgrade-node,npm,MIT,typicode (https://github.com/typicode/please-upgrade-node#readme)
posix-character-classes,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/posix-character-classes)
possible-typed-array-names,npm,MIT,Jordan Harband (https://github.com/ljharb/possible-typed-array-names#readme)
postcss,npm,MIT,Andrey Sitnik (https://postcss.org/)
prelude-ls,npm,MIT,George Zahariev (http://preludels.com)
prettier,npm,MIT,James Long (https://prettier.io)
prettier-linter-helpers,npm,MIT,(https://github.com/prettier/prettier-linter-helpers#readme)
Expand Down Expand Up @@ -814,6 +816,7 @@ snapdragon-util,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/snapdra
sonic-forest,virtual,Apache-2.0,streamich (https://github.com/streamich/sonic-forest)
source-list-map,npm,MIT,Tobias Koppers @sokra (https://github.com/webpack/source-list-map)
source-map,npm,BSD-3-Clause,Nick Fitzgerald (https://github.com/mozilla/source-map)
source-map-js,npm,BSD-3-Clause,Valentin 7rulnik Semirulnik (https://github.com/7rulnik/source-map-js)
source-map-resolve,npm,MIT,Simon Lydell (https://www.npmjs.com/package/source-map-resolve)
source-map-support,npm,MIT,(https://www.npmjs.com/package/source-map-support)
source-map-url,npm,MIT,Simon Lydell (https://www.npmjs.com/package/source-map-url)
Expand Down Expand Up @@ -901,6 +904,7 @@ uuid,npm,MIT,(https://www.npmjs.com/package/uuid)
v8-compile-cache-lib,npm,MIT,Andrew Bradley (https://www.npmjs.com/package/v8-compile-cache-lib)
v8-to-istanbul,npm,ISC,Ben Coe (https://www.npmjs.com/package/v8-to-istanbul)
verror,npm,MIT,(https://www.npmjs.com/package/verror)
vite,virtual,MIT,Evan You (https://vitejs.dev)
vm-browserify,npm,MIT,James Halliday (http://substack.net)
walker,npm,Apache-2.0,Naitik Shah (https://github.com/daaku/nodejs-walker)
watchpack,npm,MIT,Tobias Koppers @sokra (https://github.com/webpack/watchpack)
Expand Down
221 changes: 209 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A set of plugins to interact with Datadog directly from your builds.

## ✨ Key takeaways ✨ <!-- #omit in toc -->

- This is a cross bundler plugin (webpack and esbuild for now).
- This is a bundler plugin for <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" /> Webpack, <img src="packages/assets/src/vite.svg" alt="Vite" width="17" /> Vite, <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> ESBuild and <img src="packages/assets/src/rollup.svg" alt="Rollup" width="17" /> Rollup.
- Very easy to setup and disable on the fly.

---
Expand All @@ -19,9 +19,14 @@ A set of plugins to interact with Datadog directly from your builds.
<!-- This is auto generated with yarn cli integrity -->

<!-- #toc -->
- [Plugins](#plugins)
- [`rum` RUM Plugin](#rum-rum-plugin)
- [`telemetry` Telemetry Plugin](#telemetry-telemetry-plugin)
- [Bundler Plugins](#bundler-plugins)
- [<img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> ESBuild](#img-srcpackagesassetssrcesbuildsvg-altesbuild-width17-esbuild)
- [<img src="packages/assets/src/rollup.svg" alt="Rollup" width="17" /> Rollup](#img-srcpackagesassetssrcrollupsvg-altrollup-width17-rollup)
yoannmoinet marked this conversation as resolved.
Show resolved Hide resolved
- [<img src="packages/assets/src/vite.svg" alt="Vite" width="17" /> Vite](#img-srcpackagesassetssrcvitesvg-altvite-width17-vite)
- [<img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" /> Webpack](#img-srcpackagesassetssrcwebpacksvg-altwebpack-width17-webpack)
- [Features](#features)
- [RUM <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> <img src="packages/assets/src/rollup.svg" alt="Rollup" width="17" /> <img src="packages/assets/src/vite.svg" alt="Vite" width="17" /> <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" />](#rum-img-srcpackagesassetssrcesbuildsvg-altesbuild-width17-img-srcpackagesassetssrcrollupsvg-altrollup-width17-img-srcpackagesassetssrcvitesvg-altvite-width17-img-srcpackagesassetssrcwebpacksvg-altwebpack-width17-)
- [Telemetry <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" />](#telemetry-img-srcpackagesassetssrcesbuildsvg-altesbuild-width17-img-srcpackagesassetssrcwebpacksvg-altwebpack-width17-)
- [Configuration](#configuration)
- [`auth.apiKey`](#authapikey)
- [`auth.endPoint`](#authendpoint)
Expand All @@ -30,27 +35,221 @@ A set of plugins to interact with Datadog directly from your builds.
- [License](#license)
<!-- #toc -->

## Plugins
## Bundler Plugins

<!-- #list-of-bundlers -->
### <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> ESBuild

`@datadog/esbuild-plugin`

#### Installation
- Yarn

```bash
yarn add -D @datadog/esbuild-plugin
```

- NPM

```bash
npm install --save-dev @datadog/esbuild-plugin
```


#### Usage
```js
const { datadogEsbuildPlugin } = require('@datadog/esbuild-plugin');

require('esbuild').build({
plugins: [
datadogEsbuildPlugin({
// Configuration
}),
],
});
```

> [!TIP]
> It is important to have the plugin in the first position in order to report every other plugins.


<kbd>[📝 More details ➡️](./packages/esbuild-plugin#readme)</kbd>

### <img src="packages/assets/src/rollup.svg" alt="Rollup" width="17" /> Rollup

`@datadog/rollup-plugin`

#### Installation
- Yarn

```bash
yarn add -D @datadog/rollup-plugin
```

- NPM

```bash
npm install --save-dev @datadog/rollup-plugin
```


#### Usage
Inside your `rollup.config.js`.

```js
import { datadogRollupPlugin } from '@datadog/rollup-plugin';

export default {
plugins: [
datadogRollupPlugin({
// Configuration
}),
],
};
```

> [!TIP]
> It is important to have the plugin in the first position in order to report every other plugins.


<kbd>[📝 More details ➡️](./packages/rollup-plugin#readme)</kbd>

### <img src="packages/assets/src/vite.svg" alt="Vite" width="17" /> Vite

`@datadog/vite-plugin`

#### Installation
- Yarn

```bash
yarn add -D @datadog/vite-plugin
```

- NPM

```bash
npm install --save-dev @datadog/vite-plugin
```


#### Usage
Inside your `vite.config.js`.

```js
import { datadogVitePlugin } from '@datadog/vite-plugin';
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
datadogVitePlugin({
// Configuration
}),
],
};
```

> [!TIP]
> It is important to have the plugin in the first position in order to report every other plugins.


<kbd>[📝 More details ➡️](./packages/vite-plugin#readme)</kbd>

### <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" /> Webpack

`@datadog/webpack-plugin`

#### Installation
- Yarn

```bash
yarn add -D @datadog/webpack-plugin
```

- NPM

```bash
npm install --save-dev @datadog/webpack-plugin
```


#### Usage
Inside your `webpack.config.js`.

```js
const { datadogWebpackPlugin } = require('@datadog/webpack-plugin');

module.exports = {
plugins: [
datadogWebpackPlugin({
// Configuration
}),
],
};
```

> [!TIP]
> It is important to have the plugin in the first position in order to report every other plugins.


<kbd>[📝 More details ➡️](./packages/webpack-plugin#readme)</kbd>
<!-- #list-of-bundlers -->

## Features

<!-- #list-of-packages -->
### `rum` RUM Plugin
### RUM <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> <img src="packages/assets/src/rollup.svg" alt="Rollup" width="17" /> <img src="packages/assets/src/vite.svg" alt="Vite" width="17" /> <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" />

> Interact with our Real User Monitoring product (RUM) in Datadog directly from your build system.

```typescript
datadogWebpackPlugin({
rum?: {
disabled?: boolean,
sourcemaps?: {
dryRun?: boolean,
intakeUrl?: string,
maxConcurrency?: number,
minifiedPathPrefix?: string,
releaseVersion: string,
service: string,
},
}
});
```

<kbd>[📝 Full documentation ➡️](./packages/plugins/rum#readme)</kbd>

### `telemetry` Telemetry Plugin
### Telemetry <img src="packages/assets/src/esbuild.svg" alt="ESBuild" width="17" /> <img src="packages/assets/src/webpack.svg" alt="Webpack" width="17" />

> Display and send telemetry data as metrics to Datadog.

```typescript
datadogWebpackPlugin({
telemetry?: {
disabled?: boolean,
output?: boolean
| string
| {
destination: string,
timings?: boolean,
dependencies?: boolean,
bundler?: boolean,
metrics?: boolean,
logs?: boolean,
},
prefix?: string,
tags?: string[],
timestamp?: number,
filters?: ((metric: Metric) => Metric | null)[],
}
});
```

<kbd>[📝 Full documentation ➡️](./packages/plugins/telemetry#readme)</kbd>
<!-- #list-of-packages -->

## Configuration

<details>
<summary>Full configuration</summary>

<!-- #full-configuration -->
```typescript
{
Expand Down Expand Up @@ -91,8 +290,6 @@ A set of plugins to interact with Datadog directly from your builds.
```
<!-- #full-configuration -->

</details>

### `auth.apiKey`

> default `null`
Expand Down
6 changes: 6 additions & 0 deletions packages/assets/src/esbuild.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions packages/assets/src/rollup.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions packages/assets/src/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/assets/src/webpack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading