xhs-mp-compiler-utils 2.0.3 → 2.0.4-beta.1

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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './constants/constants';
2
2
  export * from './utils/utils';
3
- export * from './platform';
3
+ export * from './utils/platform';
4
+ export * from './utils/path';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t,e;exports.CompileCallRuntimeMethodsNames=void 0,(t=exports.CompileCallRuntimeMethodsNames||(exports.CompileCallRuntimeMethodsNames={})).ExecExpWithContext="x0",t.CalcClass="x1",t.Rpx2vw="x2",t.RunModuleUpdater="x3",exports.CompileAddedAttrs=void 0,(e=exports.CompileAddedAttrs||(exports.CompileAddedAttrs={})).OwnerId="xhs__i",e.EventMap="xhs__p",e.ComponentIndex="xhs__c",e.ComponentId="xhs__id",e.ComponentOwnerId="xhs__oid",e.MLPath="xhs__mlpath";const o=(t,e)=>{const o=10**(e+1),s=Math.floor(t*o);return 10*Math.round(s/10)/o};const s=/([\d.]+)rpx/g;function r(){var t;return null===(t=process.env.__platform||"xhs")||void 0===t?void 0:t.trim()}exports.COMPILE_CALL_RUNTIME="$__t",exports.RPX_REGEX=s,exports.calcRpx2Vw=(t,e=750,s=5,r="vw")=>o(parseFloat(`${t}`)/e*100,s)+r,exports.getCssSuffixName=function(){return"xhs"===r()?"css":"wxss"},exports.getMlSuffixName=function(){return`${r()}ml`.trim()},exports.getPlatform=r,exports.isRpxValue=t=>!(!t||!(null==t?void 0:t.match(s))||(null==t?void 0:t.startsWith("'"))||(null==t?void 0:t.startsWith('"'))||(null==t?void 0:t.startsWith("url"))),exports.rpx2vwll=function(t){return t.replace(/([\d.]+)rpx/g,((t,e)=>`${o(e/750*100,5)}vw`))},exports.toFixed=o;
1
+ "use strict";var t=require("path");var e,o;exports.CompileCallRuntimeMethodsNames=void 0,(e=exports.CompileCallRuntimeMethodsNames||(exports.CompileCallRuntimeMethodsNames={})).ExecExpWithContext="x0",e.CalcClass="x1",e.Rpx2vw="x2",e.RunModuleUpdater="x3",exports.CompileAddedAttrs=void 0,(o=exports.CompileAddedAttrs||(exports.CompileAddedAttrs={})).OwnerId="xhs__i",o.EventMap="xhs__p",o.ComponentIndex="xhs__c",o.ComponentId="xhs__id",o.ComponentOwnerId="xhs__oid",o.MLPath="xhs__mlpath";const s=(t,e)=>{const o=10**(e+1),s=Math.floor(t*o);return 10*Math.round(s/10)/o};const r=/([\d.]+)rpx/g;function p(){var t;return null===(t=process.env.__platform||"xhs")||void 0===t?void 0:t.trim()}function n(){return`${p()}ml`.trim()}const x=(e="")=>e.split(t.sep).join(t.posix.sep);exports.COMPILE_CALL_RUNTIME="$__t",exports.RPX_REGEX=r,exports.calcRpx2Vw=(t,e=750,o=5,r="vw")=>s(parseFloat(`${t}`)/e*100,o)+r,exports.getCssSuffixName=function(){return"xhs"===p()?"css":"wxss"},exports.getMlSuffixName=n,exports.getPlatform=p,exports.getShortPath=(t,e)=>{const o=n();t=(t=x(t)).endsWith("/")?t:`${t}/`;const s=new RegExp(`.${o}$`,"g");return x(e).replace(s,"").replace(t,"")},exports.isRpxValue=t=>!(!t||!(null==t?void 0:t.match(r))||(null==t?void 0:t.startsWith("'"))||(null==t?void 0:t.startsWith('"'))||(null==t?void 0:t.startsWith("url"))),exports.rpx2vwll=function(t){return t.replace(/([\d.]+)rpx/g,((t,e)=>`${s(e/750*100,5)}vw`))},exports.toFixed=s,exports.toUnixPath=x,exports.unixJoin=(...e)=>x(t.join(...e)),exports.unixResolve=(...e)=>x(t.resolve(...e));
@@ -0,0 +1,4 @@
1
+ export declare const toUnixPath: (pathStr?: string) => string;
2
+ export declare const unixJoin: (...paths: string[]) => string;
3
+ export declare const unixResolve: (...paths: string[]) => string;
4
+ export declare const getShortPath: (miniprogramDir: string, rootContext: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xhs-mp-compiler-utils",
3
- "version": "2.0.3",
3
+ "version": "2.0.4-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
File without changes