Skip to content

Commit

Permalink
Merge pull request #86 from DataDog/yoann/add-vite-and-rollup
Browse files Browse the repository at this point in the history
[bundle] Add vite and rollup
  • Loading branch information
yoannmoinet authored Jul 23, 2024
2 parents accae07 + fc88f6e commit 24e038c
Show file tree
Hide file tree
Showing 49 changed files with 1,560 additions and 204 deletions.
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
233 changes: 213 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

A set of plugins to interact with Datadog directly from your builds.

> [!NOTE]
> If you want to upgrade from v1 to v2, please follow our [migration guide](./MIGRATIONS.md#v1-to-v2).
---

## ✨ 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.

---
> [!NOTE]
> If you want to upgrade from v1 to v2, please follow our [migration guide](./MIGRATIONS.md#v1-to-v2).
## Table of content <!-- #omit in toc -->

<!-- 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)
- [ESBuild](#esbuild)
- [Rollup](#rollup)
- [Vite](#vite)
- [Webpack](#webpack)
- [Features](#features)
- [RUM](#rum)
- [Telemetry](#telemetry)
- [Configuration](#configuration)
- [`auth.apiKey`](#authapikey)
- [`auth.endPoint`](#authendpoint)
Expand All @@ -30,27 +31,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 All @@ -65,7 +260,7 @@ A set of plugins to interact with Datadog directly from your builds.
dryRun?: boolean;
intakeUrl?: string;
maxConcurrency?: number;
minifiedPathPrefix?: string;
minifiedPathPrefix: string;
releaseVersion: string;
service: string;
};
Expand All @@ -91,13 +286,11 @@ A set of plugins to interact with Datadog directly from your builds.
```
<!-- #full-configuration -->
</details>

### `auth.apiKey`
> default `null`
In order to interact with Datadog, you have to use [your own API Key](https://app.datadoghq.com/account/settings#api).
In order to interact with Datadog, you have to use [your own API Key](https://app.datadoghq.com/organization-settings/api-keys).
### `auth.endPoint`
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.
Loading

0 comments on commit 24e038c

Please sign in to comment.