@open-editor/shared
Advanced tools
+8
-6
@@ -6,7 +6,7 @@ declare const ServerApis: { | ||
| declare function isFn(value: any): value is () => void; | ||
| declare function isObj(value: any): value is object; | ||
| declare function isStr(value: any): value is string; | ||
| declare function isNum(value: any): value is number; | ||
| declare function isBol(value: any): value is boolean; | ||
| declare function isArr<Item = any>(value: any): value is Item[]; | ||
| declare function isObj<R extends object = AnyObject>(value: any): value is R; | ||
| declare function isStr<R extends string = string>(value: any): value is R; | ||
| declare function isNum<R extends number = number>(value: any): value is R; | ||
| declare function isBol<R extends boolean = boolean>(value: any): value is R; | ||
| declare function isArr<R extends any[] = any[]>(value: any): value is R; | ||
| declare function isNaN(value: any): boolean; | ||
@@ -22,2 +22,4 @@ | ||
| export { ServerApis, camelCase, clamp, hasOwnProperty, isArr, isBol, isFn, isNaN, isNum, isObj, isStr, omit }; | ||
| declare function injectClient(code: string, opts: AnyObject): string; | ||
| export { ServerApis, camelCase, clamp, hasOwnProperty, injectClient, isArr, isBol, isFn, isNaN, isNum, isObj, isStr, omit }; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";const ServerApis={OPEN_EDITOR:"/__open-editor__"};function isFn(value){return typeof value=="function"}function isObj(value){return value!=null&&typeof value=="object"}function isStr(value){return typeof value=="string"}function isNum(value){return typeof value=="number"}function isBol(value){return typeof value=="boolean"}function isArr(value){return Array.isArray(value)}function isNaN(value){return Number.isNaN(value)}const camelCaseRE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(str){return str.replace(camelCaseRE,(...$)=>$[1].toUpperCase())}function clamp(val,start,end){return Math.min(Math.max(val,start),end)}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};function omit(val,...keys){const newVal=__spreadValues({},val);for(const key of keys)hasOwnProperty(val,key)&&delete newVal[key];return newVal}exports.ServerApis=ServerApis,exports.camelCase=camelCase,exports.clamp=clamp,exports.hasOwnProperty=hasOwnProperty,exports.isArr=isArr,exports.isBol=isBol,exports.isFn=isFn,exports.isNaN=isNaN,exports.isNum=isNum,exports.isObj=isObj,exports.isStr=isStr,exports.omit=omit; | ||
| "use strict";const ServerApis={OPEN_EDITOR:"/__open-editor__"};function isFn(value){return typeof value=="function"}function isObj(value){return value!=null&&typeof value=="object"}function isStr(value){return typeof value=="string"}function isNum(value){return typeof value=="number"}function isBol(value){return typeof value=="boolean"}function isArr(value){return Array.isArray(value)}function isNaN(value){return Number.isNaN(value)}const camelCaseRE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(str){return str.replace(camelCaseRE,(...$)=>$[1].toUpperCase())}function clamp(val,start,end){return Math.min(Math.max(val,start),end)}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};function omit(val,...keys){const newVal=__spreadValues({},val);for(const key of keys)hasOwnProperty(val,key)&&delete newVal[key];return newVal}const useStrictRE=/^['"]use strict['"];?/;function injectClient(code,opts){return(useStrictRE.test(code)?'"use strict";':"")+'import { setupClient } from "@open-editor/client";'+code.replace(useStrictRE,"")+';if(typeof window !== "undefined"){ setupClient('+JSON.stringify(opts)+")};"}exports.ServerApis=ServerApis,exports.camelCase=camelCase,exports.clamp=clamp,exports.hasOwnProperty=hasOwnProperty,exports.injectClient=injectClient,exports.isArr=isArr,exports.isBol=isBol,exports.isFn=isFn,exports.isNaN=isNaN,exports.isNum=isNum,exports.isObj=isObj,exports.isStr=isStr,exports.omit=omit; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| const ServerApis={OPEN_EDITOR:"/__open-editor__"};function isFn(value){return typeof value=="function"}function isObj(value){return value!=null&&typeof value=="object"}function isStr(value){return typeof value=="string"}function isNum(value){return typeof value=="number"}function isBol(value){return typeof value=="boolean"}function isArr(value){return Array.isArray(value)}function isNaN(value){return Number.isNaN(value)}const camelCaseRE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(str){return str.replace(camelCaseRE,(...$)=>$[1].toUpperCase())}function clamp(val,start,end){return Math.min(Math.max(val,start),end)}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};function omit(val,...keys){const newVal=__spreadValues({},val);for(const key of keys)hasOwnProperty(val,key)&&delete newVal[key];return newVal}export{ServerApis,camelCase,clamp,hasOwnProperty,isArr,isBol,isFn,isNaN,isNum,isObj,isStr,omit}; | ||
| const ServerApis={OPEN_EDITOR:"/__open-editor__"};function isFn(value){return typeof value=="function"}function isObj(value){return value!=null&&typeof value=="object"}function isStr(value){return typeof value=="string"}function isNum(value){return typeof value=="number"}function isBol(value){return typeof value=="boolean"}function isArr(value){return Array.isArray(value)}function isNaN(value){return Number.isNaN(value)}const camelCaseRE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(str){return str.replace(camelCaseRE,(...$)=>$[1].toUpperCase())}function clamp(val,start,end){return Math.min(Math.max(val,start),end)}function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a};function omit(val,...keys){const newVal=__spreadValues({},val);for(const key of keys)hasOwnProperty(val,key)&&delete newVal[key];return newVal}const useStrictRE=/^['"]use strict['"];?/;function injectClient(code,opts){return(useStrictRE.test(code)?'"use strict";':"")+'import { setupClient } from "@open-editor/client";'+code.replace(useStrictRE,"")+';if(typeof window !== "undefined"){ setupClient('+JSON.stringify(opts)+")};"}export{ServerApis,camelCase,clamp,hasOwnProperty,injectClient,isArr,isBol,isFn,isNaN,isNum,isObj,isStr,omit}; |
+1
-6
| declare function resolvePath(path: string, url: string): string; | ||
| declare function createClient(url: string): { | ||
| filename: string; | ||
| generate: (options: object, dynamicImport?: boolean) => void; | ||
| }; | ||
| declare function isDev(): boolean; | ||
| export { createClient, isDev, resolvePath }; | ||
| export { isDev, resolvePath }; |
+1
-17
@@ -1,17 +0,1 @@ | ||
| "use strict";var node_module=require("node:module"),node_fs=require("node:fs");function resolvePath(path,url){return node_module.createRequire(url).resolve(path)}const clientId="@open-editor/client/client",syncTemplate=` | ||
| import { setupClient } from './index'; | ||
| if (typeof window !== 'undefined') { | ||
| setupClient(__OPTIONS__); | ||
| } | ||
| `,asyncTemplate=` | ||
| if (typeof window !== 'undefined') { | ||
| if (typeof require !== 'undefined') { | ||
| const { setupClient } = require('./index.js'); | ||
| setupClient(__OPTIONS__); | ||
| } else { | ||
| import('./index.mjs').then(({ setupClient }) => { | ||
| setupClient(__OPTIONS__); | ||
| }) | ||
| } | ||
| } | ||
| `;function createClient(url){const filename=resolvePath(clientId,url);function generate(options,dynamicImport=!1){const oldCode=node_fs.existsSync(filename)?node_fs.readFileSync(filename,"utf-8"):void 0,newCode=(dynamicImport?asyncTemplate:syncTemplate).replace(/__OPTIONS__/g,JSON.stringify(options));newCode!==oldCode&&node_fs.writeFileSync(filename,newCode,"utf-8")}return{filename,generate}}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}exports.createClient=createClient,exports.isDev=isDev,exports.resolvePath=resolvePath; | ||
| "use strict";var node_module=require("node:module");function resolvePath(path,url){return node_module.createRequire(url).resolve(path)}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}exports.isDev=isDev,exports.resolvePath=resolvePath; |
+1
-17
@@ -1,17 +0,1 @@ | ||
| import{createRequire}from"node:module";import{existsSync,readFileSync,writeFileSync}from"node:fs";function resolvePath(path,url){return createRequire(url).resolve(path)}const clientId="@open-editor/client/client",syncTemplate=` | ||
| import { setupClient } from './index'; | ||
| if (typeof window !== 'undefined') { | ||
| setupClient(__OPTIONS__); | ||
| } | ||
| `,asyncTemplate=` | ||
| if (typeof window !== 'undefined') { | ||
| if (typeof require !== 'undefined') { | ||
| const { setupClient } = require('./index.js'); | ||
| setupClient(__OPTIONS__); | ||
| } else { | ||
| import('./index.mjs').then(({ setupClient }) => { | ||
| setupClient(__OPTIONS__); | ||
| }) | ||
| } | ||
| } | ||
| `;function createClient(url){const filename=resolvePath(clientId,url);function generate(options,dynamicImport=!1){const oldCode=existsSync(filename)?readFileSync(filename,"utf-8"):void 0,newCode=(dynamicImport?asyncTemplate:syncTemplate).replace(/__OPTIONS__/g,JSON.stringify(options));newCode!==oldCode&&writeFileSync(filename,newCode,"utf-8")}return{filename,generate}}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}export{createClient,isDev,resolvePath}; | ||
| import{createRequire}from"node:module";function resolvePath(path,url){return createRequire(url).resolve(path)}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}export{isDev,resolvePath}; |
+1
-1
| { | ||
| "name": "@open-editor/shared", | ||
| "version": "0.7.4", | ||
| "version": "0.8.0", | ||
| "description": "internal utils shared across @open-editor packages", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
7731
-12.98%37
-48.61%1
Infinity%