Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@open-editor/shared

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@open-editor/shared - npm Package Compare versions

Comparing version
0.9.3
to
0.9.4
+203
-5
dist/index.d.ts

@@ -0,4 +1,13 @@

/**
* 客户端模块标识常量,用于标识需要特殊处理的编辑器客户端模块
*/
declare const CLIENT_MODULE_ID = "@open-editor/client";
/**
* 通用模块路径匹配正则表达式,用于检测所有支持的框架模块路径
*/
declare const ENTRY_MATCH_RE: RegExp;
/**
* ESM 模块路径匹配正则表达式,专门用于检测 ESM 格式的框架模块路径
*/
declare const ENTRY_ESM_MATCH_RE: RegExp;
declare const CLIENT_MODULE_ID = "@open-editor/client";

@@ -9,20 +18,209 @@ declare const ServerApis: {

/**
* 类型判断工具函数集合
* 使用类型谓词(Type Predicates)帮助 TypeScript 缩小变量类型范围
*/
/**
* 判断是否为函数类型
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是函数类型 () => void
*
* @example
* isFn(() => {}); // true
* isFn({}); // false
*/
declare function isFn(value: any): value is () => void;
/**
* 判断是否为非 null 的对象类型
*
* @template R - 泛型参数,默认为任意对象类型(需预先定义 AnyObject 类型)
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是 R 类型的对象
*
* @example
* isObj({}); // true
* isObj(null); // false
* isObj([]); // false
*/
declare function isObj<R extends object = AnyObject>(value: any): value is R;
/**
* 判断是否为字符串类型
*
* @template R - 泛型参数,默认为 string 类型
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是 R 类型的字符串
*
* @example
* isStr('hello'); // true
* isStr(123); // false
*/
declare function isStr<R extends string = string>(value: any): value is R;
/**
* 判断是否为数字类型(不包含 NaN)
*
* @template R - 泛型参数,默认为 number 类型
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是 R 类型的数字
*
* @example
* isNum(123); // true
* isNum('123'); // false
*/
declare function isNum<R extends number = number>(value: any): value is R;
/**
* 判断是否为布尔类型
*
* @template R - 泛型参数,默认为 boolean 类型
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是 R 类型的布尔值
*
* @example
* isBol(true); // true
* isBol(0); // false
*/
declare function isBol<R extends boolean = boolean>(value: any): value is R;
/**
* 判断是否为数组类型
*
* @template R - 泛型参数,默认为 any[] 数组类型
*
* @param value - 需要判断的任意值
*
* @returns 类型谓词,返回 true 时表示 value 是 R 类型的数组
*
* @example
* isArr([1, 2]); // true
* isArr({}); // false
*/
declare function isArr<R extends any[] = any[]>(value: any): value is R;
/**
* 判断是否为 NaN(使用 ES6 的 Number.isNaN 规范)
*
* @param value - 需要判断的任意值
*
* @returns 返回 boolean 表示是否为 NaN
*
* @example
* isNaN(NaN); // true
* isNaN('a'); // false(与全局 isNaN 不同)
*/
declare function isNaN(value: any): boolean;
declare function camelCase(str: string): string;
/**
* 将字符串转换为驼峰命名格式
*
* @param inputStr 需要转换的原始字符串
*
* @returns 转换后的驼峰格式字符串
*
* @example
* camelCase("hello-world") => "helloWorld"
* camelCase("path/to/file") => "pathToFile"
*/
declare function camelCase(inputStr: string): string;
/**
* 数值范围限制函数
*
* 当数值超过边界时,自动将其约束到最近的边界值
*
* @param val 需要限制的原始数值
* @param start 区间下限值(包含)
* @param end 区间上限值(包含)
*/
declare function clamp(val: number, start: number, end: number): number;
declare function hasOwnProperty<Obj extends object, Prop extends PropertyKey>(obj: Partial<Obj>, prop: Prop): obj is Obj & Record<Prop, Prop extends keyof Obj ? Obj[Prop] : any>;
/**
* 类型安全的属性存在性检查函数
*
* @template Obj - 待检查的宿主对象类型(需继承普通对象)
* @template Prop - 要检查的属性键类型(支持 string | number | symbol)
*
* @param obj - 需要检查的目标对象
* @param prop - 需要检查的属性名称
*
* @returns 返回类型谓词,用于类型收窄:
* - 当属性存在时,对象类型将包含该属性的确定类型
* - 当属性不存在时,保持原对象类型不变
*
* @example
* declare const user: { name?: string };
* if (hasOwn(user, 'name')) {
* user.name.toUpperCase(); // 类型安全访问
* }
*/
declare function hasOwn<Obj extends object, Prop extends PropertyKey>(obj: Obj, prop: Prop): obj is Obj & Record<Prop, Prop extends keyof Obj ? Obj[Prop] : unknown>;
/**
* 向目标代码中注入客户端初始化逻辑
*
* @param code 原始代码内容
* @param userOpts 注入配置选项
*
* @returns 包含客户端初始化逻辑的完整代码
*/
declare function injectClient(code: string, userOpts: AnyObject): string;
declare function normalizePath(path: string): string;
/**
* 路径标准化配置选项
*/
interface NormalizeOptions {
/**
* 是否保留末尾斜杠
*
* 设置为 true 时保留路径末尾的斜杠
* @default false
*/
keepTrailingSlash?: boolean;
/**
* 是否合并连续斜杠
*
* 设置为 true 时会将多个连续斜杠合并为单个
* @default true
*/
mergeSlashes?: boolean;
}
/**
* 标准化处理文件路径
*
* @param path 原始路径字符串
* @param options 标准化配置选项
*
* @returns 返回统一格式的标准化路径
*
* 功能说明:
* 1. 转换 Windows 反斜杠路径为 POSIX 斜杠路径
* 2. 自动去除首尾空白字符
* 3. 可选合并连续斜杠(默认启用)
* 4. 可选保留末尾斜杠(默认不保留)
*/
declare function normalizePath(path: string, options?: NormalizeOptions): string;
export { CLIENT_MODULE_ID, ENTRY_ESM_MATCH_RE, ENTRY_MATCH_RE, ServerApis, camelCase, clamp, hasOwnProperty, injectClient, isArr, isBol, isFn, isNaN, isNum, isObj, isStr, normalizePath };
/**
* 深度比较两个对象是否完全相等。
*
* 该函数会递归地比较两个对象及其嵌套对象的所有可枚举属性的值。
* 它还会进行一些优化,例如首先检查引用和构造函数是否相同。
*
* 注意:
* - 对于包含循环引用的对象,此函数可能会导致栈溢出。
* - 数组会被视为对象进行比较,比较的是它们的属性(索引)和值,而不是像专门的数组比较那样只关注元素和顺序。
* - 只比较对象自身的可枚举属性,不会比较原型链上的属性、不可枚举属性或 Symbol 属性。
*
* @param obj1 第一个要比较的对象。可以是任何对象、null 或 undefined。
* @param obj2 第二个要比较的对象。可以是任何对象、null 或 undefined。
* @returns 如果两个对象完全相等(包括嵌套对象的所有可枚举属性值),则返回 true;否则返回 false。
*/
declare function isObjectsEqual<T extends AnyObject>(obj1: T | null | undefined, obj2: T | null | undefined): boolean;
export { CLIENT_MODULE_ID, ENTRY_ESM_MATCH_RE, ENTRY_MATCH_RE, NormalizeOptions, ServerApis, camelCase, clamp, hasOwn, injectClient, isArr, isBol, isFn, isNaN, isNum, isObj, isObjectsEqual, isStr, normalizePath };
+5
-5

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

"use strict";const REACT_15_PATH=normalizePath$1("react/react.js"),REACT_17_PATH=normalizePath$1("react/index.js"),VUE_2_PATH=normalizePath$1("vue/dist/vue.runtime.common.js"),VUE_2_ESM_PATH=normalizePath$1("vue/dist/vue.runtime.esm.js"),VUE_3_PATH=normalizePath$1("vue/index.js"),VUE_3_ESM_PATH=normalizePath$1("vue/dist/vue.runtime.esm-bundler.js"),ENTRY_MATCH_RE=createMatchRE([REACT_15_PATH,REACT_17_PATH,VUE_2_PATH,VUE_2_ESM_PATH,VUE_3_PATH,VUE_3_ESM_PATH]),ENTRY_ESM_MATCH_RE=createMatchRE([VUE_2_ESM_PATH,VUE_3_ESM_PATH]),CLIENT_MODULE_ID="@open-editor/client";function normalizePath$1(path){return`/node_modules/${path.replace(/\./g,"\\.")}`.replace(/\//g,"[\\\\/]")}function createMatchRE(paths){return RegExp(`(${paths.join("|")})$`)}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 __getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__objRest=(source,exclude)=>{var target={};for(var prop in source)__hasOwnProp.call(source,prop)&&exclude.indexOf(prop)<0&&(target[prop]=source[prop]);if(source!=null&&__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(source))exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop)&&(target[prop]=source[prop]);return target};const useStrictRE=/^['"]use strict['"];?/;function injectClient(code,userOpts){const _a=userOpts,{isCommonjs}=_a,opts=__objRest(_a,["isCommonjs"]);return(useStrictRE.test(code)?`"use strict";
`:"")+(isCommonjs?`const { setupClient } = require("@open-editor/client");
"use strict";const REACT_PATHS={V15:normalizePath$1("react/react.js"),V17:normalizePath$1("react/index.js")},VUE_PATHS={V2_COMMONJS:normalizePath$1("vue/dist/vue.runtime.common.js"),V2_ESM:normalizePath$1("vue/dist/vue.runtime.esm.js"),V3:normalizePath$1("vue/index.js"),V3_ESM:normalizePath$1("vue/dist/vue.runtime.esm-bundler.js")},ALL_MODULE_PATHS=[...Object.values(REACT_PATHS),...Object.values(VUE_PATHS)],ESM_MODULE_PATHS=[VUE_PATHS.V2_ESM,VUE_PATHS.V3_ESM],CLIENT_MODULE_ID="@open-editor/client",ENTRY_MATCH_RE=createMatchRE(ALL_MODULE_PATHS),ENTRY_ESM_MATCH_RE=createMatchRE(ESM_MODULE_PATHS);function normalizePath$1(path){return`/node_modules/${path.replace(/\./g,"\\.")}`.replace(/\//g,"[\\\\/]")}function createMatchRE(paths){return RegExp(`(${paths.join("|")})$`)}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 CAMEL_CASE_RE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(inputStr){return inputStr.replace(CAMEL_CASE_RE,(_2,firstLetter)=>firstLetter.toUpperCase())}function clamp(val,start,end){const lowerBounded=Math.max(val,start);return Math.min(lowerBounded,end)}const _=Object.prototype.hasOwnProperty;function hasOwn(obj,prop){return _.call(obj,prop)}var __getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__objRest=(source,exclude)=>{var target={};for(var prop in source)__hasOwnProp.call(source,prop)&&exclude.indexOf(prop)<0&&(target[prop]=source[prop]);if(source!=null&&__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(source))exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop)&&(target[prop]=source[prop]);return target};const useStrictPattern=/^['"]use strict['"];?/;function injectClient(code,userOpts){const _a=userOpts,{isCommonjs}=_a,clientOptions=__objRest(_a,["isCommonjs"]),useStrictHeader=useStrictPattern.test(code)?`"use strict";
`:"",moduleImport=isCommonjs?`const { setupClient } = require("@open-editor/client");
`:`import { setupClient } from "@open-editor/client";
`)+code.replace(useStrictRE,"")+`
if(typeof window !== "undefined"){setupClient(`+JSON.stringify(opts)+`)};
`}function normalizePath(path){return path.replace(/\\/g,"/")}exports.CLIENT_MODULE_ID=CLIENT_MODULE_ID,exports.ENTRY_ESM_MATCH_RE=ENTRY_ESM_MATCH_RE,exports.ENTRY_MATCH_RE=ENTRY_MATCH_RE,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.normalizePath=normalizePath;
`,cleanedCode=code.replace(useStrictPattern,""),clientSetupCode=`
setupClient(${JSON.stringify(clientOptions)});
`;return useStrictHeader+moduleImport+cleanedCode+clientSetupCode}function normalizePath(path,options={}){const{keepTrailingSlash=!1,mergeSlashes=!0}=options;return path.trim().replace(/\\+/g,"/").replace(mergeSlashes?/\/{2,}/g:/(?!)/,"/").replace(keepTrailingSlash?/\/?$/:/\/$/,"")}function isObjectsEqual(obj1,obj2){if(obj1===obj2)return!0;if(obj1==null||obj2==null||obj1.constructor!==obj2.constructor)return!1;const keys1=Object.keys(obj1),keys2=Object.keys(obj2);if(keys1.length!==keys2.length)return!1;const keys2Set=new Set(keys2);for(const key of keys1){if(!keys2Set.has(key))return!1;const value1=obj1[key],value2=obj2[key];if(typeof value1=="object"&&value1!==null&&typeof value2=="object"&&value2!==null){if(!isObjectsEqual(value1,value2))return!1}else if(value1!==value2)return!1}return!0}exports.CLIENT_MODULE_ID=CLIENT_MODULE_ID,exports.ENTRY_ESM_MATCH_RE=ENTRY_ESM_MATCH_RE,exports.ENTRY_MATCH_RE=ENTRY_MATCH_RE,exports.ServerApis=ServerApis,exports.camelCase=camelCase,exports.clamp=clamp,exports.hasOwn=hasOwn,exports.injectClient=injectClient,exports.isArr=isArr,exports.isBol=isBol,exports.isFn=isFn,exports.isNaN=isNaN,exports.isNum=isNum,exports.isObj=isObj,exports.isObjectsEqual=isObjectsEqual,exports.isStr=isStr,exports.normalizePath=normalizePath;

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

const REACT_15_PATH=normalizePath$1("react/react.js"),REACT_17_PATH=normalizePath$1("react/index.js"),VUE_2_PATH=normalizePath$1("vue/dist/vue.runtime.common.js"),VUE_2_ESM_PATH=normalizePath$1("vue/dist/vue.runtime.esm.js"),VUE_3_PATH=normalizePath$1("vue/index.js"),VUE_3_ESM_PATH=normalizePath$1("vue/dist/vue.runtime.esm-bundler.js"),ENTRY_MATCH_RE=createMatchRE([REACT_15_PATH,REACT_17_PATH,VUE_2_PATH,VUE_2_ESM_PATH,VUE_3_PATH,VUE_3_ESM_PATH]),ENTRY_ESM_MATCH_RE=createMatchRE([VUE_2_ESM_PATH,VUE_3_ESM_PATH]),CLIENT_MODULE_ID="@open-editor/client";function normalizePath$1(path){return`/node_modules/${path.replace(/\./g,"\\.")}`.replace(/\//g,"[\\\\/]")}function createMatchRE(paths){return RegExp(`(${paths.join("|")})$`)}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 __getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__objRest=(source,exclude)=>{var target={};for(var prop in source)__hasOwnProp.call(source,prop)&&exclude.indexOf(prop)<0&&(target[prop]=source[prop]);if(source!=null&&__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(source))exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop)&&(target[prop]=source[prop]);return target};const useStrictRE=/^['"]use strict['"];?/;function injectClient(code,userOpts){const _a=userOpts,{isCommonjs}=_a,opts=__objRest(_a,["isCommonjs"]);return(useStrictRE.test(code)?`"use strict";
`:"")+(isCommonjs?`const { setupClient } = require("@open-editor/client");
const REACT_PATHS={V15:normalizePath$1("react/react.js"),V17:normalizePath$1("react/index.js")},VUE_PATHS={V2_COMMONJS:normalizePath$1("vue/dist/vue.runtime.common.js"),V2_ESM:normalizePath$1("vue/dist/vue.runtime.esm.js"),V3:normalizePath$1("vue/index.js"),V3_ESM:normalizePath$1("vue/dist/vue.runtime.esm-bundler.js")},ALL_MODULE_PATHS=[...Object.values(REACT_PATHS),...Object.values(VUE_PATHS)],ESM_MODULE_PATHS=[VUE_PATHS.V2_ESM,VUE_PATHS.V3_ESM],CLIENT_MODULE_ID="@open-editor/client",ENTRY_MATCH_RE=createMatchRE(ALL_MODULE_PATHS),ENTRY_ESM_MATCH_RE=createMatchRE(ESM_MODULE_PATHS);function normalizePath$1(path){return`/node_modules/${path.replace(/\./g,"\\.")}`.replace(/\//g,"[\\\\/]")}function createMatchRE(paths){return RegExp(`(${paths.join("|")})$`)}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 CAMEL_CASE_RE=/(?:(?=^)|(?:[./\-_]+))([a-z])/g;function camelCase(inputStr){return inputStr.replace(CAMEL_CASE_RE,(_2,firstLetter)=>firstLetter.toUpperCase())}function clamp(val,start,end){const lowerBounded=Math.max(val,start);return Math.min(lowerBounded,end)}const _=Object.prototype.hasOwnProperty;function hasOwn(obj,prop){return _.call(obj,prop)}var __getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__objRest=(source,exclude)=>{var target={};for(var prop in source)__hasOwnProp.call(source,prop)&&exclude.indexOf(prop)<0&&(target[prop]=source[prop]);if(source!=null&&__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(source))exclude.indexOf(prop)<0&&__propIsEnum.call(source,prop)&&(target[prop]=source[prop]);return target};const useStrictPattern=/^['"]use strict['"];?/;function injectClient(code,userOpts){const _a=userOpts,{isCommonjs}=_a,clientOptions=__objRest(_a,["isCommonjs"]),useStrictHeader=useStrictPattern.test(code)?`"use strict";
`:"",moduleImport=isCommonjs?`const { setupClient } = require("@open-editor/client");
`:`import { setupClient } from "@open-editor/client";
`)+code.replace(useStrictRE,"")+`
if(typeof window !== "undefined"){setupClient(`+JSON.stringify(opts)+`)};
`}function normalizePath(path){return path.replace(/\\/g,"/")}export{CLIENT_MODULE_ID,ENTRY_ESM_MATCH_RE,ENTRY_MATCH_RE,ServerApis,camelCase,clamp,hasOwnProperty,injectClient,isArr,isBol,isFn,isNaN,isNum,isObj,isStr,normalizePath};
`,cleanedCode=code.replace(useStrictPattern,""),clientSetupCode=`
setupClient(${JSON.stringify(clientOptions)});
`;return useStrictHeader+moduleImport+cleanedCode+clientSetupCode}function normalizePath(path,options={}){const{keepTrailingSlash=!1,mergeSlashes=!0}=options;return path.trim().replace(/\\+/g,"/").replace(mergeSlashes?/\/{2,}/g:/(?!)/,"/").replace(keepTrailingSlash?/\/?$/:/\/$/,"")}function isObjectsEqual(obj1,obj2){if(obj1===obj2)return!0;if(obj1==null||obj2==null||obj1.constructor!==obj2.constructor)return!1;const keys1=Object.keys(obj1),keys2=Object.keys(obj2);if(keys1.length!==keys2.length)return!1;const keys2Set=new Set(keys2);for(const key of keys1){if(!keys2Set.has(key))return!1;const value1=obj1[key],value2=obj2[key];if(typeof value1=="object"&&value1!==null&&typeof value2=="object"&&value2!==null){if(!isObjectsEqual(value1,value2))return!1}else if(value1!==value2)return!1}return!0}export{CLIENT_MODULE_ID,ENTRY_ESM_MATCH_RE,ENTRY_MATCH_RE,ServerApis,camelCase,clamp,hasOwn,injectClient,isArr,isBol,isFn,isNaN,isNum,isObj,isObjectsEqual,isStr,normalizePath};

@@ -1,5 +0,35 @@

declare function resolvePath(path: string, url: string): string;
/**
* 解析规范化后的模块路径
*
* @param path 需要解析的原始路径
* @param url 基准路径,用于创建自定义 require 上下文
*
* @returns 经过规范化处理的完整模块路径
*/
declare function resolvePath(
/**
* 待解析的原始路径
* - 支持相对路径(如 './utils')
* - 支持绝对路径(如 '/src/components')
* - 支持模块名(如 'lodash')
*/
path: string,
/**
* 基准路径上下文
* - 用于创建独立的模块解析上下文
* - 应当为有效的文件系统路径
*/
url: string): string;
/**
* 判断当前是否处于开发环境
*
* @returns 返回环境检测结果
*
* @example
* // 当 process.env.NODE_ENV 未设置或设置为 development 时
* isDev(); // => true
*/
declare function isDev(): boolean;
export { isDev, resolvePath };

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

"use strict";var node_module=require("node:module");function normalizePath(path){return path.replace(/\\/g,"/")}function resolvePath(path,url){return node_module.createRequire(normalizePath(url)).resolve(normalizePath(path))}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}exports.isDev=isDev,exports.resolvePath=resolvePath;
"use strict";var node_module=require("node:module");function normalizePath(path,options={}){const{keepTrailingSlash=!1,mergeSlashes=!0}=options;return path.trim().replace(/\\+/g,"/").replace(mergeSlashes?/\/{2,}/g:/(?!)/,"/").replace(keepTrailingSlash?/\/?$/:/\/$/,"")}function resolvePath(path,url){const normalizedUrl=normalizePath(url),normalizedPath=normalizePath(path);return node_module.createRequire(normalizedUrl).resolve(normalizedPath)}function isDev(){return process.env.NODE_ENV==="development"}exports.isDev=isDev,exports.resolvePath=resolvePath;

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

import{createRequire}from"node:module";function normalizePath(path){return path.replace(/\\/g,"/")}function resolvePath(path,url){return createRequire(normalizePath(url)).resolve(normalizePath(path))}function isDev(){return!(process.env.NODE_ENV&&process.env.NODE_ENV!=="development")}export{isDev,resolvePath};
import{createRequire}from"node:module";function normalizePath(path,options={}){const{keepTrailingSlash=!1,mergeSlashes=!0}=options;return path.trim().replace(/\\+/g,"/").replace(mergeSlashes?/\/{2,}/g:/(?!)/,"/").replace(keepTrailingSlash?/\/?$/:/\/$/,"")}function resolvePath(path,url){const normalizedUrl=normalizePath(url),normalizedPath=normalizePath(path);return createRequire(normalizedUrl).resolve(normalizedPath)}function isDev(){return process.env.NODE_ENV==="development"}export{isDev,resolvePath};
{
"name": "@open-editor/shared",
"version": "0.9.3",
"version": "0.9.4",
"description": "internal utils shared across @open-editor packages",

@@ -33,3 +33,3 @@ "main": "./dist/index.js",

},
"homepage": "https://github.com/zjxxxxxxxxx/open-editor/tree/main/packages/shared#readme",
"homepage": "https://github.com/zjxxxxxxxxx/open-editor#readme",
"scripts": {

@@ -36,0 +36,0 @@ "build": "pnpm rollup -c",