@relative-ci/rollup-plugin 5.3.2 → 5.3.3
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/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/package.json +6 -6
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;AAgB2B;KAStB,aAAA;EACH,IAAA,GAAO,OAAA;EACP,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;AAAA
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;AAgB2B;KAStB,aAAA;EACH,IAAA,GAAO,OAAA;EACP,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;AAAA;;;;;;AAAe;AAYzB;;;KAAY,MAAA;EAYA,yEAVV,IAAA;EAYmB;;;;;EALnB,cAAA,IACE,IAAA,EAAM,aAAA,EACN,aAAA,WACA,MAAA,EAAQ,YAAA,EACR,OAAA,qBACU,OAAA;AAAA;AAAA,KAGT,sBAAA;EALD;;;;EAUF,OAAA;EALG;;;;EAUH,WAAA;EAKuC;;;;EAAvC,KAAA,GAAQ,IAAA,CAAK,YAAA,cAA0B,sBAAA;AAAA,IACrC,YAAA;AAAA,cAeS,eAAA,GAAmB,WAAA,GAAa,sBAAA,KAA8B,MAoEzE"}
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;AAgB2B;KAStB,aAAA;EACH,IAAA,GAAO,OAAA;EACP,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;AAAA
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;AAgB2B;KAStB,aAAA;EACH,IAAA,GAAO,OAAA;EACP,IAAA,GAAO,OAAA;EACP,KAAA,GAAQ,OAAA;AAAA;;;;;;AAAe;AAYzB;;;KAAY,MAAA;EAYA,yEAVV,IAAA;EAYmB;;;;;EALnB,cAAA,IACE,IAAA,EAAM,aAAA,EACN,aAAA,WACA,MAAA,EAAQ,YAAA,EACR,OAAA,qBACU,OAAA;AAAA;AAAA,KAGT,sBAAA;EALD;;;;EAUF,OAAA;EALG;;;;EAUH,WAAA;EAKuC;;;;EAAvC,KAAA,GAAQ,IAAA,CAAK,YAAA,cAA0B,sBAAA;AAAA,IACrC,YAAA;AAAA,cAeS,eAAA,GAAmB,WAAA,GAAa,sBAAA,KAA8B,MAoEzE"}
|
package/dist/plugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import _ from 'lodash';\nimport { type OutputBundle } from 'rollup-plugin-stats';\n// eslint-disable-next-line import/no-unresolved\nimport extractStats, { type StatsOptions } from 'rollup-plugin-stats/extract';\n// eslint-disable-next-line import/no-unresolved\nimport { bundleToWebpackStats } from 'rollup-plugin-webpack-stats/transform';\nimport type { BundleTransformOptions } from 'rollup-plugin-webpack-stats/transform';\n\nimport {\n type Logger,\n type PluginConfig,\n SOURCE_WEBPACK_STATS,\n debug,\n filterArtifacts,\n logResponse,\n validateWebpackStats,\n} from '@relative-ci/core';\nimport loadEnv, { isCi } from '@relative-ci/core/env';\nimport ingest from '@relative-ci/core/ingest';\n\nconst PLUGIN_NAME = 'RelativeCiAgent';\n\n/**\n * Subset of the Vite/Rolldown/Rollup plugin hook context (`this`) used by this plugin.\n */\ntype PluginContext = {\n info: (message: string) => void;\n warn: (message: string) => void;\n error: (message: string) => void;\n};\n\n/**\n * Minimum plugin interface compatible with Vite/Rolldown/Rollup.\n *\n * @example\n * {\n * name: 'rollupStats',\n * async generateBundle(outputOptions, bundle) { ... },\n * }\n */\nexport type Plugin = {\n /** Unique identifier for the plugin, used in error messages and logs. */\n name: string;\n\n /**\n * Hook called after the bundle has been fully generated but before it is\n * written to disk. Receives the resolved output options and the complete\n * output bundle map.\n */\n generateBundle?: (\n this: PluginContext,\n outputOptions: unknown,\n bundle: OutputBundle,\n isWrite: boolean,\n ) => void | Promise<void>;\n};\n\ntype RelativeCiAgentOptions = {\n /**\n * Plugin is enabled - sends data to RelativeCI\n * @default env-ci isCi value\n */\n enabled?: boolean;\n /**\n * Throw error when validation or ingestion fails\n * @default {false}\n */\n failOnError?: boolean;\n /**\n * Rollup/Vite/Rolldown stats options\n * @default assets, chunks, modules\n */\n stats?: Omit<StatsOptions, 'source'> & BundleTransformOptions;\n} & PluginConfig;\n\nconst DEFAULT_OPTIONS = {\n enabled: isCi(),\n failOnError: false,\n includeCommitMessage: true,\n payloadFilepath: undefined,\n compress: false,\n stats: {\n assets: true,\n chunks: true,\n modules: true,\n },\n};\n\nexport const relativeCiAgent = (userOptions: RelativeCiAgentOptions = {}): Plugin => ({\n name: PLUGIN_NAME,\n async generateBundle(__, bundle) {\n const logger: Logger = {\n log: console.log, // eslint-disable-line no-console\n info: this.info,\n warn: this.warn,\n error: this.error,\n debug, // send debug messages to the inline utility for consistent debugging across plugins\n };\n\n const options = _.merge({}, DEFAULT_OPTIONS, userOptions) as RelativeCiAgentOptions;\n\n logger.debug(options);\n\n const {\n enabled,\n failOnError,\n includeCommitMessage,\n stats: statsOptions = {},\n ...agentOptions\n } = options;\n\n // Skip if not enabled\n if (!enabled) {\n logger.debug(`${PLUGIN_NAME} is disabled, skip sending data.`);\n return;\n }\n\n // 1. Extract bundle stats from rollup/vite/rolldown\n const { moduleOriginalSize, transform, ...extractStatsOptions } = statsOptions;\n\n const bundleStats = extractStats(bundle, {\n source: true, // extract stats source to calculate module size\n ...extractStatsOptions,\n });\n\n // 2. Transform bundle stats to supported format\n const bundleWebpackStats = bundleToWebpackStats(bundleStats, { moduleOriginalSize, transform });\n\n // 3. Ingest data\n // catch error to prevent process failure on error\n try {\n validateWebpackStats(bundleWebpackStats);\n\n const envParams = await loadEnv(\n { agentType: 'rollup-plugin' },\n { includeCommitMessage },\n logger,\n );\n const artifactsData = filterArtifacts([\n { key: SOURCE_WEBPACK_STATS, data: bundleWebpackStats },\n ]);\n const response = await ingest(artifactsData, envParams, agentOptions, logger);\n\n logResponse(response);\n } catch (pluginError: unknown) {\n const error = pluginError instanceof Error ? pluginError.message : String(pluginError);\n\n // Propagate the error to the bundler if failOnError is enabled, otherwise log a warning and continue\n if (failOnError) {\n logger.error(error);\n return;\n }\n\n logger.warn(error);\n }\n },\n});\n"],"mappings":";;;;;;;;AAoBA,MAAM,cAAc;AAuDpB,MAAM,kBAAkB;CACtB,SAAS,
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import _ from 'lodash';\nimport { type OutputBundle } from 'rollup-plugin-stats';\n// eslint-disable-next-line import/no-unresolved\nimport extractStats, { type StatsOptions } from 'rollup-plugin-stats/extract';\n// eslint-disable-next-line import/no-unresolved\nimport { bundleToWebpackStats } from 'rollup-plugin-webpack-stats/transform';\nimport type { BundleTransformOptions } from 'rollup-plugin-webpack-stats/transform';\n\nimport {\n type Logger,\n type PluginConfig,\n SOURCE_WEBPACK_STATS,\n debug,\n filterArtifacts,\n logResponse,\n validateWebpackStats,\n} from '@relative-ci/core';\nimport loadEnv, { isCi } from '@relative-ci/core/env';\nimport ingest from '@relative-ci/core/ingest';\n\nconst PLUGIN_NAME = 'RelativeCiAgent';\n\n/**\n * Subset of the Vite/Rolldown/Rollup plugin hook context (`this`) used by this plugin.\n */\ntype PluginContext = {\n info: (message: string) => void;\n warn: (message: string) => void;\n error: (message: string) => void;\n};\n\n/**\n * Minimum plugin interface compatible with Vite/Rolldown/Rollup.\n *\n * @example\n * {\n * name: 'rollupStats',\n * async generateBundle(outputOptions, bundle) { ... },\n * }\n */\nexport type Plugin = {\n /** Unique identifier for the plugin, used in error messages and logs. */\n name: string;\n\n /**\n * Hook called after the bundle has been fully generated but before it is\n * written to disk. Receives the resolved output options and the complete\n * output bundle map.\n */\n generateBundle?: (\n this: PluginContext,\n outputOptions: unknown,\n bundle: OutputBundle,\n isWrite: boolean,\n ) => void | Promise<void>;\n};\n\ntype RelativeCiAgentOptions = {\n /**\n * Plugin is enabled - sends data to RelativeCI\n * @default env-ci isCi value\n */\n enabled?: boolean;\n /**\n * Throw error when validation or ingestion fails\n * @default {false}\n */\n failOnError?: boolean;\n /**\n * Rollup/Vite/Rolldown stats options\n * @default assets, chunks, modules\n */\n stats?: Omit<StatsOptions, 'source'> & BundleTransformOptions;\n} & PluginConfig;\n\nconst DEFAULT_OPTIONS = {\n enabled: isCi(),\n failOnError: false,\n includeCommitMessage: true,\n payloadFilepath: undefined,\n compress: false,\n stats: {\n assets: true,\n chunks: true,\n modules: true,\n },\n};\n\nexport const relativeCiAgent = (userOptions: RelativeCiAgentOptions = {}): Plugin => ({\n name: PLUGIN_NAME,\n async generateBundle(__, bundle) {\n const logger: Logger = {\n log: console.log, // eslint-disable-line no-console\n info: this.info,\n warn: this.warn,\n error: this.error,\n debug, // send debug messages to the inline utility for consistent debugging across plugins\n };\n\n const options = _.merge({}, DEFAULT_OPTIONS, userOptions) as RelativeCiAgentOptions;\n\n logger.debug(options);\n\n const {\n enabled,\n failOnError,\n includeCommitMessage,\n stats: statsOptions = {},\n ...agentOptions\n } = options;\n\n // Skip if not enabled\n if (!enabled) {\n logger.debug(`${PLUGIN_NAME} is disabled, skip sending data.`);\n return;\n }\n\n // 1. Extract bundle stats from rollup/vite/rolldown\n const { moduleOriginalSize, transform, ...extractStatsOptions } = statsOptions;\n\n const bundleStats = extractStats(bundle, {\n source: true, // extract stats source to calculate module size\n ...extractStatsOptions,\n });\n\n // 2. Transform bundle stats to supported format\n const bundleWebpackStats = bundleToWebpackStats(bundleStats, { moduleOriginalSize, transform });\n\n // 3. Ingest data\n // catch error to prevent process failure on error\n try {\n validateWebpackStats(bundleWebpackStats);\n\n const envParams = await loadEnv(\n { agentType: 'rollup-plugin' },\n { includeCommitMessage },\n logger,\n );\n const artifactsData = filterArtifacts([\n { key: SOURCE_WEBPACK_STATS, data: bundleWebpackStats },\n ]);\n const response = await ingest(artifactsData, envParams, agentOptions, logger);\n\n logResponse(response);\n } catch (pluginError: unknown) {\n const error = pluginError instanceof Error ? pluginError.message : String(pluginError);\n\n // Propagate the error to the bundler if failOnError is enabled, otherwise log a warning and continue\n if (failOnError) {\n logger.error(error);\n return;\n }\n\n logger.warn(error);\n }\n },\n});\n"],"mappings":";;;;;;;;AAoBA,MAAM,cAAc;AAuDpB,MAAM,kBAAkB;CACtB,SAAS,KAAK;CACd,aAAa;CACb,sBAAsB;CACtB,iBAAiB;CACjB,UAAU;CACV,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,SAAS;CACX;AACF;AAEA,MAAa,mBAAmB,cAAsC,CAAC,OAAe;CACpF,MAAM;CACN,MAAM,eAAe,IAAI,QAAQ;EAC/B,MAAM,SAAiB;GACrB,KAAK,QAAQ;GACb,MAAM,KAAK;GACX,MAAM,KAAK;GACX,OAAO,KAAK;GACZ;EACF;EAEA,MAAM,UAAU,EAAE,MAAM,CAAC,GAAG,iBAAiB,WAAW;EAExD,OAAO,MAAM,OAAO;EAEpB,MAAM,EACJ,SACA,aACA,sBACA,OAAO,eAAe,CAAC,GACvB,GAAG,iBACD;EAGJ,IAAI,CAAC,SAAS;GACZ,OAAO,MAAM,GAAG,YAAY,iCAAiC;GAC7D;EACF;EAGA,MAAM,EAAE,oBAAoB,WAAW,GAAG,wBAAwB;EAQlE,MAAM,qBAAqB,qBANP,aAAa,QAAQ;GACvC,QAAQ;GACR,GAAG;EACL,CAG0D,GAAG;GAAE;GAAoB;EAAU,CAAC;EAI9F,IAAI;GACF,qBAAqB,kBAAkB;GAEvC,MAAM,YAAY,MAAM,QACtB,EAAE,WAAW,gBAAgB,GAC7B,EAAE,qBAAqB,GACvB,MACF;GAMA,YAAY,MAFW,OAHD,gBAAgB,CACpC;IAAE,KAAK;IAAsB,MAAM;GAAmB,CACxD,CAC0C,GAAG,WAAW,cAAc,MAAM,CAExD;EACtB,SAAS,aAAsB;GAC7B,MAAM,QAAQ,uBAAuB,QAAQ,YAAY,UAAU,OAAO,WAAW;GAGrF,IAAI,aAAa;IACf,OAAO,MAAM,KAAK;IAClB;GACF;GAEA,OAAO,KAAK,KAAK;EACnB;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relative-ci/rollup-plugin",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "Rollup/Vite/Rolldown plugin that sends bundle stats and CI build information to RelativeCI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"relative-ci",
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
"@rollup/plugin-replace": "6.0.3",
|
|
69
69
|
"@types/lodash": "4.17.24",
|
|
70
70
|
"rimraf": "6.1.3",
|
|
71
|
-
"tsdown": "0.
|
|
71
|
+
"tsdown": "0.22.0",
|
|
72
72
|
"typescript": "5.9.3",
|
|
73
73
|
"vite": "7.3.2",
|
|
74
|
-
"vitest": "4.1.
|
|
74
|
+
"vitest": "4.1.7"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@relative-ci/core": "5.3.
|
|
77
|
+
"@relative-ci/core": "5.3.3",
|
|
78
78
|
"lodash": "4.18.1",
|
|
79
79
|
"rollup-plugin-stats": "2.1.2",
|
|
80
80
|
"rollup-plugin-webpack-stats": "3.1.2"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"rolldown": "^1.0.0-beta.0",
|
|
84
|
-
"rollup": "^
|
|
84
|
+
"rollup": "^4.60.4",
|
|
85
85
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"optional": true
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "6b3a444d995e785f40c36ef9b819d19c0e0e2d51"
|
|
99
99
|
}
|