Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/react-dom-shim

Package Overview
Dependencies
Maintainers
11
Versions
750
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/react-dom-shim - npm Package Compare versions

Comparing version 0.0.0-pr-28800-sha-2528064a to 0.0.0-pr-28882-sha-2e6a0c80

dist/chunk-QGXSKZ4X.mjs

2

dist/preset.js

@@ -1,1 +0,1 @@

"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{viteFinal:()=>viteFinal,webpackFinal:()=>webpackFinal});module.exports=__toCommonJS(preset_exports);var import_path=require("path"),import_promises=require("fs/promises"),getIsReactVersion18or19=async options=>{let{legacyRootApi}=await options.presets.apply("frameworkOptions")||{};if(legacyRootApi)return!1;let reactDom=(await options.presets.apply("resolvedReact",{})).reactDom||(0,import_path.dirname)(require.resolve("react-dom/package.json"));if(!(0,import_path.isAbsolute)(reactDom))return!1;let{version}=JSON.parse(await(0,import_promises.readFile)((0,import_path.join)(reactDom,"package.json"),"utf-8"));return version.startsWith("18")||version.startsWith("19")||version.startsWith("0.0.0")},webpackFinal=async(config,options)=>await getIsReactVersion18or19(options)?config:{...config,resolve:{...config.resolve,alias:{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-16"}}},viteFinal=async(config,options)=>{if(await getIsReactVersion18or19(options))return config;let alias=Array.isArray(config.resolve?.alias)?config.resolve.alias.concat({find:/^@storybook\/react-dom-shim$/,replacement:"@storybook/react-dom-shim/dist/react-16"}):{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-16"};return{...config,resolve:{...config.resolve,alias}}};0&&(module.exports={viteFinal,webpackFinal});
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{viteFinal:()=>viteFinal,webpackFinal:()=>webpackFinal});module.exports=__toCommonJS(preset_exports);var import_promises=require("fs/promises"),import_node_path=require("path"),getIsReactVersion18or19=async options=>{let{legacyRootApi}=await options.presets.apply("frameworkOptions")||{};if(legacyRootApi)return!1;let reactDom=(await options.presets.apply("resolvedReact",{})).reactDom||(0,import_node_path.dirname)(require.resolve("react-dom/package.json"));if(!(0,import_node_path.isAbsolute)(reactDom))return!1;let{version}=JSON.parse(await(0,import_promises.readFile)((0,import_node_path.join)(reactDom,"package.json"),"utf-8"));return version.startsWith("18")||version.startsWith("19")||version.startsWith("0.0.0")},webpackFinal=async(config,options)=>await getIsReactVersion18or19(options)?config:{...config,resolve:{...config.resolve,alias:{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-16"}}},viteFinal=async(config,options)=>{if(await getIsReactVersion18or19(options))return config;let alias=Array.isArray(config.resolve?.alias)?config.resolve.alias.concat({find:/^@storybook\/react-dom-shim$/,replacement:"@storybook/react-dom-shim/dist/react-16"}):{...config.resolve?.alias,"@storybook/react-dom-shim":"@storybook/react-dom-shim/dist/react-16"};return{...config,resolve:{...config.resolve,alias}}};0&&(module.exports={viteFinal,webpackFinal});

@@ -1,1 +0,1 @@

"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var react_16_exports={};__export(react_16_exports,{renderElement:()=>renderElement,unmountElement:()=>unmountElement});module.exports=__toCommonJS(react_16_exports);var ReactDOM=__toESM(require("react-dom")),renderElement=async(node,el)=>new Promise(resolve=>{ReactDOM.render(node,el,()=>resolve(null))}),unmountElement=el=>{ReactDOM.unmountComponentAtNode(el)};0&&(module.exports={renderElement,unmountElement});
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var react_16_exports={};__export(react_16_exports,{renderElement:()=>renderElement,unmountElement:()=>unmountElement});module.exports=__toCommonJS(react_16_exports);var ReactDOM=__toESM(require("react-dom"));function preventActChecks(callback){let originalActEnvironment=globalThis.IS_REACT_ACT_ENVIRONMENT;globalThis.IS_REACT_ACT_ENVIRONMENT=!1;try{callback()}finally{globalThis.IS_REACT_ACT_ENVIRONMENT=originalActEnvironment}}var renderElement=async(node,el)=>new Promise(resolve=>{preventActChecks(()=>void ReactDOM.render(node,el,()=>resolve(null)))}),unmountElement=el=>{preventActChecks(()=>void ReactDOM.unmountComponentAtNode(el))};0&&(module.exports={renderElement,unmountElement});
import { ReactElement } from 'react';
import { RootOptions } from 'react-dom/client';
declare const renderElement: (node: ReactElement, el: Element, rootOptions?: RootOptions) => Promise<unknown>;
declare const renderElement: (node: ReactElement, el: Element, rootOptions?: RootOptions) => Promise<void>;
declare const unmountElement: (el: Element, shouldUseNewRootApi?: boolean) => void;
export { renderElement, unmountElement };

@@ -1,1 +0,1 @@

"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var react_18_exports={};__export(react_18_exports,{renderElement:()=>renderElement,unmountElement:()=>unmountElement});module.exports=__toCommonJS(react_18_exports);var React=__toESM(require("react")),ReactDOM=__toESM(require("react-dom/client")),nodes=new Map,WithCallback=({callback,children})=>{let once=React.useRef();return React.useLayoutEffect(()=>{once.current!==callback&&(once.current=callback,callback())},[callback]),children},renderElement=async(node,el,rootOptions)=>{let root=await getReactRoot(el,rootOptions);return new Promise(resolve=>{root.render(React.createElement(WithCallback,{callback:()=>resolve(null)},node))})},unmountElement=(el,shouldUseNewRootApi)=>{let root=nodes.get(el);root&&(root.unmount(),nodes.delete(el))},getReactRoot=async(el,rootOptions)=>{let root=nodes.get(el);return root||(root=ReactDOM.createRoot(el,rootOptions),nodes.set(el,root)),root};0&&(module.exports={renderElement,unmountElement});
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var react_18_exports={};__export(react_18_exports,{renderElement:()=>renderElement,unmountElement:()=>unmountElement});module.exports=__toCommonJS(react_18_exports);var React=__toESM(require("react")),ReactDOM=__toESM(require("react-dom/client"));function preventActChecks(callback){let originalActEnvironment=globalThis.IS_REACT_ACT_ENVIRONMENT;globalThis.IS_REACT_ACT_ENVIRONMENT=!1;try{callback()}finally{globalThis.IS_REACT_ACT_ENVIRONMENT=originalActEnvironment}}var nodes=new Map,WithCallback=({callback,children})=>{let once=React.useRef();return React.useLayoutEffect(()=>{once.current!==callback&&(once.current=callback,callback())},[callback]),children};typeof Promise.withResolvers>"u"&&(Promise.withResolvers=()=>{let resolve=null,reject=null;return{promise:new Promise((res,rej)=>{resolve=res,reject=rej}),resolve,reject}});var renderElement=async(node,el,rootOptions)=>{let root=await getReactRoot(el,rootOptions),{promise,resolve}=Promise.withResolvers();return preventActChecks(()=>root.render(React.createElement(WithCallback,{callback:resolve},node))),promise},unmountElement=(el,shouldUseNewRootApi)=>{let root=nodes.get(el);root&&(preventActChecks(()=>root.unmount()),nodes.delete(el))},getReactRoot=async(el,rootOptions)=>{let root=nodes.get(el);return root||(root=ReactDOM.createRoot(el,rootOptions),nodes.set(el,root)),root};0&&(module.exports={renderElement,unmountElement});
{
"name": "@storybook/react-dom-shim",
"version": "0.0.0-pr-28800-sha-2528064a",
"version": "0.0.0-pr-28882-sha-2e6a0c80",
"description": "",

@@ -26,11 +26,11 @@ "keywords": [

"types": "./dist/react-18.d.ts",
"node": "./dist/react-18.js",
"import": "./dist/react-18.mjs",
"require": "./dist/react-18.js"
"require": "./dist/react-18.js",
"node": "./dist/react-18.js"
},
"./dist/react-16": {
"types": "./dist/react-16.d.ts",
"node": "./dist/react-16.js",
"import": "./dist/react-16.mjs",
"require": "./dist/react-16.js"
"require": "./dist/react-16.js",
"node": "./dist/react-16.js"
},

@@ -54,4 +54,4 @@ "./dist/preset": {

"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
"check": "jiti ../../../scripts/prepare/check.ts",
"prep": "jiti ../../../scripts/prepare/bundle.ts"
},

@@ -64,3 +64,3 @@ "devDependencies": {

"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"storybook": "^0.0.0-pr-28800-sha-2528064a"
"storybook": "^0.0.0-pr-28882-sha-2e6a0c80"
},

@@ -67,0 +67,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc