piral-update 0.15.0-alpha.3555 → 0.15.0-alpha.3640

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.
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
1
+ import type { ComponentType } from 'react';
2
2
  import { UpdateDialogProps } from './types';
3
- export declare const PiralUpdateDialog: React.ComponentType<UpdateDialogProps>;
3
+ export declare const PiralUpdateDialog: ComponentType<UpdateDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAA2C,iBAAiB,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAAqC,iBAAiB,CAAC,cAAc,CAAC,CAAC"}
package/esm/default.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
1
+ import { FC } from 'react';
2
2
  import { UpdateDialogProps } from './types';
3
- export declare const DefaultUpdateDialog: React.FC<UpdateDialogProps>;
3
+ export declare const DefaultUpdateDialog: FC<UpdateDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,CAAC,MAAM,mBAAmB,GAAgC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,CAAC,MAAM,mBAAmB,GAA0B,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
1
+ import type { ComponentType } from 'react';
2
2
  import { UpdateDialogProps } from './types';
3
- export declare const PiralUpdateDialog: React.ComponentType<UpdateDialogProps>;
3
+ export declare const PiralUpdateDialog: ComponentType<UpdateDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,iBAAiB,GAA2C,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,iBAAiB,GAAqC,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC"}
package/lib/default.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
1
+ import { FC } from 'react';
2
2
  import { UpdateDialogProps } from './types';
3
- export declare const DefaultUpdateDialog: React.FC<UpdateDialogProps>;
3
+ export declare const DefaultUpdateDialog: FC<UpdateDialogProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":";;;AACA,2CAA2C;AAGpC,MAAM,mBAAmB,GAAgC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAA5F,QAAA,mBAAmB,uBAAyE"}
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":";;;AACA,2CAA2C;AAGpC,MAAM,mBAAmB,GAA0B,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAAtF,QAAA,mBAAmB,uBAAmE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-update",
3
- "version": "0.15.0-alpha.3555",
3
+ "version": "0.15.0-alpha.3640",
4
4
  "description": "Plugin for auto-updating pilets in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -25,7 +25,8 @@
25
25
  "files": [
26
26
  "esm",
27
27
  "lib",
28
- "src"
28
+ "src",
29
+ "piral-update.min.js"
29
30
  ],
30
31
  "repository": {
31
32
  "type": "git",
@@ -35,17 +36,21 @@
35
36
  "url": "https://github.com/smapiot/piral/issues"
36
37
  },
37
38
  "scripts": {
38
- "build": "yarn build:commonjs && yarn build:esnext",
39
+ "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
40
+ "build:bundle": "esbuild src/index.ts --outfile=piral-update.min.js --bundle --external:piral-core --external:react --minify --global-name=piralUpdate",
39
41
  "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
40
42
  "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
41
43
  "typedoc": "typedoc --json ../../../docs/types/piral-update.json src --exclude \"src/**/*.test.*\"",
42
44
  "test": "echo \"Error: run tests from root\" && exit 1"
43
45
  },
44
46
  "devDependencies": {
45
- "piral-core": "0.15.0-alpha.3555"
47
+ "@types/react": "^17.0.0",
48
+ "piral-core": "0.15.0-alpha.3640",
49
+ "react": "^17.0.1"
46
50
  },
47
51
  "peerDependencies": {
48
- "piral-core": "0.14.x"
52
+ "piral-core": "0.14.x",
53
+ "react": ">=16.8.0"
49
54
  },
50
- "gitHead": "0727a5c782dd1bbc7ccaa11a036a9f16e616bf10"
55
+ "gitHead": "29ee91f865f9ee42229e58a7804cba6ab5e9145b"
51
56
  }
@@ -0,0 +1 @@
1
+ var piralUpdate=(()=>{var M=Object.create;var c=Object.defineProperty,H=Object.defineProperties,w=Object.getOwnPropertyDescriptor,A=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols,j=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var v=(t,e,a)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,n=(t,e)=>{for(var a in e||(e={}))U.call(e,a)&&v(t,a,e[a]);if(k)for(var a of k(e))R.call(e,a)&&v(t,a,e[a]);return t},l=(t,e)=>H(t,A(e)),C=t=>c(t,"__esModule",{value:!0});var d=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,a)=>(typeof require!="undefined"?require:e)[a]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var S=(t,e)=>{C(t);for(var a in e)c(t,a,{get:e[a],enumerable:!0})},T=(t,e,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of G(e))!U.call(t,o)&&o!=="default"&&c(t,o,{get:()=>e[o],enumerable:!(a=w(e,o))||a.enumerable});return t},m=t=>T(C(c(t!=null?M(j(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var X={};S(X,{PiralUpdateDialog:()=>b,UpdateDialog:()=>V,checkPeriodically:()=>h,checkPiralEvent:()=>B,checkServerSentEvents:()=>z,checkWebSocket:()=>q,createUpdateApi:()=>Q});var x=m(d("piral-core")),b=(0,x.getPiralComponent)("UpdateDialog");var g={};S(g,{approveUpdate:()=>J,checkForUpdates:()=>K,rejectUpdate:()=>I,setUpdateMode:()=>_});var D=m(d("piral-core"));function W(t){return{name:t.name,version:t.version}}function N(t,e){return t.name.localeCompare(e.name)}function E(t){return JSON.stringify(t.map(W).sort(N))}function I(t){t.dispatch(e=>l(n({},e),{updatability:l(n({},e.updatability),{target:[],active:!1})}))}function J(t){let e=t.readState(a=>a.updatability.target);for(let a of e)t.addPilet(a);t.rejectUpdate()}function K(t,e){let a=E(e),o=t.readState(r=>r.updatability.lastHash||E(r.modules));if(a!==o){let r=t.readState(p=>p.registry.updatability),i=Object.keys(r),s=i.filter(p=>r[p].mode==="block"),y=i.filter(p=>r[p].mode==="ask"),L=e.filter(p=>!s.includes(p.name)),P=y.length>0;t.dispatch(p=>(P||setTimeout(t.approveUpdate,0),l(n({},p),{updatability:{active:P,lastHash:a,target:L}})))}}function _(t,e,a){t.dispatch(o=>l(n({},o),{registry:l(n({},o.registry),{updatability:(0,D.withKey)(o.registry.updatability,e,{mode:a})})}))}var F=m(d("piral-core")),O=t=>(0,F.defaultRender)(t.children);function h(t={}){let{period:e=5*60*1e3}=t;return(a,o)=>{setInterval(()=>{o.options.fetchPilets().then(a)},e)}}function q(t){let{url:e,available:a}=t;return(o,r)=>{let i=new WebSocket(e);i.onmessage=s=>{a(s.data,s)&&r.options.fetchPilets().then(o)}}}function z(t){let{url:e,name:a,available:o=()=>!0}=t;return(r,i)=>{new EventSource(e).addEventListener(a,y=>{o(y)&&i.options.fetchPilets().then(r)})}}function B(t){let{name:e,available:a=()=>!0}=t;return(o,r)=>{r.on(e,i=>{a(i)&&r.options.fetchPilets().then(o)})}}function Q(t={}){let{listen:e=h()}=t;return a=>(a.defineActions(g),a.dispatch(o=>l(n({},o),{components:n({UpdateDialog:O},o.components),registry:l(n({},o.registry),{updatability:{}}),updatability:{active:!1,lastHash:void 0,target:[]}})),e(a.checkForUpdates,a),(o,r)=>{let i=r.name;return{canUpdate(s){a.setUpdateMode(i,s)}}})}var f=m(d("react")),u=m(d("piral-core"));var V=()=>{let t=(0,u.useActions)(),{active:e,target:a}=(0,u.useGlobalState)(o=>o.updatability);return f.createElement(f.Fragment,null,e&&f.createElement(b,{piletsToUpdate:a,onApprove:t.approveUpdate,onReject:t.rejectUpdate}))};return X;})();
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
1
+ import type { ComponentType } from 'react';
2
2
  import { getPiralComponent } from 'piral-core';
3
3
  import { UpdateDialogProps } from './types';
4
4
 
5
- export const PiralUpdateDialog: React.ComponentType<UpdateDialogProps> = getPiralComponent('UpdateDialog');
5
+ export const PiralUpdateDialog: ComponentType<UpdateDialogProps> = getPiralComponent('UpdateDialog');
package/src/default.tsx CHANGED
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
1
+ import { FC } from 'react';
2
2
  import { defaultRender } from 'piral-core';
3
3
  import { UpdateDialogProps } from './types';
4
4
 
5
- export const DefaultUpdateDialog: React.FC<UpdateDialogProps> = (props) => defaultRender(props.children);
5
+ export const DefaultUpdateDialog: FC<UpdateDialogProps> = (props) => defaultRender(props.children);