xhs-mp-compiler-utils 2.0.0-beta.4 → 2.0.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,2 +1,3 @@
1
1
  export * from './constants/constants';
2
2
  export * from './utils/utils';
3
+ export * from './platform';
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;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.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,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;
@@ -0,0 +1,3 @@
1
+ export declare function getPlatform(): 'xhs' | 'wx';
2
+ export declare function getCssSuffixName(): "css" | "wxss";
3
+ export declare function getMlSuffixName(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xhs-mp-compiler-utils",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",