@datadog/vite-plugin 2.2.0-dev-1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts +13 -3
- package/dist/src/index.js +48 -128
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +48 -128
- package/dist/src/index.mjs.map +1 -1
- package/package.json +2 -3
package/dist/src/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ import require$$0$2 from 'constants';
|
|
|
13
13
|
import require$$5 from 'assert';
|
|
14
14
|
import { request } from 'https';
|
|
15
15
|
import { performance } from 'perf_hooks';
|
|
16
|
-
import webpack from 'webpack';
|
|
17
16
|
import * as querystring from 'querystring';
|
|
18
17
|
import process2 from 'process';
|
|
19
18
|
|
|
@@ -10574,7 +10573,7 @@ const uploadSourcemaps = async (options, context, log) => {
|
|
|
10574
10573
|
};
|
|
10575
10574
|
|
|
10576
10575
|
const defaultIntakeUrl = `https://sourcemap-intake.${process.env.DATADOG_SITE || "datadoghq.com"}/api/v2/srcmap`;
|
|
10577
|
-
const validateOptions$
|
|
10576
|
+
const validateOptions$2 = (config, log) => {
|
|
10578
10577
|
const errors = [];
|
|
10579
10578
|
const sourcemapsResults = validateSourcemapsOptions(config);
|
|
10580
10579
|
errors.push(...sourcemapsResults.errors);
|
|
@@ -10641,7 +10640,7 @@ const validateSourcemapsOptions = (config) => {
|
|
|
10641
10640
|
|
|
10642
10641
|
const getPlugins$2 = (opts, context) => {
|
|
10643
10642
|
const log = getLogger(opts.logLevel, PLUGIN_NAME$1);
|
|
10644
|
-
const rumOptions = validateOptions$
|
|
10643
|
+
const rumOptions = validateOptions$2(opts, log);
|
|
10645
10644
|
return [
|
|
10646
10645
|
{
|
|
10647
10646
|
name: PLUGIN_NAME$1,
|
|
@@ -13646,7 +13645,7 @@ var output$1 = {
|
|
|
13646
13645
|
|
|
13647
13646
|
var libExports = lib$2.exports;
|
|
13648
13647
|
|
|
13649
|
-
const validateOptions = (options) => {
|
|
13648
|
+
const validateOptions$1 = (options) => {
|
|
13650
13649
|
const validatedOptions = options[CONFIG_KEY] || { disabled: false };
|
|
13651
13650
|
return validatedOptions;
|
|
13652
13651
|
};
|
|
@@ -14883,7 +14882,7 @@ const getEsbuildPlugin$1 = (opt, ctx) => {
|
|
|
14883
14882
|
setup: (build) => {
|
|
14884
14883
|
const startBuild = Date.now();
|
|
14885
14884
|
const logger = getLogger(opt.logLevel, "telemetry");
|
|
14886
|
-
const telemetryOptions = validateOptions(opt);
|
|
14885
|
+
const telemetryOptions = validateOptions$1(opt);
|
|
14887
14886
|
build.initialOptions.metafile = true;
|
|
14888
14887
|
wrapPlugins(build, ctx.cwd);
|
|
14889
14888
|
build.onEnd(async (result) => {
|
|
@@ -15194,14 +15193,24 @@ class Tapables {
|
|
|
15194
15193
|
hook.tapAsync = this.newTap("async", hookName, hook.tapAsync, hook);
|
|
15195
15194
|
hook.tapPromise = this.newTap("promise", hookName, hook.tapPromise, hook);
|
|
15196
15195
|
}
|
|
15196
|
+
patchHook(tapableName, hookName, hook) {
|
|
15197
|
+
if (hook._fakeHook) {
|
|
15198
|
+
return;
|
|
15199
|
+
}
|
|
15200
|
+
if (!this.hooks[tapableName]) {
|
|
15201
|
+
this.hooks[tapableName] = [];
|
|
15202
|
+
}
|
|
15203
|
+
if (this.hooks[tapableName].includes(hookName)) {
|
|
15204
|
+
return;
|
|
15205
|
+
}
|
|
15206
|
+
this.hooks[tapableName].push(hookName);
|
|
15207
|
+
this.replaceTaps(hookName, hook);
|
|
15208
|
+
}
|
|
15197
15209
|
checkHooks() {
|
|
15198
15210
|
for (const tapable of this.tapables) {
|
|
15199
15211
|
const name = tapable.constructor.name;
|
|
15200
15212
|
for (const hookName of Object.keys(tapable.hooks)) {
|
|
15201
|
-
|
|
15202
|
-
this.hooks[name].push(hookName);
|
|
15203
|
-
this.replaceTaps(hookName, tapable.hooks[hookName]);
|
|
15204
|
-
}
|
|
15213
|
+
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
15205
15214
|
}
|
|
15206
15215
|
}
|
|
15207
15216
|
}
|
|
@@ -15211,24 +15220,8 @@ class Tapables {
|
|
|
15211
15220
|
if (!this.tapables.includes(tapable)) {
|
|
15212
15221
|
this.tapables.push(tapable);
|
|
15213
15222
|
}
|
|
15214
|
-
if (!this.hooks[name]) {
|
|
15215
|
-
this.hooks[name] = [];
|
|
15216
|
-
}
|
|
15217
15223
|
for (const hookName of Object.keys(tapable.hooks)) {
|
|
15218
|
-
this.hooks[
|
|
15219
|
-
try {
|
|
15220
|
-
if (hookName === "normalModuleLoader" && typeof webpack.NormalModule.getCompilationHooks === "function") {
|
|
15221
|
-
const NormalModule = webpack.NormalModule;
|
|
15222
|
-
const compil = tapable;
|
|
15223
|
-
this.replaceTaps(
|
|
15224
|
-
hookName,
|
|
15225
|
-
NormalModule.getCompilationHooks(compil).loader
|
|
15226
|
-
);
|
|
15227
|
-
} else {
|
|
15228
|
-
this.replaceTaps(hookName, tapable.hooks[hookName]);
|
|
15229
|
-
}
|
|
15230
|
-
} catch (e) {
|
|
15231
|
-
}
|
|
15224
|
+
this.patchHook(name, hookName, tapable.hooks[hookName]);
|
|
15232
15225
|
}
|
|
15233
15226
|
}
|
|
15234
15227
|
}
|
|
@@ -15236,7 +15229,7 @@ class Tapables {
|
|
|
15236
15229
|
const getWebpackPlugin$1 = (opt, ctx) => {
|
|
15237
15230
|
return async (compiler) => {
|
|
15238
15231
|
const HOOK_OPTIONS = { name: PLUGIN_NAME };
|
|
15239
|
-
const options = validateOptions(opt);
|
|
15232
|
+
const options = validateOptions$1(opt);
|
|
15240
15233
|
const logger = getLogger(opt.logLevel, "telemetry");
|
|
15241
15234
|
const modules = new Modules(ctx.cwd, options);
|
|
15242
15235
|
const tapables = new Tapables(ctx.cwd, options);
|
|
@@ -15278,7 +15271,7 @@ const getWebpackPlugin$1 = (opt, ctx) => {
|
|
|
15278
15271
|
};
|
|
15279
15272
|
};
|
|
15280
15273
|
|
|
15281
|
-
const helpers$
|
|
15274
|
+
const helpers$2 = {
|
|
15282
15275
|
filters: defaultFilters
|
|
15283
15276
|
};
|
|
15284
15277
|
const getPlugins = (options, context) => {
|
|
@@ -15420,14 +15413,14 @@ var beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};
|
|
|
15420
15413
|
|
|
15421
15414
|
// Map keyword names to token types.
|
|
15422
15415
|
|
|
15423
|
-
var keywords
|
|
15416
|
+
var keywords = {};
|
|
15424
15417
|
|
|
15425
15418
|
// Succinct definitions of keyword token types
|
|
15426
15419
|
function kw(name, options) {
|
|
15427
15420
|
if ( options === void 0 ) options = {};
|
|
15428
15421
|
|
|
15429
15422
|
options.keyword = name;
|
|
15430
|
-
return keywords
|
|
15423
|
+
return keywords[name] = new TokenType(name, options)
|
|
15431
15424
|
}
|
|
15432
15425
|
|
|
15433
15426
|
var types$1 = {
|
|
@@ -21192,7 +21185,7 @@ pp.readWord = function() {
|
|
|
21192
21185
|
var word = this.readWord1();
|
|
21193
21186
|
var type = types$1.name;
|
|
21194
21187
|
if (this.keywords.test(word)) {
|
|
21195
|
-
type = keywords
|
|
21188
|
+
type = keywords[word];
|
|
21196
21189
|
}
|
|
21197
21190
|
return this.finishToken(type, word)
|
|
21198
21191
|
};
|
|
@@ -21226,7 +21219,7 @@ Parser.acorn = {
|
|
|
21226
21219
|
Node: Node,
|
|
21227
21220
|
TokenType: TokenType,
|
|
21228
21221
|
tokTypes: types$1,
|
|
21229
|
-
keywordTypes: keywords
|
|
21222
|
+
keywordTypes: keywords,
|
|
21230
21223
|
TokContext: TokContext,
|
|
21231
21224
|
tokContexts: types,
|
|
21232
21225
|
isIdentifierChar: isIdentifierChar,
|
|
@@ -26905,16 +26898,25 @@ function createUnplugin(factory) {
|
|
|
26905
26898
|
};
|
|
26906
26899
|
}
|
|
26907
26900
|
|
|
26908
|
-
const helpers = {
|
|
26901
|
+
const helpers$1 = {
|
|
26909
26902
|
// Each product should have a unique entry.
|
|
26910
26903
|
// #helpers-injection-marker
|
|
26911
|
-
[CONFIG_KEY]: helpers$
|
|
26904
|
+
[CONFIG_KEY]: helpers$2
|
|
26912
26905
|
// #helpers-injection-marker
|
|
26913
26906
|
};
|
|
26907
|
+
const validateOptions = (options = {}) => {
|
|
26908
|
+
return {
|
|
26909
|
+
auth: {},
|
|
26910
|
+
disableGit: false,
|
|
26911
|
+
logLevel: "warn",
|
|
26912
|
+
...options
|
|
26913
|
+
};
|
|
26914
|
+
};
|
|
26914
26915
|
const buildPluginFactory = ({
|
|
26915
26916
|
version
|
|
26916
26917
|
}) => {
|
|
26917
|
-
return createUnplugin((
|
|
26918
|
+
return createUnplugin((opts, unpluginMetaContext) => {
|
|
26919
|
+
const options = validateOptions(opts);
|
|
26918
26920
|
if ("esbuildHostName" in unpluginMetaContext) {
|
|
26919
26921
|
unpluginMetaContext.esbuildHostName = "datadog-plugins";
|
|
26920
26922
|
}
|
|
@@ -26933,102 +26935,20 @@ const buildPluginFactory = ({
|
|
|
26933
26935
|
});
|
|
26934
26936
|
};
|
|
26935
26937
|
|
|
26936
|
-
var
|
|
26937
|
-
var packageManager = "yarn@4.0.2";
|
|
26938
|
-
var version = "2.2.0-dev-1";
|
|
26939
|
-
var license = "MIT";
|
|
26940
|
-
var author = "Datadog";
|
|
26941
|
-
var description = "Datadog Vite Plugin";
|
|
26942
|
-
var keywords = [
|
|
26943
|
-
"datadog",
|
|
26944
|
-
"vite",
|
|
26945
|
-
"bundler",
|
|
26946
|
-
"plugin",
|
|
26947
|
-
"unplugin"
|
|
26948
|
-
];
|
|
26949
|
-
var homepage = "https://github.com/DataDog/build-plugins#readme";
|
|
26950
|
-
var repository = {
|
|
26951
|
-
type: "git",
|
|
26952
|
-
url: "https://github.com/DataDog/build-plugins",
|
|
26953
|
-
directory: "packages/vite-plugin"
|
|
26954
|
-
};
|
|
26955
|
-
var main = "./dist/src/index.js";
|
|
26956
|
-
var module$1 = "./dist/src/index.mjs";
|
|
26957
|
-
var exports = {
|
|
26958
|
-
".": "./src/index.ts"
|
|
26959
|
-
};
|
|
26960
|
-
var publishConfig = {
|
|
26961
|
-
access: "public",
|
|
26962
|
-
types: "./dist/src/index.d.ts",
|
|
26963
|
-
exports: {
|
|
26964
|
-
"./package.json": "./package.json",
|
|
26965
|
-
".": {
|
|
26966
|
-
"import": "./dist/src/index.mjs",
|
|
26967
|
-
require: "./dist/src/index.js",
|
|
26968
|
-
types: "./dist/src/index.d.ts"
|
|
26969
|
-
}
|
|
26970
|
-
}
|
|
26971
|
-
};
|
|
26972
|
-
var files = [
|
|
26973
|
-
"dist"
|
|
26974
|
-
];
|
|
26975
|
-
var scripts = {
|
|
26976
|
-
build: "yarn clean && rollup --config rollup.config.mjs",
|
|
26977
|
-
clean: "rm -rf dist",
|
|
26978
|
-
prepack: "yarn build",
|
|
26979
|
-
typecheck: "tsc --noEmit",
|
|
26980
|
-
watch: "yarn clean && rollup --config rollup.config.mjs --watch"
|
|
26981
|
-
};
|
|
26982
|
-
var devDependencies = {
|
|
26983
|
-
"@babel/core": "7.24.5",
|
|
26984
|
-
"@babel/preset-env": "7.24.5",
|
|
26985
|
-
"@babel/preset-typescript": "7.24.1",
|
|
26986
|
-
"@dd/factory": "workspace:*",
|
|
26987
|
-
"@dd/tools": "workspace:*",
|
|
26988
|
-
"@rollup/plugin-babel": "6.0.4",
|
|
26989
|
-
"@rollup/plugin-commonjs": "25.0.7",
|
|
26990
|
-
"@rollup/plugin-json": "6.1.0",
|
|
26991
|
-
"@rollup/plugin-node-resolve": "15.2.3",
|
|
26992
|
-
"@types/babel__core": "^7",
|
|
26993
|
-
"@types/babel__preset-env": "^7",
|
|
26994
|
-
esbuild: "0.21.5",
|
|
26995
|
-
rollup: "4.18.0",
|
|
26996
|
-
"rollup-plugin-dts": "6.1.0",
|
|
26997
|
-
"rollup-plugin-esbuild": "6.1.1",
|
|
26998
|
-
typescript: "5.4.3"
|
|
26999
|
-
};
|
|
27000
|
-
var peerDependencies = {
|
|
27001
|
-
rollup: ">= 4.x < 6.x"
|
|
27002
|
-
};
|
|
27003
|
-
var stableVersion = "2.0.1";
|
|
27004
|
-
var pkg = {
|
|
27005
|
-
name: name,
|
|
27006
|
-
packageManager: packageManager,
|
|
27007
|
-
version: version,
|
|
27008
|
-
license: license,
|
|
27009
|
-
author: author,
|
|
27010
|
-
description: description,
|
|
27011
|
-
keywords: keywords,
|
|
27012
|
-
homepage: homepage,
|
|
27013
|
-
repository: repository,
|
|
27014
|
-
main: main,
|
|
27015
|
-
module: module$1,
|
|
27016
|
-
exports: exports,
|
|
27017
|
-
publishConfig: publishConfig,
|
|
27018
|
-
files: files,
|
|
27019
|
-
scripts: scripts,
|
|
27020
|
-
devDependencies: devDependencies,
|
|
27021
|
-
peerDependencies: peerDependencies,
|
|
27022
|
-
stableVersion: stableVersion
|
|
27023
|
-
};
|
|
26938
|
+
var version = "2.2.1";
|
|
27024
26939
|
|
|
27025
26940
|
const datadogVitePlugin = buildPluginFactory({
|
|
27026
|
-
version
|
|
26941
|
+
version
|
|
27027
26942
|
}).vite;
|
|
27028
|
-
|
|
27029
|
-
helpers,
|
|
27030
|
-
datadogVitePlugin
|
|
27031
|
-
};
|
|
26943
|
+
const helpers = helpers$1;
|
|
27032
26944
|
|
|
27033
26945
|
export { datadogVitePlugin, helpers };
|
|
26946
|
+
|
|
26947
|
+
|
|
26948
|
+
if (typeof module !== 'undefined') {
|
|
26949
|
+
module.exports = {
|
|
26950
|
+
datadogVitePlugin,
|
|
26951
|
+
helpers
|
|
26952
|
+
};
|
|
26953
|
+
}
|
|
27034
26954
|
//# sourceMappingURL=index.mjs.map
|