Skip to content

Commit

Permalink
Let package export maps take priority over normal resolution (#1781)
Browse files Browse the repository at this point in the history
* Let package export maps take priority over normal resolution

* Update test snaps

* Re-update snaps

* await init
  • Loading branch information
drwpow authored Dec 2, 2020
1 parent 6938d31 commit 1b4ace7
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 47 deletions.
27 changes: 14 additions & 13 deletions esinstall/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,6 @@ function resolveWebDependency(
dep: string,
{cwd, packageLookupFields}: {cwd: string; packageLookupFields: string[]},
): DependencyLoc {
// if dep points directly to a file within a package, return that reference.
// No other lookup required.
if (path.extname(dep) && !validatePackageName(dep).validForNewPackages) {
// For details on why we need to call fs.realpathSync.native here and other places, see
// https://github.com/snowpackjs/snowpack/pull/999.
const loc = fs.realpathSync.native(require.resolve(dep, {paths: [cwd]}));
return {
type: isJavaScript(loc) ? 'JS' : 'ASSET',
loc,
};
}
// If dep is a path within a package (but without an extension), we first need
// to check for an export map in the package.json. If one exists, resolve to it.
const [packageName, packageEntrypoint] = parsePackageImportSpecifier(dep);
Expand All @@ -123,13 +112,25 @@ function resolveWebDependency(
`Package "${packageName}" exists but package.json "exports" does not include entry for "./${packageEntrypoint}".`,
);
}
const loc = path.join(packageManifestLoc, '..', exportMapValue);
return {
type: 'JS',
loc: path.join(packageManifestLoc, '..', exportMapValue),
type: isJavaScript(loc) ? 'JS' : 'ASSET',
loc,
};
}
}

// if, no export map and dep points directly to a file within a package, return that reference.
if (path.extname(dep) && !validatePackageName(dep).validForNewPackages) {
// For details on why we need to call fs.realpathSync.native here and other places, see
// https://github.com/snowpackjs/snowpack/pull/999.
const loc = fs.realpathSync.native(require.resolve(dep, {paths: [cwd]}));
return {
type: isJavaScript(loc) ? 'JS' : 'ASSET',
loc,
};
}

// Otherwise, resolve directly to the dep specifier. Note that this supports both
// "package-name" & "package-name/some/path" where "package-name/some/path/package.json"
// exists at that lower path, that must be used to resolve. In that case, export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PROCESS_MODULE_NAME = 'process';
export function rollupPluginNodeProcessPolyfill(env = {}): Plugin {
const injectPlugin = inject({
process: PROCESS_MODULE_NAME,
include: ['*.js', '*.mjs', '*.cjs'],
include: /\.(cjs|js|jsx|mjs|ts|tsx)$/, // only target JavaScript files
});

return {
Expand Down
12 changes: 0 additions & 12 deletions examples/react-global-imports/src/App.test.jsx

This file was deleted.

12 changes: 0 additions & 12 deletions examples/react-loadable-components/src/App.test.jsx

This file was deleted.

1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
modulePathIgnorePatterns: [
'<rootDir>/create-snowpack-app/app-template-', // don’t run tests intended as user examples
'<rootDir>/examples', // don’t run any tests in examples
'<rootDir>/test/create-snowpack-app/test-install', // don’t run tests inside our mock create-snowpack-app install
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
Expand Down
1 change: 1 addition & 0 deletions snowpack/src/scan-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export async function scanImportsFromFiles(
loadedFiles: SnowpackSourceFile[],
config: SnowpackConfig,
): Promise<InstallTarget[]> {
await initESModuleLexer;
return loadedFiles
.filter((sourceFile) => !Buffer.isBuffer(sourceFile.contents)) // filter out binary files from import scanning
.map((sourceFile) => parseFileForInstallTargets(sourceFile as SnowpackSourceFile<string>))
Expand Down
19 changes: 16 additions & 3 deletions test/esinstall/export-maps/__snapshots__
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@

exports[`snowpack install export-maps: allFiles 1`] = `
Array [
"@clevercloud/components/assets/backup.svg",
"import-map.json",
"preact.js",
"preact/hooks.js",
]
`;

exports[`snowpack install export-maps: cli output 1`] = `
"[snowpack] ! installing dependencies...
[snowpack] ✔ install complete!
[snowpack]
⦿ web_modules/ size gzip brotli
└─ preact.js XXXX KB XXXX KB XXXX KB"
⦿ web_modules/ size gzip brotli
├─ preact.js XXXX KB XXXX KB XXXX KB
└─ preact/hooks.js XXXX KB XXXX KB XXXX KB"
`;

exports[`snowpack install export-maps: web_modules/@clevercloud/components/assets/backup.svg 1`] = `"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"no\\"?><svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"100\\" height=\\"100\\" fill-rule=\\"evenodd\\" clip-rule=\\"evenodd\\" viewBox=\\"0 0 333 333\\"><g transform=\\"translate(14.497207,92.999354)\\"><circle r=\\"109.89\\" style=\\"opacity:1;fill:#f19175;fill-opacity:1;stroke:none;stroke-width:23.30895042;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal\\" cx=\\"170.819\\" cy=\\"73.499\\"/><path d=\\"M170.819-69.69A143.19 143.19 0 0027.902 65.795h-37.905l54.282 83.64 54.281-83.64H61.312A109.89 109.89 0 01170.82-36.39 109.89 109.89 0 01280.709 73.5a109.89 109.89 0 01-109.89 109.89 109.89 109.89 0 01-66.848-22.842L84.434 187.54a143.19 143.19 0 0086.385 29.15A143.19 143.19 0 00314.009 73.5a143.19 143.19 0 00-143.19-143.19z\\" style=\\"opacity:1;fill:#000;fill-opacity:1;stroke:none;stroke-width:6.99968481;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal\\"/><path d=\\"M153.674-3.818v87.211l58.32 33.677 17.145-29.697-41.176-23.771v-67.42z\\" style=\\"opacity:1;fill:#000;fill-opacity:1;stroke:none;stroke-width:23.30895042;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal\\"/></g></svg>"`;

exports[`snowpack install export-maps: web_modules/import-map.json 1`] = `
"{
\\"imports\\": {
\\"preact\\": \\"./preact.js\\"
\\"@clevercloud/components/assets/backup.svg\\": \\"./@clevercloud/components/assets/backup.svg\\",
\\"preact\\": \\"./preact.js\\",
\\"preact/hooks\\": \\"./preact/hooks.js\\"
}
}"
`;
Expand All @@ -27,3 +34,9 @@ exports[`snowpack install export-maps: web_modules/preact.js 1`] = `
"var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n);}function v(n,l,u){var i,t,o,r=arguments,f={};for(o in l)\\"key\\"==o?i=l[o]:\\"ref\\"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);if(null!=u&&(f.children=u),\\"function\\"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===f[o]&&(f[o]=n.defaultProps[o]);return h(n,f,i,t,null)}function h(l,u,i,t,o){var r={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++n.__v:o};return null!=n.vnode&&n.vnode(r),r}function y(){return {current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l;}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return \\"function\\"==typeof n.type?_(n):null}function w(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return w(n)}}function k(l){(!l.__d&&(l.__d=!0)&&u.push(l)&&!g.__r++||t!==n.debounceRendering)&&((t=n.debounceRendering)||i)(g);}function g(){for(var n;g.__r=u.length;)n=u.sort(function(n,l){return n.__v.__b-l.__v.__b}),u=[],n.some(function(n){var l,u,i,t,o,r,f;n.__d&&(r=(o=(l=n).__v).__e,(f=l.__P)&&(u=[],(i=s({},o)).__v=o.__v+1,t=$(f,o,i,l.__n,void 0!==f.ownerSVGElement,null!=o.__h?[r]:null,u,null==r?_(o):r,o.__h),j(u,o),t!=r&&w(o)));});}function m(n,l,u,i,t,o,r,c,s,v){var y,d,w,k,g,m,b,A=i&&i.__k||e,P=A.length;for(s==f&&(s=null!=r?r[0]:P?_(i,0):null),u.__k=[],y=0;y<l.length;y++)if(null!=(k=u.__k[y]=null==(k=l[y])||\\"boolean\\"==typeof k?null:\\"string\\"==typeof k||\\"number\\"==typeof k?h(null,k,null,null,k):Array.isArray(k)?h(p,{children:k},null,null,null):null!=k.__e||null!=k.__c?h(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(w=A[y])||w&&k.key==w.key&&k.type===w.type)A[y]=void 0;else for(d=0;d<P;d++){if((w=A[d])&&k.key==w.key&&k.type===w.type){A[d]=void 0;break}w=null;}g=$(n,k,w=w||f,t,o,r,c,s,v),(d=k.ref)&&w.ref!=d&&(b||(b=[]),w.ref&&b.push(w.ref,null,k),b.push(d,k.__c||g,k)),null!=g?(null==m&&(m=g),s=x(n,k,w,A,r,g,s),v||\\"option\\"!=u.type?\\"function\\"==typeof u.type&&(u.__d=s):n.value=\\"\\"):s&&w.__e==s&&s.parentNode!=n&&(s=_(w));}if(u.__e=m,null!=r&&\\"function\\"!=typeof u.type)for(y=r.length;y--;)null!=r[y]&&a(r[y]);for(y=P;y--;)null!=A[y]&&L(A[y],A[y]);if(b)for(y=0;y<b.length;y++)I(b[y],b[++y],b[++y]);}function b(n,l){return l=l||[],null==n||\\"boolean\\"==typeof n||(Array.isArray(n)?n.some(function(n){b(n,l);}):l.push(n)),l}function x(n,l,u,i,t,o,r){var f,e,c;if(void 0!==l.__d)f=l.__d,l.__d=void 0;else if(t==u||o!=r||null==o.parentNode)n:if(null==r||r.parentNode!==n)n.appendChild(o),f=null;else {for(e=r,c=0;(e=e.nextSibling)&&c<i.length;c+=2)if(e==o)break n;n.insertBefore(o,r),f=r;}return void 0!==f?f:o.nextSibling}function A(n,l,u,i,t){var o;for(o in u)\\"children\\"===o||\\"key\\"===o||o in l||C(n,o,null,u[o],i);for(o in l)t&&\\"function\\"!=typeof l[o]||\\"children\\"===o||\\"key\\"===o||\\"value\\"===o||\\"checked\\"===o||u[o]===l[o]||C(n,o,l[o],u[o],i);}function P(n,l,u){\\"-\\"===l[0]?n.setProperty(l,u):n[l]=null==u?\\"\\":\\"number\\"!=typeof u||c.test(l)?u:u+\\"px\\";}function C(n,l,u,i,t){var o,r,f;if(t&&\\"className\\"==l&&(l=\\"class\\"),\\"style\\"===l)if(\\"string\\"==typeof u)n.style.cssText=u;else {if(\\"string\\"==typeof i&&(n.style.cssText=i=\\"\\"),i)for(l in i)u&&l in u||P(n.style,l,\\"\\");if(u)for(l in u)i&&u[l]===i[l]||P(n.style,l,u[l]);}else \\"o\\"===l[0]&&\\"n\\"===l[1]?(o=l!==(l=l.replace(/Capture$/,\\"\\")),(r=l.toLowerCase())in n&&(l=r),l=l.slice(2),n.l||(n.l={}),n.l[l+o]=u,f=o?N:z,u?i||n.addEventListener(l,f,o):n.removeEventListener(l,f,o)):\\"list\\"!==l&&\\"tagName\\"!==l&&\\"form\\"!==l&&\\"type\\"!==l&&\\"size\\"!==l&&\\"download\\"!==l&&\\"href\\"!==l&&!t&&l in n?n[l]=null==u?\\"\\":u:\\"function\\"!=typeof u&&\\"dangerouslySetInnerHTML\\"!==l&&(l!==(l=l.replace(/xlink:?/,\\"\\"))?null==u||!1===u?n.removeAttributeNS(\\"http://www.w3.org/1999/xlink\\",l.toLowerCase()):n.setAttributeNS(\\"http://www.w3.org/1999/xlink\\",l.toLowerCase(),u):null==u||!1===u&&!/^ar/.test(l)?n.removeAttribute(l):n.setAttribute(l,u));}function z(l){this.l[l.type+!1](n.event?n.event(l):l);}function N(l){this.l[l.type+!0](n.event?n.event(l):l);}function T(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,t.__e&&(\\"function\\"==typeof t.type&&t.__k.length>1&&T(t,l,u),l=x(u,t,t,n.__k,null,t.__e,l),\\"function\\"==typeof n.type&&(n.__d=l)));}function $(l,u,i,t,o,r,f,e,c){var a,v,h,y,_,w,k,g,b,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=n.__b)&&a(u);try{n:if(\\"function\\"==typeof P){if(g=u.props,b=(a=P.contextType)&&t[a.__c],x=a?b?b.props.value:a.__:t,i.__c?k=(v=u.__c=i.__c).__=v.__E:(\\"prototype\\"in P&&P.prototype.render?u.__c=v=new P(g,x):(u.__c=v=new d(g,x),v.constructor=P,v.render=M),b&&b.sub(v),v.props=g,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=s({},v.__s)),s(v.__s,P.getDerivedStateFromProps(g,v.__s))),y=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&g!==y&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(g,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(g,v.__s,x)||u.__v===i.__v){v.props=g,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,v.__h.length&&f.push(v),T(u,e,l);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(g,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(y,_,w);});}v.context=x,v.props=g,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=s(s({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(w=v.getSnapshotBeforeUpdate(y,_)),A=null!=a&&a.type==p&&null==a.key?a.props.children:a,m(l,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,c),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),k&&(v.__E=v.__=null),v.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=H(i.__e,u,i,t,o,r,f,c);(a=n.diffed)&&a(u);}catch(l){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),n.__e(l,u,i);}return u.__e}function j(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u);});}catch(l){n.__e(l,u.__v);}});}function H(n,l,u,i,t,o,r,c){var s,a,v,h,y,p=u.props,d=l.props;if(t=\\"svg\\"===l.type||t,null!=o)for(s=0;s<o.length;s++)if(null!=(a=o[s])&&((null===l.type?3===a.nodeType:a.localName===l.type)||n==a)){n=a,o[s]=null;break}if(null==n){if(null===l.type)return document.createTextNode(d);n=t?document.createElementNS(\\"http://www.w3.org/2000/svg\\",l.type):document.createElement(l.type,d.is&&{is:d.is}),o=null,c=!1;}if(null===l.type)p===d||c&&n.data===d||(n.data=d);else {if(null!=o&&(o=e.slice.call(n.childNodes)),v=(p=u.props||f).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&(v&&h.__html==v.__html||h.__html===n.innerHTML)||(n.innerHTML=h&&h.__html||\\"\\"));}A(n,d,p,t,c),h?l.__k=[]:(s=l.props.children,m(n,Array.isArray(s)?s:[s],l,u,i,\\"foreignObject\\"!==l.type&&t,o,r,f,c)),c||(\\"value\\"in d&&void 0!==(s=d.value)&&(s!==n.value||\\"progress\\"===l.type&&!s)&&C(n,\\"value\\",s,p.value,!1),\\"checked\\"in d&&void 0!==(s=d.checked)&&s!==n.checked&&C(n,\\"checked\\",s,p.checked,!1));}return n}function I(l,u,i){try{\\"function\\"==typeof l?l(u):l.current=u;}catch(l){n.__e(l,i);}}function L(l,u,i){var t,o,r;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||I(t,null,u)),i||\\"function\\"==typeof l.type||(i=null!=(o=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(l){n.__e(l,u);}t.base=t.__P=null;}if(t=l.__k)for(r=0;r<t.length;r++)t[r]&&L(t[r],u,i);null!=o&&a(o);}function M(n,l,u){return this.constructor(n,u)}function O(l,u,i){var t,r,c;n.__&&n.__(l,u),r=(t=i===o)?null:i&&i.__k||u.__k,l=v(p,null,[l]),c=[],$(u,(t?u:i||u).__k=l,r||f,f,void 0!==u.ownerSVGElement,i&&!t?[i]:r?null:u.childNodes.length?e.slice.call(u.childNodes):null,c,i||f,t),j(c,l);}function S(n,l){O(n,l,o);}function q(n,l,u){var i,t,o,r=arguments,f=s({},n.props);for(o in l)\\"key\\"==o?i=l[o]:\\"ref\\"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);return null!=u&&(f.children=u),h(n.type,f,i||n.key,t||n.ref,null)}function B(n,l){var u={__c:l=\\"__cC\\"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n,u,i){return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(k);},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n={__e:function(n,l){for(var u,i,t,o=l.__h;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return l.__h=o,u.__E=u}catch(l){n=l;}throw n},__v:0},l=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),\\"function\\"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),k(this));},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k(this));},d.prototype.render=p,u=[],i=\\"function\\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,o=f,r=0;
export { d as Component, p as Fragment, L as __u, q as cloneElement, B as createContext, v as createElement, y as createRef, v as h, S as hydrate, l as isValidElement, n as options, O as render, b as toChildArray };"
`;

exports[`snowpack install export-maps: web_modules/preact/hooks.js 1`] = `
"import { options as n } from '../preact.js';
var t,u,r,o=0,i=[],c=n.__b,f=n.__r,e=n.diffed,a=n.__c,v=n.unmount;function m(t,r){n.__h&&n.__h(u,t,o||r),o=0;var i=u.__H||(u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function l(n){return o=1,p(w,n)}function p(n,r,o){var i=m(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function y(r,o){var i=m(t++,3);!n.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__H.__h.push(i));}function h(r,o){var i=m(t++,4);!n.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__h.push(i));}function s(n){return o=5,d(function(){return {current:n}},[])}function _(n,t,u){o=6,h(function(){\\"function\\"==typeof n?n(t()):n&&(n.current=t());},null==u?u:u.concat(n));}function d(n,u){var r=m(t++,7);return k(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function A(n,t){return o=8,d(function(){return n},t)}function F(n){var r=u.context[n.__c],o=m(t++,9);return o.__c=n,r?(null==o.__&&(o.__=!0,r.sub(u)),r.props.value):n.__}function T(t,u){n.useDebugValue&&n.useDebugValue(u?u(t):t);}function q(n){var r=m(t++,10),o=l();return r.__=n,u.componentDidCatch||(u.componentDidCatch=function(n){r.__&&r.__(n),o[1](n);}),[o[0],function(){o[1](void 0);}]}function x(){i.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(g),t.__H.__h.forEach(j),t.__H.__h=[];}catch(u){t.__H.__h=[],n.__e(u,t.__v);}}),i=[];}n.__b=function(n){u=null,c&&c(n);},n.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g),r.__h.forEach(j),r.__h=[]);},n.diffed=function(t){e&&e(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i.push(o)&&r===n.requestAnimationFrame||((r=n.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x)),u=void 0;},n.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g),t.__h=t.__h.filter(function(n){return !n.__||j(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],n.__e(r,t.__v);}}),a&&a(t,u);},n.unmount=function(t){v&&v(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(g);}catch(t){n.__e(t,u.__v);}};var b=\\"function\\"==typeof requestAnimationFrame;function g(n){var t=u;\\"function\\"==typeof n.__c&&n.__c(),u=t;}function j(n){var t=u;n.__c=n.__(),u=t;}function k(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w(n,t){return \\"function\\"==typeof t?t(n):t}
export { A as useCallback, F as useContext, T as useDebugValue, y as useEffect, q as useErrorBoundary, _ as useImperativeHandle, h as useLayoutEffect, d as useMemo, p as useReducer, s as useRef, l as useState };"
`;
7 changes: 5 additions & 2 deletions test/esinstall/export-maps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
},
"snowpack": {
"install": [
"preact"
"preact",
"preact/hooks",
"@clevercloud/components/assets/backup.svg"
],
"buildOptions": {
"minify": false
}
},
"dependencies": {
"preact": "^10.4.6"
"preact": "^10.4.6",
"@clevercloud/components": "4.1.0-beta.5"
},
"devDependencies": {
"snowpack": "^2.14.3"
Expand Down
Loading

1 comment on commit 1b4ace7

@vercel
Copy link

@vercel vercel bot commented on 1b4ace7 Dec 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.