@depup/babel-jest 30.3.0-depup.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ Copyright Contributors to the Jest project.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @depup/babel-jest
2
+
3
+ > Dependency-bumped version of [babel-jest](https://www.npmjs.com/package/babel-jest)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/babel-jest
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [babel-jest](https://www.npmjs.com/package/babel-jest) @ 30.3.0 |
17
+ | Processed | 2026-03-17 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 2 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | chalk | ^4.1.2 | ^5.6.2 |
26
+ | slash | ^3.0.0 | ^5.1.0 |
27
+
28
+ ---
29
+
30
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/babel-jest
31
+
32
+ License inherited from the original package.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {TransformOptions} from '@babel/core';
9
+ import {SyncTransformer, TransformerCreator} from '@jest/transform';
10
+
11
+ export declare const createTransformer: TransformerCreator<
12
+ SyncTransformer<TransformerConfig>,
13
+ TransformerConfig
14
+ >;
15
+
16
+ export declare interface TransformerConfig extends TransformOptions {
17
+ excludeJestPreset?: boolean;
18
+ }
19
+
20
+ declare const transformerFactory: {
21
+ createTransformer: TransformerCreator<
22
+ SyncTransformer<TransformerConfig>,
23
+ TransformerConfig
24
+ >;
25
+ };
26
+ export default transformerFactory;
27
+
28
+ export {};
package/build/index.js ADDED
@@ -0,0 +1,299 @@
1
+ /*!
2
+ * /**
3
+ * * Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ * *
5
+ * * This source code is licensed under the MIT license found in the
6
+ * * LICENSE file in the root directory of this source tree.
7
+ * * /
8
+ */
9
+ /******/ (() => { // webpackBootstrap
10
+ /******/ "use strict";
11
+ /******/ var __webpack_modules__ = ({
12
+
13
+ /***/ "./src/babel.ts"
14
+ (__unused_webpack_module, exports) {
15
+
16
+
17
+
18
+ Object.defineProperty(exports, "__esModule", ({
19
+ value: true
20
+ }));
21
+ Object.defineProperty(exports, "loadPartialConfigAsync", ({
22
+ enumerable: true,
23
+ get: function () {
24
+ return _core().loadPartialConfigAsync;
25
+ }
26
+ }));
27
+ exports.loadPartialConfigSync = void 0;
28
+ Object.defineProperty(exports, "transformAsync", ({
29
+ enumerable: true,
30
+ get: function () {
31
+ return _core().transformAsync;
32
+ }
33
+ }));
34
+ Object.defineProperty(exports, "transformSync", ({
35
+ enumerable: true,
36
+ get: function () {
37
+ return _core().transformSync;
38
+ }
39
+ }));
40
+ function _core() {
41
+ const data = require("@babel/core");
42
+ _core = function () {
43
+ return data;
44
+ };
45
+ return data;
46
+ }
47
+ /**
48
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
49
+ *
50
+ * This source code is licensed under the MIT license found in the
51
+ * LICENSE file in the root directory of this source tree.
52
+ */
53
+
54
+ // this is a separate file so it can be mocked in tests
55
+
56
+ // Old babel 7 versions didn't have loadPartialConfigSync
57
+ const _loadPartialConfigSync = exports.loadPartialConfigSync = _core().loadPartialConfigSync ?? _core().loadPartialConfig;
58
+
59
+ /***/ }
60
+
61
+ /******/ });
62
+ /************************************************************************/
63
+ /******/ // The module cache
64
+ /******/ var __webpack_module_cache__ = {};
65
+ /******/
66
+ /******/ // The require function
67
+ /******/ function __webpack_require__(moduleId) {
68
+ /******/ // Check if module is in cache
69
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
70
+ /******/ if (cachedModule !== undefined) {
71
+ /******/ return cachedModule.exports;
72
+ /******/ }
73
+ /******/ // Create a new module (and put it into the cache)
74
+ /******/ var module = __webpack_module_cache__[moduleId] = {
75
+ /******/ // no module.id needed
76
+ /******/ // no module.loaded needed
77
+ /******/ exports: {}
78
+ /******/ };
79
+ /******/
80
+ /******/ // Execute the module function
81
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
82
+ /******/
83
+ /******/ // Return the exports of the module
84
+ /******/ return module.exports;
85
+ /******/ }
86
+ /******/
87
+ /************************************************************************/
88
+ var __webpack_exports__ = {};
89
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
90
+ (() => {
91
+ var exports = __webpack_exports__;
92
+
93
+
94
+ Object.defineProperty(exports, "__esModule", ({
95
+ value: true
96
+ }));
97
+ exports["default"] = exports.createTransformer = void 0;
98
+ function _crypto() {
99
+ const data = require("crypto");
100
+ _crypto = function () {
101
+ return data;
102
+ };
103
+ return data;
104
+ }
105
+ function path() {
106
+ const data = _interopRequireWildcard(require("path"));
107
+ path = function () {
108
+ return data;
109
+ };
110
+ return data;
111
+ }
112
+ function _chalk() {
113
+ const data = _interopRequireDefault(require("chalk"));
114
+ _chalk = function () {
115
+ return data;
116
+ };
117
+ return data;
118
+ }
119
+ function fs() {
120
+ const data = _interopRequireWildcard(require("graceful-fs"));
121
+ fs = function () {
122
+ return data;
123
+ };
124
+ return data;
125
+ }
126
+ function _slash() {
127
+ const data = _interopRequireDefault(require("slash"));
128
+ _slash = function () {
129
+ return data;
130
+ };
131
+ return data;
132
+ }
133
+ var _babel = __webpack_require__("./src/babel.ts");
134
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
135
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
136
+ /**
137
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
138
+ *
139
+ * This source code is licensed under the MIT license found in the
140
+ * LICENSE file in the root directory of this source tree.
141
+ */
142
+
143
+ const THIS_FILE = fs().readFileSync(__filename);
144
+ const jestPresetPath = require.resolve('babel-preset-jest');
145
+ const babelIstanbulPlugin = require.resolve('babel-plugin-istanbul');
146
+ function assertLoadedBabelConfig(babelConfig, cwd, filename) {
147
+ if (!babelConfig) {
148
+ throw new Error(`babel-jest: Babel ignores ${_chalk().default.bold((0, _slash().default)(path().relative(cwd, filename)))} - make sure to include the file in Jest's ${_chalk().default.bold('transformIgnorePatterns')} as well.`);
149
+ }
150
+ }
151
+ function addIstanbulInstrumentation(babelOptions, transformOptions) {
152
+ if (transformOptions.instrument) {
153
+ const copiedBabelOptions = {
154
+ ...babelOptions
155
+ };
156
+ copiedBabelOptions.auxiliaryCommentBefore = ' istanbul ignore next ';
157
+ // Copied from jest-runtime transform.js
158
+ copiedBabelOptions.plugins = [...(copiedBabelOptions.plugins ?? []), [babelIstanbulPlugin, {
159
+ // files outside `cwd` will not be instrumented
160
+ cwd: transformOptions.config.cwd,
161
+ exclude: []
162
+ }]];
163
+ return copiedBabelOptions;
164
+ }
165
+ return babelOptions;
166
+ }
167
+ function getCacheKeyFromConfig(sourceText, sourcePath, babelOptions, transformOptions) {
168
+ const {
169
+ config,
170
+ configString,
171
+ instrument
172
+ } = transformOptions;
173
+ const configPath = [babelOptions.config ?? '', babelOptions.babelrc ?? ''];
174
+ return (0, _crypto().createHash)('sha1').update(THIS_FILE).update('\0', 'utf8').update(JSON.stringify(babelOptions.options)).update('\0', 'utf8').update(sourceText).update('\0', 'utf8').update(path().relative(config.rootDir, sourcePath)).update('\0', 'utf8').update(configString).update('\0', 'utf8').update(configPath.join('')).update('\0', 'utf8').update(instrument ? 'instrument' : '').update('\0', 'utf8').update("production" ?? 0).update('\0', 'utf8').update(process.env.BABEL_ENV ?? '').update('\0', 'utf8').update(process.version).digest('hex').slice(0, 32);
175
+ }
176
+ function loadBabelConfig(cwd, filename, transformOptions) {
177
+ const babelConfig = (0, _babel.loadPartialConfigSync)(transformOptions);
178
+ assertLoadedBabelConfig(babelConfig, cwd, filename);
179
+ return babelConfig;
180
+ }
181
+ async function loadBabelConfigAsync(cwd, filename, transformOptions) {
182
+ const babelConfig = await (0, _babel.loadPartialConfigAsync)(transformOptions);
183
+ assertLoadedBabelConfig(babelConfig, cwd, filename);
184
+ return babelConfig;
185
+ }
186
+ function loadBabelOptions(cwd, filename, transformOptions, jestTransformOptions) {
187
+ const {
188
+ options
189
+ } = loadBabelConfig(cwd, filename, transformOptions);
190
+ return addIstanbulInstrumentation(options, jestTransformOptions);
191
+ }
192
+ async function loadBabelOptionsAsync(cwd, filename, transformOptions, jestTransformOptions) {
193
+ const {
194
+ options
195
+ } = await loadBabelConfigAsync(cwd, filename, transformOptions);
196
+ return addIstanbulInstrumentation(options, jestTransformOptions);
197
+ }
198
+ const createTransformer = transformerConfig => {
199
+ const {
200
+ excludeJestPreset,
201
+ ...inputOptions
202
+ } = transformerConfig ?? {};
203
+ const options = {
204
+ ...inputOptions,
205
+ caller: {
206
+ name: 'babel-jest',
207
+ supportsDynamicImport: false,
208
+ supportsExportNamespaceFrom: false,
209
+ supportsStaticESM: false,
210
+ supportsTopLevelAwait: false,
211
+ ...inputOptions.caller
212
+ },
213
+ compact: false,
214
+ plugins: inputOptions.plugins ?? [],
215
+ presets: [...(inputOptions.presets ?? []), ...(excludeJestPreset === true ? [] : [jestPresetPath])],
216
+ sourceMaps: 'both'
217
+ };
218
+ function mergeBabelTransformOptions(filename, transformOptions) {
219
+ const {
220
+ cwd,
221
+ rootDir
222
+ } = transformOptions.config;
223
+ // `cwd` and `root` first to allow incoming options to override it
224
+ return {
225
+ cwd,
226
+ root: rootDir,
227
+ ...options,
228
+ caller: {
229
+ ...options.caller,
230
+ supportsDynamicImport: transformOptions.supportsDynamicImport ?? options.caller.supportsDynamicImport,
231
+ supportsExportNamespaceFrom: transformOptions.supportsExportNamespaceFrom ?? options.caller.supportsExportNamespaceFrom,
232
+ supportsStaticESM: transformOptions.supportsStaticESM ?? options.caller.supportsStaticESM,
233
+ supportsTopLevelAwait: transformOptions.supportsTopLevelAwait ?? options.caller.supportsTopLevelAwait
234
+ },
235
+ filename
236
+ };
237
+ }
238
+ return {
239
+ canInstrument: true,
240
+ getCacheKey(sourceText, sourcePath, transformOptions) {
241
+ const babelOptions = loadBabelConfig(transformOptions.config.cwd, sourcePath, mergeBabelTransformOptions(sourcePath, transformOptions));
242
+ return getCacheKeyFromConfig(sourceText, sourcePath, babelOptions, transformOptions);
243
+ },
244
+ async getCacheKeyAsync(sourceText, sourcePath, transformOptions) {
245
+ const babelOptions = await loadBabelConfigAsync(transformOptions.config.cwd, sourcePath, mergeBabelTransformOptions(sourcePath, transformOptions));
246
+ return getCacheKeyFromConfig(sourceText, sourcePath, babelOptions, transformOptions);
247
+ },
248
+ process(sourceText, sourcePath, transformOptions) {
249
+ const babelOptions = loadBabelOptions(transformOptions.config.cwd, sourcePath, mergeBabelTransformOptions(sourcePath, transformOptions), transformOptions);
250
+ const transformResult = (0, _babel.transformSync)(sourceText, babelOptions);
251
+ if (transformResult) {
252
+ const {
253
+ code,
254
+ map
255
+ } = transformResult;
256
+ if (typeof code === 'string') {
257
+ return {
258
+ code,
259
+ map
260
+ };
261
+ }
262
+ }
263
+ return {
264
+ code: sourceText
265
+ };
266
+ },
267
+ async processAsync(sourceText, sourcePath, transformOptions) {
268
+ const babelOptions = await loadBabelOptionsAsync(transformOptions.config.cwd, sourcePath, mergeBabelTransformOptions(sourcePath, transformOptions), transformOptions);
269
+ const transformResult = await (0, _babel.transformAsync)(sourceText, babelOptions);
270
+ if (transformResult) {
271
+ const {
272
+ code,
273
+ map
274
+ } = transformResult;
275
+ if (typeof code === 'string') {
276
+ return {
277
+ code,
278
+ map
279
+ };
280
+ }
281
+ }
282
+ return {
283
+ code: sourceText
284
+ };
285
+ }
286
+ };
287
+ };
288
+ exports.createTransformer = createTransformer;
289
+ const transformerFactory = {
290
+ // Assigned here, instead of as a separate export, due to limitations in Jest's
291
+ // requireOrImportModule, requiring all exports to be on the `default` export
292
+ createTransformer
293
+ };
294
+ var _default = exports["default"] = transformerFactory;
295
+ })();
296
+
297
+ module.exports = __webpack_exports__;
298
+ /******/ })()
299
+ ;
@@ -0,0 +1,4 @@
1
+ import cjsModule from './index.js';
2
+
3
+ export const createTransformer = cjsModule.createTransformer;
4
+ export default cjsModule.default;
package/changes.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "bumped": {
3
+ "chalk": {
4
+ "from": "^4.1.2",
5
+ "to": "^5.6.2"
6
+ },
7
+ "slash": {
8
+ "from": "^3.0.0",
9
+ "to": "^5.1.0"
10
+ }
11
+ },
12
+ "timestamp": "2026-03-17T16:34:41.519Z",
13
+ "totalUpdated": 2
14
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@depup/babel-jest",
3
+ "description": "[DepUp] Jest plugin to use babel for transformation.",
4
+ "version": "30.3.0-depup.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/jestjs/jest.git",
8
+ "directory": "packages/babel-jest"
9
+ },
10
+ "license": "MIT",
11
+ "main": "./build/index.js",
12
+ "types": "./build/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./build/index.d.ts",
16
+ "require": "./build/index.js",
17
+ "import": "./build/index.mjs",
18
+ "default": "./build/index.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "dependencies": {
23
+ "@jest/transform": "30.3.0",
24
+ "@types/babel__core": "^7.20.5",
25
+ "babel-plugin-istanbul": "^7.0.1",
26
+ "babel-preset-jest": "30.3.0",
27
+ "chalk": "^5.6.2",
28
+ "graceful-fs": "^4.2.11",
29
+ "slash": "^5.1.0"
30
+ },
31
+ "devDependencies": {
32
+ "@babel-8/core": "npm:@babel/core@8.0.0-beta.2",
33
+ "@babel/core": "^7.27.4",
34
+ "@jest/test-utils": "30.3.0",
35
+ "@types/graceful-fs": "^4.1.9"
36
+ },
37
+ "peerDependencies": {
38
+ "@babel/core": "^7.11.0 || ^8.0.0-0"
39
+ },
40
+ "engines": {
41
+ "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
42
+ },
43
+ "gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068",
44
+ "keywords": [
45
+ "depup",
46
+ "dependency-bumped",
47
+ "updated-deps",
48
+ "babel-jest"
49
+ ],
50
+ "depup": {
51
+ "changes": {
52
+ "chalk": {
53
+ "from": "^4.1.2",
54
+ "to": "^5.6.2"
55
+ },
56
+ "slash": {
57
+ "from": "^3.0.0",
58
+ "to": "^5.1.0"
59
+ }
60
+ },
61
+ "depsUpdated": 2,
62
+ "originalPackage": "babel-jest",
63
+ "originalVersion": "30.3.0",
64
+ "processedAt": "2026-03-17T16:34:48.808Z",
65
+ "smokeTest": "passed"
66
+ }
67
+ }