@remotion/browser-bundler 4.0.533 → 4.0.535

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/compiler.js CHANGED
@@ -1,27 +1,3 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __toESM = (mod, isNodeMode, target) => {
7
- target = mod != null ? __create(__getProtoOf(mod)) : {};
8
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
- for (let key of __getOwnPropNames(mod))
10
- if (!__hasOwnProp.call(to, key))
11
- __defProp(to, key, {
12
- get: () => mod[key],
13
- enumerable: true
14
- });
15
- return to;
16
- };
17
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
- }) : x)(function(x) {
20
- if (typeof require !== "undefined")
21
- return require.apply(this, arguments);
22
- throw Error('Dynamic require of "' + x + '" is not supported');
23
- });
24
-
25
1
  // src/load-rspack.ts
26
2
  var rspackBrowserPromise = null;
27
3
  var loadRspackBrowser = (onProgress) => {
@@ -425,7 +401,395 @@ var getBrowserReactRefreshVirtualFiles = ({
425
401
  runtime,
426
402
  utils
427
403
  }) => {
428
- if (false) {}
404
+ if (typeof { entry: `var RefreshRuntime = require('react-refresh/runtime');
405
+ var safeThis = (function () {
406
+ // copied from core-js-pure/features/global-this
407
+ 'use strict';
408
+
409
+ var check = function (it) {
410
+ return it && it.Math == Math && it;
411
+ };
412
+
413
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
414
+ // eslint-disable-next-line es/no-global-this -- safe
415
+ return (
416
+ check(typeof globalThis == 'object' && globalThis) ||
417
+ check(typeof window == 'object' && window) ||
418
+ // eslint-disable-next-line no-restricted-globals -- safe
419
+ check(typeof self == 'object' && self) ||
420
+ check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) ||
421
+ // eslint-disable-next-line no-new-func -- fallback
422
+ (function () {
423
+ return this;
424
+ })() ||
425
+ this ||
426
+ Function('return this')()
427
+ );
428
+ })();
429
+
430
+ if (process.env.NODE_ENV !== 'production') {
431
+ if (typeof safeThis !== 'undefined') {
432
+ var $RefreshInjected$ = '__reactRefreshInjected';
433
+ // Namespace the injected flag (if necessary) for monorepo compatibility
434
+ if (
435
+ typeof __react_refresh_library__ !== 'undefined' &&
436
+ __react_refresh_library__
437
+ ) {
438
+ $RefreshInjected$ += '_' + __react_refresh_library__;
439
+ }
440
+
441
+ // Only inject the runtime if it hasn't been injected
442
+ if (!safeThis[$RefreshInjected$]) {
443
+ RefreshRuntime.injectIntoGlobalHook(safeThis);
444
+
445
+ // Empty implementation to avoid "ReferenceError: variable is not defined" in module which didn't pass builtin:react-refresh-loader
446
+ safeThis.$RefreshSig$ = () => (type) => type;
447
+ safeThis.$RefreshReg$ = () => {};
448
+
449
+ // Mark the runtime as injected to prevent double-injection
450
+ safeThis[$RefreshInjected$] = true;
451
+ }
452
+ }
453
+ }
454
+ `, runtime: `const RefreshUtils = require('./refreshUtils');
455
+ const RefreshRuntime = require('react-refresh/runtime');
456
+
457
+ function refresh(moduleId, webpackHot) {
458
+ const currentExports = RefreshUtils.getModuleExports(moduleId);
459
+ const fn = (exports) => {
460
+ var errorOverlay;
461
+ if (typeof __react_refresh_error_overlay__ !== 'undefined') {
462
+ errorOverlay = __react_refresh_error_overlay__;
463
+ }
464
+ var testMode;
465
+ if (typeof __react_refresh_test__ !== 'undefined') {
466
+ testMode = __react_refresh_test__;
467
+ }
468
+ RefreshUtils.executeRuntime(
469
+ exports,
470
+ moduleId,
471
+ webpackHot,
472
+ errorOverlay,
473
+ testMode,
474
+ );
475
+ };
476
+ if (typeof Promise !== 'undefined' && currentExports instanceof Promise) {
477
+ currentExports.then(fn);
478
+ } else {
479
+ fn(currentExports);
480
+ }
481
+ }
482
+
483
+ module.exports = {
484
+ refresh,
485
+ register: RefreshRuntime.register,
486
+ createSignatureFunctionForTransform:
487
+ RefreshRuntime.createSignatureFunctionForTransform,
488
+ };
489
+ `, utils: `/* global __webpack_require__ */
490
+ var Refresh = require('react-refresh/runtime');
491
+
492
+ /**
493
+ * Extracts exports from a webpack module object.
494
+ * @param {string} moduleId A Webpack module ID.
495
+ * @returns {*} An exports object from the module.
496
+ */
497
+ function getModuleExports(moduleId) {
498
+ if (typeof moduleId === 'undefined') {
499
+ // \`moduleId\` is unavailable, which indicates that this module is not in the cache,
500
+ // which means we won't be able to capture any exports,
501
+ // and thus they cannot be refreshed safely.
502
+ // These are likely runtime or dynamically generated modules.
503
+ return {};
504
+ }
505
+
506
+ var maybeModule = __webpack_require__.c[moduleId];
507
+ if (typeof maybeModule === 'undefined') {
508
+ // \`moduleId\` is available but the module in cache is unavailable,
509
+ // which indicates the module is somehow corrupted (e.g. broken Webpacak \`module\` globals).
510
+ // We will warn the user (as this is likely a mistake) and assume they cannot be refreshed.
511
+ console.warn(
512
+ '[React Refresh] Failed to get exports for module: ' + moduleId + '.',
513
+ );
514
+ return {};
515
+ }
516
+
517
+ var exportsOrPromise = maybeModule.exports;
518
+ if (typeof Promise !== 'undefined' && exportsOrPromise instanceof Promise) {
519
+ return exportsOrPromise.then(function (exports) {
520
+ return exports;
521
+ });
522
+ }
523
+ return exportsOrPromise;
524
+ }
525
+
526
+ /**
527
+ * Calculates the signature of a React refresh boundary.
528
+ * If this signature changes, it's unsafe to accept the boundary.
529
+ *
530
+ * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/907d6af22ac6ebe58572be418e9253a90665ecbd/packages/metro/src/lib/polyfills/require.js#L795-L816).
531
+ * @param {*} moduleExports A Webpack module exports object.
532
+ * @returns {string[]} A React refresh boundary signature array.
533
+ */
534
+ function getReactRefreshBoundarySignature(moduleExports) {
535
+ var signature = [];
536
+ signature.push(Refresh.getFamilyByType(moduleExports));
537
+
538
+ if (moduleExports == null || typeof moduleExports !== 'object') {
539
+ // Exit if we can't iterate over exports.
540
+ return signature;
541
+ }
542
+
543
+ for (var key in moduleExports) {
544
+ if (key === '__esModule') {
545
+ continue;
546
+ }
547
+
548
+ signature.push(key);
549
+ signature.push(Refresh.getFamilyByType(moduleExports[key]));
550
+ }
551
+
552
+ return signature;
553
+ }
554
+
555
+ /**
556
+ * Creates a helper that performs a delayed React refresh.
557
+ * @returns {function(function(): void): void} A debounced React refresh function.
558
+ */
559
+ function createDebounceUpdate() {
560
+ /**
561
+ * A cached setTimeout handler.
562
+ * @type {number | undefined}
563
+ */
564
+ var refreshTimeout;
565
+
566
+ /**
567
+ * Performs react refresh on a delay and clears the error overlay.
568
+ * @param {function(): void} callback
569
+ * @returns {void}
570
+ */
571
+ function enqueueUpdate(callback) {
572
+ if (typeof refreshTimeout === 'undefined') {
573
+ refreshTimeout = setTimeout(function () {
574
+ refreshTimeout = undefined;
575
+ Refresh.performReactRefresh();
576
+ callback();
577
+ }, 30);
578
+ }
579
+ }
580
+
581
+ return enqueueUpdate;
582
+ }
583
+
584
+ /**
585
+ * Checks if all exports are likely a React component.
586
+ *
587
+ * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/febdba2383113c88296c61e28e4ef6a7f4939fda/packages/metro/src/lib/polyfills/require.js#L748-L774).
588
+ * @param {*} moduleExports A Webpack module exports object.
589
+ * @returns {boolean} Whether the exports are React component like.
590
+ */
591
+ function isReactRefreshBoundary(moduleExports) {
592
+ if (Refresh.isLikelyComponentType(moduleExports)) {
593
+ return true;
594
+ }
595
+ if (
596
+ moduleExports === undefined ||
597
+ moduleExports === null ||
598
+ typeof moduleExports !== 'object'
599
+ ) {
600
+ // Exit if we can't iterate over exports.
601
+ return false;
602
+ }
603
+
604
+ var hasExports = false;
605
+ var areAllExportsComponents = true;
606
+ for (var key in moduleExports) {
607
+ hasExports = true;
608
+
609
+ // This is the ES Module indicator flag
610
+ if (key === '__esModule') {
611
+ continue;
612
+ }
613
+
614
+ // We can (and have to) safely execute getters here,
615
+ // as Webpack manually assigns harmony exports to getters,
616
+ // without any side-effects attached.
617
+ // Ref: https://github.com/webpack/webpack/blob/b93048643fe74de2a6931755911da1212df55897/lib/MainTemplate.js#L281
618
+ var exportValue = moduleExports[key];
619
+ if (!Refresh.isLikelyComponentType(exportValue)) {
620
+ areAllExportsComponents = false;
621
+ }
622
+ }
623
+
624
+ return hasExports && areAllExportsComponents;
625
+ }
626
+
627
+ /**
628
+ * Checks if exports are likely a React component and registers them.
629
+ *
630
+ * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/febdba2383113c88296c61e28e4ef6a7f4939fda/packages/metro/src/lib/polyfills/require.js#L818-L835).
631
+ * @param {*} moduleExports A Webpack module exports object.
632
+ * @param {string} moduleId A Webpack module ID.
633
+ * @returns {void}
634
+ */
635
+ function registerExportsForReactRefresh(moduleExports, moduleId) {
636
+ if (Refresh.isLikelyComponentType(moduleExports)) {
637
+ // Register module.exports if it is likely a component
638
+ Refresh.register(moduleExports, moduleId + ' %exports%');
639
+ }
640
+
641
+ if (
642
+ moduleExports === undefined ||
643
+ moduleExports === null ||
644
+ typeof moduleExports !== 'object'
645
+ ) {
646
+ // Exit if we can't iterate over the exports.
647
+ return;
648
+ }
649
+
650
+ for (var key in moduleExports) {
651
+ // Skip registering the ES Module indicator
652
+ if (key === '__esModule') {
653
+ continue;
654
+ }
655
+
656
+ var exportValue = moduleExports[key];
657
+ if (Refresh.isLikelyComponentType(exportValue)) {
658
+ var typeID = moduleId + ' %exports% ' + key;
659
+ Refresh.register(exportValue, typeID);
660
+ }
661
+ }
662
+ }
663
+
664
+ /**
665
+ * Compares previous and next module objects to check for mutated boundaries.
666
+ *
667
+ * This implementation is based on the one in [Metro](https://github.com/facebook/metro/blob/907d6af22ac6ebe58572be418e9253a90665ecbd/packages/metro/src/lib/polyfills/require.js#L776-L792).
668
+ * @param {*} prevExports The current Webpack module exports object.
669
+ * @param {*} nextExports The next Webpack module exports object.
670
+ * @returns {boolean} Whether the React refresh boundary should be invalidated.
671
+ */
672
+ function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
673
+ var prevSignature = getReactRefreshBoundarySignature(prevExports);
674
+ var nextSignature = getReactRefreshBoundarySignature(nextExports);
675
+
676
+ if (prevSignature.length !== nextSignature.length) {
677
+ return true;
678
+ }
679
+
680
+ for (var i = 0; i < nextSignature.length; i += 1) {
681
+ if (prevSignature[i] !== nextSignature[i]) {
682
+ return true;
683
+ }
684
+ }
685
+
686
+ return false;
687
+ }
688
+
689
+ var enqueueUpdate = createDebounceUpdate();
690
+
691
+ function executeRuntime(
692
+ moduleExports,
693
+ moduleId,
694
+ webpackHot,
695
+ refreshOverlay,
696
+ isTest,
697
+ ) {
698
+ registerExportsForReactRefresh(moduleExports, moduleId);
699
+
700
+ if (webpackHot) {
701
+ var isHotUpdate = !!webpackHot.data;
702
+ var prevExports;
703
+ if (isHotUpdate) {
704
+ prevExports = webpackHot.data.prevExports;
705
+ }
706
+
707
+ if (isReactRefreshBoundary(moduleExports)) {
708
+ webpackHot.dispose(
709
+ /**
710
+ * A callback to performs a full refresh if React has unrecoverable errors,
711
+ * and also caches the to-be-disposed module.
712
+ * @param {*} data A hot module data object from Webpack HMR.
713
+ * @returns {void}
714
+ */
715
+ function hotDisposeCallback(data) {
716
+ // We have to mutate the data object to get data registered and cached
717
+ data.prevExports = moduleExports;
718
+ },
719
+ );
720
+ webpackHot.accept(
721
+ /**
722
+ * An error handler to allow self-recovering behaviours.
723
+ * @param {Error} error An error occurred during evaluation of a module.
724
+ * @returns {void}
725
+ */
726
+ function hotErrorHandler(error) {
727
+ console.error(error);
728
+ if (
729
+ __reload_on_runtime_errors__ &&
730
+ isUnrecoverableRuntimeError(error)
731
+ ) {
732
+ location.reload();
733
+ return;
734
+ }
735
+
736
+ if (typeof refreshOverlay !== 'undefined' && refreshOverlay) {
737
+ refreshOverlay.handleRuntimeError(error);
738
+ }
739
+
740
+ if (typeof isTest !== 'undefined' && isTest) {
741
+ if (window.onHotAcceptError) {
742
+ window.onHotAcceptError(error.message);
743
+ }
744
+ }
745
+
746
+ __webpack_require__.c[moduleId].hot.accept(hotErrorHandler);
747
+ },
748
+ );
749
+
750
+ if (isHotUpdate) {
751
+ if (
752
+ isReactRefreshBoundary(prevExports) &&
753
+ shouldInvalidateReactRefreshBoundary(prevExports, moduleExports)
754
+ ) {
755
+ webpackHot.invalidate();
756
+ } else {
757
+ enqueueUpdate(
758
+ /**
759
+ * A function to dismiss the error overlay after performing React refresh.
760
+ * @returns {void}
761
+ */
762
+ function updateCallback() {
763
+ if (typeof refreshOverlay !== 'undefined' && refreshOverlay) {
764
+ refreshOverlay.clearRuntimeErrors();
765
+ }
766
+ },
767
+ );
768
+ }
769
+ }
770
+ } else {
771
+ if (isHotUpdate && typeof prevExports !== 'undefined') {
772
+ webpackHot.invalidate();
773
+ }
774
+ }
775
+ }
776
+ }
777
+
778
+ function isUnrecoverableRuntimeError(error) {
779
+ return error.message.startsWith('RuntimeError: factory is undefined');
780
+ }
781
+
782
+ module.exports = Object.freeze({
783
+ enqueueUpdate: enqueueUpdate,
784
+ executeRuntime: executeRuntime,
785
+ getModuleExports: getModuleExports,
786
+ isReactRefreshBoundary: isReactRefreshBoundary,
787
+ shouldInvalidateReactRefreshBoundary: shouldInvalidateReactRefreshBoundary,
788
+ registerExportsForReactRefresh: registerExportsForReactRefresh,
789
+ });
790
+ ` } === "undefined") {
791
+ throw new Error("Browser bundler React Refresh files were not injected.");
792
+ }
429
793
  return {
430
794
  [entry]: { entry: `var RefreshRuntime = require('react-refresh/runtime');
431
795
  var safeThis = (function () {
@@ -1591,14 +1955,14 @@ module.exports = Object.freeze({
1591
1955
  };
1592
1956
  };
1593
1957
  export {
1594
- normalizeVirtualPath,
1595
- makeBrowserHttpClient,
1596
- getVirtualProjectFiles,
1597
- getVirtualProjectChanges,
1598
- getBrowserReactRefreshVirtualFiles,
1599
- createBrowserReactRefreshPlugin,
1600
- createBrowserHmrRuntimePlugin,
1601
- createBrowserHmrAssetManager,
1958
+ createBrowserCompiler,
1602
1959
  createBrowserDependencyPlugin,
1603
- createBrowserCompiler
1960
+ createBrowserHmrAssetManager,
1961
+ createBrowserHmrRuntimePlugin,
1962
+ createBrowserReactRefreshPlugin,
1963
+ getBrowserReactRefreshVirtualFiles,
1964
+ getVirtualProjectChanges,
1965
+ getVirtualProjectFiles,
1966
+ makeBrowserHttpClient,
1967
+ normalizeVirtualPath
1604
1968
  };
package/dist/index.js CHANGED
@@ -1,27 +1,3 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __toESM = (mod, isNodeMode, target) => {
7
- target = mod != null ? __create(__getProtoOf(mod)) : {};
8
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
- for (let key of __getOwnPropNames(mod))
10
- if (!__hasOwnProp.call(to, key))
11
- __defProp(to, key, {
12
- get: () => mod[key],
13
- enumerable: true
14
- });
15
- return to;
16
- };
17
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
- }) : x)(function(x) {
20
- if (typeof require !== "undefined")
21
- return require.apply(this, arguments);
22
- throw Error('Dynamic require of "' + x + '" is not supported');
23
- });
24
-
25
1
  // src/errors.ts
26
2
  class BrowserBundlerError extends Error {
27
3
  diagnostics;
@@ -110,6 +86,6 @@ var createBrowserBundler = (options = {}) => {
110
86
  };
111
87
  };
112
88
  export {
113
- createBrowserBundler,
114
- BrowserBundlerError
89
+ BrowserBundlerError,
90
+ createBrowserBundler
115
91
  };