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

[bundling] Change bundling #106

Merged
merged 22 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,23 @@ module.exports = {
'no-new': 'off',
},
},
{
files: ['packages/tests/src/jest/**/*.*'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@dd/*', '@datadog/*'],
message:
'\nTo avoid any conflict with mocks,\nuse `jest.requireActual` instead.\n',
},
],
},
],
},
},
{
files: ['packages/tools/**/*.*'],
rules: {
Expand Down
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 13 additions & 19 deletions LICENSES-3rdparty.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Component,Origin,Licence,Copyright
@aashutoshrathi/word-wrap,npm,MIT,Jon Schlinkert (https://github.com/aashutoshrathi/word-wrap)
@ampproject/remapping,npm,Apache-2.0,Justin Ridgewell (https://www.npmjs.com/package/@ampproject/remapping)
@babel/code-frame,npm,MIT,Sebastian McKenzie (https://babeljs.io/)
@babel/code-frame,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-code-frame)
@babel/compat-data,npm,MIT,The Babel Team (https://babel.dev/team)
@babel/core,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-core)
@babel/generator,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-generator)
Expand All @@ -18,7 +18,7 @@ Component,Origin,Licence,Copyright
@babel/helper-module-imports,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-module-imports)
@babel/helper-module-transforms,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-module-transforms)
@babel/helper-optimise-call-expression,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-optimise-call-expression)
@babel/helper-plugin-utils,npm,MIT,Logan Smyth (https://babeljs.io/)
@babel/helper-plugin-utils,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-plugin-utils)
@babel/helper-remap-async-to-generator,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-remap-async-to-generator)
@babel/helper-replace-supers,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-replace-supers)
@babel/helper-simple-access,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-simple-access)
Expand All @@ -29,16 +29,15 @@ Component,Origin,Licence,Copyright
@babel/helper-validator-option,npm,MIT,The Babel Team (https://babel.dev/team)
@babel/helper-wrap-function,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helper-wrap-function)
@babel/helpers,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-helpers)
@babel/highlight,npm,MIT,suchipi (https://babeljs.io/)
@babel/parser,npm,MIT,Sebastian McKenzie (https://babeljs.io/)
@babel/highlight,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-highlight)
@babel/parser,npm,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-parser)
@babel/plugin-bugfix-firefox-class-in-computed-class-key,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-bugfix-firefox-class-in-computed-class-key)
@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-bugfix-safari-id-destructuring-collision-in-function-expression)
@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining)
@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-bugfix-v8-static-class-fields-redefine-readonly)
@babel/plugin-proposal-private-property-in-object,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-proposal-private-property-in-object)
@babel/plugin-syntax-async-generators,virtual,MIT,(https://www.npmjs.com/package/@babel/plugin-syntax-async-generators)
@babel/plugin-syntax-bigint,virtual,MIT,(https://www.npmjs.com/package/@babel/plugin-syntax-bigint)
@babel/plugin-syntax-class-properties,virtual,MIT,(https://www.npmjs.com/package/@babel/plugin-syntax-class-properties)
@babel/plugin-syntax-class-properties,virtual,MIT,(https://babel.dev/docs/en/next/babel-plugin-syntax-class-properties)
@babel/plugin-syntax-class-static-block,virtual,MIT,The Babel Team (https://babel.dev/docs/en/next/babel-plugin-syntax-class-static-block)
@babel/plugin-syntax-dynamic-import,virtual,MIT,(https://www.npmjs.com/package/@babel/plugin-syntax-dynamic-import)
@babel/plugin-syntax-export-namespace-from,virtual,MIT,(https://www.npmjs.com/package/@babel/plugin-syntax-export-namespace-from)
Expand Down Expand Up @@ -190,7 +189,6 @@ Component,Origin,Licence,Copyright
@types/eslint-scope,npm,MIT,(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eslint-scope)
@types/estree,npm,MIT,(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree)
@types/faker,npm,MIT,(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/faker)
@types/fs-extra,npm,MIT,(https://www.npmjs.com/package/@types/fs-extra)
@types/glob,npm,MIT,(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/glob)
@types/graceful-fs,npm,MIT,(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/graceful-fs)
@types/istanbul-lib-coverage,npm,MIT,(https://www.npmjs.com/package/@types/istanbul-lib-coverage)
Expand Down Expand Up @@ -320,7 +318,6 @@ bser,npm,Apache-2.0,Wez Furlong (https://facebook.github.io/watchman/docs/bser.h
buffer,npm,MIT,Feross Aboukhadijeh (https://github.com/feross/buffer)
buffer-from,npm,MIT,(https://www.npmjs.com/package/buffer-from)
buffer-xor,npm,MIT,Daniel Cousens (https://github.com/crypto-browserify/buffer-xor)
builtin-modules,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
builtin-status-codes,npm,MIT,Ben Drucker (bendrucker.me)
cacache,npm,ISC,Kat Marchán (https://www.npmjs.com/package/cacache)
cache-base,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/cache-base)
Expand Down Expand Up @@ -380,7 +377,7 @@ dashdash,npm,MIT,Trent Mick (http://trentm.com)
data-view-buffer,npm,MIT,Jordan Harband (https://github.com/ljharb/data-view-buffer#readme)
data-view-byte-length,npm,MIT,Jordan Harband (https://github.com/ljharb/data-view-byte-length#readme)
data-view-byte-offset,npm,MIT,Jordan Harband (https://github.com/ljharb/data-view-byte-offset#readme)
debug,virtual,MIT,Josh Junon (https://www.npmjs.com/package/debug)
debug,virtual,MIT,Josh Junon (https://github.com/qix-)
decode-uri-component,npm,MIT,Sam Verschueren (github.com/SamVerschueren)
dedent,virtual,MIT,Desmond Brand (https://github.com/dmnd/dedent)
deep-is,npm,MIT,Thorsten Lorenz (http://thlorenz.com)
Expand Down Expand Up @@ -461,6 +458,7 @@ fast-json-stable-stringify,npm,MIT,James Halliday (https://github.com/epoberezki
fast-levenshtein,npm,MIT,Ramesh Nair (http://www.hiddentao.com/)
fastq,npm,ISC,Matteo Collina (https://github.com/mcollina/fastq#readme)
fb-watchman,npm,Apache-2.0,Wez Furlong (https://facebook.github.io/watchman/)
fdir,virtual,MIT,thecodrr (https://github.com/thecodrr/fdir#readme)
figgy-pudding,npm,ISC,Kat Marchán (https://www.npmjs.com/package/figgy-pudding)
figures,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
file-entry-cache,npm,MIT,Roy Riojas (http://royriojas.com)
Expand All @@ -479,7 +477,6 @@ forever-agent,npm,Apache-2.0,Mikeal Rogers (http://www.futurealoof.com)
form-data,npm,MIT,Felix Geisendörfer (http://debuggable.com/)
fragment-cache,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/fragment-cache)
from2,npm,MIT,Hugh Kennedy (https://github.com/hughsk/from2)
fs-extra,npm,MIT,JP Richardson (https://github.com/jprichardson/node-fs-extra)
fs-minipass,npm,ISC,Isaac Z. Schlueter (https://github.com/npm/fs-minipass#readme)
fs-write-stream-atomic,npm,ISC,Isaac Z. Schlueter (https://github.com/npm/fs-write-stream-atomic)
fs.realpath,npm,ISC,Isaac Z. Schlueter (http://blog.izs.me/)
Expand Down Expand Up @@ -530,7 +527,7 @@ hyperdyperid,npm,MIT,streamich (https://github.com/streamich/hyperdyperid)
ieee754,npm,BSD-3-Clause,Feross Aboukhadijeh (https://feross.org)
iferr,npm,MIT,Nadav Ivgi (https://github.com/shesek/iferr)
ignore,npm,MIT,kael (https://www.npmjs.com/package/ignore)
import-fresh,npm,MIT,Sindre Sorhus (sindresorhus.com)
import-fresh,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
import-local,npm,MIT,Sindre Sorhus (sindresorhus.com)
imurmurhash,npm,MIT,Jens Taylor (https://github.com/jensyt/imurmurhash-js)
indent-string,npm,MIT,Sindre Sorhus (sindresorhus.com)
Expand All @@ -545,7 +542,6 @@ is-bigint,npm,MIT,Jordan Harband (https://github.com/inspect-js/is-bigint#readme
is-binary-path,npm,MIT,Sindre Sorhus (sindresorhus.com)
is-boolean-object,npm,MIT,Jordan Harband (https://www.npmjs.com/package/is-boolean-object)
is-buffer,npm,MIT,Feross Aboukhadijeh (http://feross.org/)
is-builtin-module,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
is-callable,npm,MIT,Jordan Harband (http://ljharb.codes)
is-core-module,npm,MIT,Jordan Harband (https://github.com/inspect-js/is-core-module)
is-data-descriptor,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/is-data-descriptor)
Expand Down Expand Up @@ -624,7 +620,6 @@ json-schema-traverse,npm,MIT,Evgeny Poberezkin (https://github.com/epoberezkin/j
json-stable-stringify-without-jsonify,npm,MIT,James Halliday (https://github.com/samn/json-stable-stringify)
json-stringify-safe,npm,ISC,Isaac Z. Schlueter (https://github.com/isaacs/json-stringify-safe)
json5,npm,MIT,Aseem Kishore (http://json5.org/)
jsonfile,npm,MIT,JP Richardson (https://www.npmjs.com/package/jsonfile)
jsprim,npm,MIT,(https://www.npmjs.com/package/jsprim)
keyv,npm,MIT,Jared Wray (https://github.com/jaredwray/keyv)
kind-of,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/kind-of)
Expand Down Expand Up @@ -698,7 +693,7 @@ object.groupby,npm,MIT,Jordan Harband (https://github.com/es-shims/Object.groupB
object.pick,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/object.pick)
object.values,npm,MIT,Jordan Harband (https://www.npmjs.com/package/object.values)
once,npm,ISC,Isaac Z. Schlueter (http://blog.izs.me/)
onetime,npm,MIT,Sindre Sorhus (sindresorhus.com)
onetime,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
opencollective-postinstall,npm,MIT,Xavier Damman (https://github.com/opencollective/opencollective-postinstall#readme)
optionator,npm,MIT,George Zahariev (https://github.com/gkz/optionator)
os-browserify,npm,MIT,CoderPuppy (https://www.npmjs.com/package/os-browserify)
Expand All @@ -719,7 +714,7 @@ pako,npm,(MIT AND Zlib),(https://github.com/nodeca/pako)
parallel-transform,npm,MIT,Mathias Buus Madsen (https://www.npmjs.com/package/parallel-transform)
parent-module,npm,MIT,Sindre Sorhus (sindresorhus.com)
parse-asn1,npm,ISC,(https://www.npmjs.com/package/parse-asn1)
parse-json,npm,MIT,Sindre Sorhus (sindresorhus.com)
parse-json,npm,MIT,Sindre Sorhus (https://sindresorhus.com)
pascalcase,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/pascalcase)
path-browserify,npm,MIT,James Halliday (https://github.com/substack/path-browserify)
path-dirname,npm,MIT,Elan Shanker (https://www.npmjs.com/package/path-dirname)
Expand Down Expand Up @@ -790,7 +785,7 @@ reusify,npm,MIT,Matteo Collina (https://github.com/mcollina/reusify#readme)
rimraf,npm,ISC,Isaac Z. Schlueter (http://blog.izs.me/)
ripemd160,npm,MIT,(https://www.npmjs.com/package/ripemd160)
rollup,npm,MIT,Rich Harris (https://rollupjs.org/)
rollup-plugin-dts,virtual,LGPL-3.0,Arpad Borsos (https://github.com/Swatinem/rollup-plugin-dts#readme)
rollup-plugin-dts,virtual,LGPL-3.0-only,Arpad Borsos (https://github.com/Swatinem/rollup-plugin-dts#readme)
rollup-plugin-esbuild,virtual,MIT,EGOIST (https://www.npmjs.com/package/rollup-plugin-esbuild)
run-parallel,npm,MIT,Feross Aboukhadijeh (https://github.com/feross/run-parallel)
run-queue,npm,ISC,Rebecca Turner (https://npmjs.com/package/run-queue)
Expand Down Expand Up @@ -898,8 +893,7 @@ unicode-property-aliases-ecmascript,npm,MIT,Mathias Bynens (https://github.com/m
union-value,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/union-value)
unique-filename,npm,ISC,Rebecca Turner (https://github.com/iarna/unique-filename)
unique-slug,npm,ISC,Rebecca Turner (http://re-becca.org)
universalify,npm,MIT,Ryan Zimmerman (https://github.com/RyanZim/universalify#readme)
unplugin,npm,MIT,(https://www.npmjs.com/package/unplugin)
unplugin,virtual,MIT,(https://www.npmjs.com/package/unplugin)
unset-value,npm,MIT,Jon Schlinkert (https://github.com/jonschlinkert/unset-value)
upath,npm,MIT,Angelos Pikoulas (http://github.com/anodynos/upath/)
update-browserslist-db,virtual,MIT,Andrey Sitnik (https://www.npmjs.com/package/update-browserslist-db)
Expand All @@ -913,7 +907,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)
vite,virtual,MIT,Evan You (https://vite.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
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"async-retry": "1.3.3",
"chalk": "2.3.1",
"glob": "11.0.0",
"simple-git": "3.25.0",
"unplugin": "1.11.0"
"simple-git": "3.25.0"
},
"devDependencies": {
"@types/async-retry": "1.4.8",
"@types/chalk": "2.2.0",
"@types/node": "^18",
"typescript": "5.4.3"
"typescript": "5.4.3",
"unplugin": "1.14.1"
}
}
37 changes: 37 additions & 0 deletions packages/core/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// Copyright 2019-Present Datadog, Inc.

import retry from 'async-retry';
import fsp from 'fs/promises';
import fs from 'fs';
import path from 'path';
import type { RequestInit } from 'undici-types';

import { INJECTED_FILE } from './plugins/injection/constants';
Expand Down Expand Up @@ -131,3 +134,37 @@ export const isInternalPlugin = (pluginName: string, context: GlobalContext) =>
}
return false;
};

// Replacing fs-extra with local helpers.
// Delete folders recursively.
export const rm = async (dir: string) => {
return fsp.rm(dir, { force: true, maxRetries: 3, recursive: true });
};

// Write a file but first ensure the directory exists.
export const outputFile = async (filepath: string, data: string) => {
await fsp.mkdir(path.dirname(filepath), { recursive: true });
await fsp.writeFile(filepath, data, { encoding: 'utf-8' });
};

export const outputFileSync = (filepath: string, data: string) => {
fs.mkdirSync(path.dirname(filepath), { recursive: true });
fs.writeFileSync(filepath, data, { encoding: 'utf-8' });
};

// Output a JSON file.
export const outputJson = async (filepath: string, data: any) => {
const dataString = JSON.stringify(data, null, 4);
return outputFile(filepath, dataString);
};

export const outputJsonSync = (filepath: string, data: any) => {
const dataString = JSON.stringify(data, null, 4);
outputFileSync(filepath, dataString);
};

// Read a JSON file.
export const readJsonSync = (filepath: string) => {
const data = fs.readFileSync(filepath, { encoding: 'utf-8' });
return JSON.parse(data);
};
2 changes: 1 addition & 1 deletion packages/core/src/plugins/injection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getInjectionPlugins = (
};

// Create a unique filename to avoid conflicts.
const INJECTED_FILE_PATH = `${Date.now()}_${INJECTED_FILE}.js`;
const INJECTED_FILE_PATH = `${Date.now()}.${performance.now()}.${INJECTED_FILE}.js`;

// This plugin happens in 2 steps in order to cover all bundlers:
// 1. Prepare the content to inject, fetching distant/local files and anything necessary.
Expand Down
20 changes: 15 additions & 5 deletions packages/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,31 @@
"typecheck": "tsc --noEmit",
"watch": "yarn clean && rollup --config rollup.config.mjs --watch"
},
"dependencies": {
"async-retry": "1.3.3",
"chalk": "2.3.1",
"glob": "11.0.0",
"outdent": "0.8.0",
"p-queue": "6.6.2",
"pretty-bytes": "5.6.0",
"simple-git": "3.25.0",
"unplugin": "1.14.1"
},
"devDependencies": {
"@babel/core": "7.24.5",
"@babel/preset-env": "7.24.5",
"@babel/preset-typescript": "7.24.1",
"@dd/factory": "workspace:*",
"@dd/tools": "workspace:*",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-commonjs": "28.0.1",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-node-resolve": "15.3.0",
"@types/babel__core": "^7",
"@types/babel__preset-env": "^7",
"esbuild": "0.21.5",
"rollup": "4.18.0",
"rollup-plugin-dts": "6.1.0",
"esbuild": "0.24.0",
"rollup": "4.24.2",
"rollup-plugin-dts": "6.1.1",
"rollup-plugin-esbuild": "6.1.1",
"typescript": "5.4.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/factory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@dd/core": "workspace:*",
"@dd/rum-plugins": "workspace:*",
"@dd/telemetry-plugins": "workspace:*",
"unplugin": "1.11.0"
"unplugin": "1.14.1"
}
}
3 changes: 1 addition & 2 deletions packages/plugins/rum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@dd/core": "workspace:*",
"chalk": "2.3.1",
"outdent": "0.8.0",
"p-queue": "6.6.2",
"unplugin": "1.11.0"
"p-queue": "6.6.2"
}
}
4 changes: 3 additions & 1 deletion packages/plugins/rum/src/sourcemaps/sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export const upload = async (
return { errors, warnings };
}

const queue = new PQueue({ concurrency: options.maxConcurrency });
// @ts-expect-error PQueue's default isn't typed.
const Queue = PQueue.default ? PQueue.default : PQueue;
const queue = new Queue({ concurrency: options.maxConcurrency });
Comment on lines +99 to +101
Copy link
Member Author

@yoannmoinet yoannmoinet Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the usual mess of highly opinionated Sindre Sorhus' packages.
And I can't use the latest version (yet) because it's ESM only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bummer :(

exports.default = PQueue;

const defaultHeaders = {
'DD-API-KEY': context.auth.apiKey,
'DD-EVP-ORIGIN': `${context.bundler.fullName}-build-plugin_sourcemaps`,
Expand Down
7 changes: 2 additions & 5 deletions packages/plugins/telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@
"dependencies": {
"@dd/core": "workspace:*",
"chalk": "2.3.1",
"fs-extra": "7.0.1",
"pretty-bytes": "5.6.0",
"unplugin": "1.11.0"
"pretty-bytes": "5.6.0"
},
"devDependencies": {
"@types/chalk": "2.2.0",
"@types/fs-extra": "8.1.0",
"esbuild": "0.21.5"
"esbuild": "0.24.0"
},
"peerDependencies": {
"esbuild": ">=0.x",
Expand Down
9 changes: 0 additions & 9 deletions packages/plugins/telemetry/src/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

import { outputFile } from 'fs-extra';

import { CONFIG_KEY } from '../constants';
import type {
OptionsDD,
Expand Down Expand Up @@ -125,13 +123,6 @@ const formatLoaderName = (loader: string) =>
export const getLoaderNames = (module: Module) =>
(module.loaders || []).map((l: any) => l.loader || l).map(formatLoaderName);

// Make it so if JSON.stringify fails it rejects the promise and not the whole process.
export const writeFile = (filePath: string, content: any) => {
return new Promise((resolve) => {
return outputFile(filePath, JSON.stringify(content, null, 4)).then(resolve);
});
};

export const getValueContext = (args: any[]): ValueContext[] => {
return args.map((arg) => ({
type: arg?.constructor?.name ?? typeof arg,
Expand Down
Loading
Loading