Skip to content

Commit

Permalink
fix(runtime-mini): fix wechat npm build support
Browse files Browse the repository at this point in the history
  • Loading branch information
lyfeyaj committed Mar 9, 2023
1 parent 32af3e2 commit 096fb7c
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 34 deletions.
1 change: 1 addition & 0 deletions packages/runtime-mini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"scripts": {
"build": "tsc --module commonjs --outDir lib && tsc --module es2015 --outDir esm",
"clean": "rimraf esm lib",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"sideEffects": false,
Expand Down
10 changes: 6 additions & 4 deletions packages/runtime-mini/src/alipay/apisToAlipay.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { logger } from '@morjs/api/lib/logger'
import type { IAPITransformConfig } from '@morjs/api/lib/utils'
import { transformApis } from '@morjs/api/lib/utils'
import {
getGlobalObject,
IAPITransformConfig,
logger,
transformApis
} from '@morjs/api'
import { needPromisfiedApis } from './needPromisfiedApis'

/**
Expand Down
12 changes: 8 additions & 4 deletions packages/runtime-mini/src/alipay/apisToOther.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { ENV_TYPE, getEnv, getGlobalObject } from '@morjs/api/lib/env'
import { logger } from '@morjs/api/lib/logger'
import type { IAPITransformConfig } from '@morjs/api/lib/utils'
import { transformApis } from '@morjs/api/lib/utils'
import {
ENV_TYPE,
getEnv,
getGlobalObject,
IAPITransformConfig,
logger,
transformApis
} from '@morjs/api'
import { needPromisfiedApis } from './needPromisfiedApis'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-mini/src/alipay/behaviorToAlipay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '@morjs/api/lib/logger'
import { logger } from '@morjs/api'
import type { BehaviorOptions, DefinitionFilter } from './utilsToAlipay'

/**
Expand Down
4 changes: 1 addition & 3 deletions packages/runtime-mini/src/alipay/componentToAlipay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { logger } from '@morjs/api/lib/logger'
import { compose } from '@morjs/api/lib/utils'
import { compose, getGlobalObject, logger } from '@morjs/api'
import get from 'lodash.get'
import has from 'lodash.has'
import {
Expand Down
10 changes: 7 additions & 3 deletions packages/runtime-mini/src/alipay/componentToOther.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Base64 } from '@morjs/api/lib/base64'
import { logger } from '@morjs/api/lib/logger'
import { compose, generateId, getSharedProperty } from '@morjs/api/lib/utils'
import {
Base64,
compose,
generateId,
getSharedProperty,
logger
} from '@morjs/api'
import clone from 'clone-deep'
import { addEventProxy, injectInstanceMethodsSupport } from './utilsToOther'

Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-mini/src/alipay/pageToAlipay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { compose } from '@morjs/api/lib/utils'
import { compose } from '@morjs/api'
import {
injectComponentSelectorMethodsSupport,
injectCreateIntersectionObserverSupport,
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/alipay/utilsToAlipay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { markAsUnsupport } from '@morjs/api/lib/utils'
import { getGlobalObject, markAsUnsupport } from '@morjs/api'

/**
* 标记不支持的实例方法
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/alipay/utilsToOther.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { logger } from '@morjs/api/lib/logger'
import { getSharedProperty } from '@morjs/api/lib/utils'
import { getSharedProperty, logger } from '@morjs/api'

interface IEventDetail {
name?: string
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/baidu/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { transformApis } from '@morjs/api/lib/utils'
import { getGlobalObject, transformApis } from '@morjs/api'
import { needPromisfiedApis as needPromisfiedApisForWechat } from '../wechat/apis'

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/bytedance/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { transformApis } from '@morjs/api/lib/utils'
import { getGlobalObject, transformApis } from '@morjs/api'
import { needPromisfiedApis as needPromisfiedApisForWechat } from '../wechat/apis'

/**
Expand Down
11 changes: 7 additions & 4 deletions packages/runtime-mini/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { createApi, MorAPIAdapter } from '@morjs/api/lib/api'
import { registerComponentAdapters, registerPageAdapters } from '@morjs/core'
import type { MorComponentAdapter } from '@morjs/core/lib/component'
import type { MorPageAdapter } from '@morjs/core/lib/page'
import { createApi, MorAPIAdapter } from '@morjs/api'
import {
MorComponentAdapter,
MorPageAdapter,
registerComponentAdapters,
registerPageAdapters
} from '@morjs/core'
import * as apisToAlipay from './alipay/apisToAlipay'
import * as apisToOther from './alipay/apisToOther'
import * as componentToAlipay from './alipay/componentToAlipay'
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/kuaishou/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { transformApis } from '@morjs/api/lib/utils'
import { getGlobalObject, transformApis } from '@morjs/api'
import { needPromisfiedApis as needPromisfiedApisForWechat } from '../wechat/apis'

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/qq/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { transformApis } from '@morjs/api/lib/utils'
import { getGlobalObject, transformApis } from '@morjs/api'
import { needPromisfiedApis as needPromisfiedApisForWechat } from '../wechat/apis'

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime-mini/src/wechat/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { getGlobalObject } from '@morjs/api/lib/env'
import { transformApis } from '@morjs/api/lib/utils'
import { getGlobalObject, transformApis } from '@morjs/api'

/**
* 微信需要被 promisified 的接口
Expand Down

0 comments on commit 096fb7c

Please sign in to comment.