@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.71
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/LICENSE +433 -0
- package/README.md +1 -1
- package/lib/config.js +0 -14
- package/lib/dependencies/ResolveDependency.js +0 -5
- package/lib/index.js +7 -38
- package/lib/json-compiler/helper.js +3 -3
- package/lib/loader.js +0 -53
- package/lib/parser.js +1 -1
- package/lib/platform/json/wx/index.js +21 -8
- package/lib/platform/style/wx/index.js +51 -54
- package/lib/platform/template/wx/component-config/button.js +2 -14
- package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
- package/lib/platform/template/wx/component-config/image.js +0 -4
- package/lib/platform/template/wx/component-config/index.js +1 -1
- package/lib/platform/template/wx/component-config/input.js +0 -4
- package/lib/platform/template/wx/component-config/movable-view.js +8 -1
- package/lib/platform/template/wx/component-config/picker-view.js +1 -5
- package/lib/platform/template/wx/component-config/rich-text.js +6 -2
- package/lib/platform/template/wx/component-config/scroll-view.js +1 -5
- package/lib/platform/template/wx/component-config/switch.js +0 -4
- package/lib/platform/template/wx/component-config/text.js +0 -4
- package/lib/platform/template/wx/component-config/textarea.js +0 -5
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/platform/template/wx/component-config/view.js +0 -4
- package/lib/platform/template/wx/index.js +1 -131
- package/lib/resolve-loader.js +1 -4
- package/lib/runtime/components/react/context.ts +8 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +39 -37
- package/lib/runtime/components/react/dist/mpx-button.jsx +16 -44
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +93 -58
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +10 -14
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +94 -81
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +19 -16
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +10 -11
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +11 -4
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +31 -8
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +435 -371
- package/lib/runtime/components/react/dist/mpx-view.jsx +18 -53
- package/lib/runtime/components/react/dist/pickerFaces.js +3 -8
- package/lib/runtime/components/react/dist/pickerVIewContext.js +5 -0
- package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerViewIndicator.jsx} +6 -6
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +2 -2
- package/lib/runtime/components/react/dist/useAnimationHooks.js +27 -10
- package/lib/runtime/components/react/dist/utils.jsx +162 -70
- package/lib/runtime/components/react/event.config.ts +25 -26
- package/lib/runtime/components/react/getInnerListeners.ts +236 -182
- package/lib/runtime/components/react/mpx-button.tsx +27 -69
- package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
- package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
- package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
- package/lib/runtime/components/react/mpx-form.tsx +15 -20
- package/lib/runtime/components/react/mpx-icon.tsx +2 -2
- package/lib/runtime/components/react/mpx-image.tsx +87 -47
- package/lib/runtime/components/react/mpx-input.tsx +24 -32
- package/lib/runtime/components/react/mpx-label.tsx +12 -14
- package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
- package/lib/runtime/components/react/mpx-movable-view.tsx +133 -92
- package/lib/runtime/components/react/mpx-navigator.tsx +3 -9
- package/lib/runtime/components/react/mpx-picker-view-column-item.tsx +76 -0
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +206 -183
- package/lib/runtime/components/react/mpx-picker-view.tsx +49 -48
- package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
- package/lib/runtime/components/react/mpx-radio.tsx +19 -25
- package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +115 -0
- package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
- package/lib/runtime/components/react/mpx-scroll-view.tsx +53 -43
- package/lib/runtime/components/react/mpx-swiper-item.tsx +45 -11
- package/lib/runtime/components/react/mpx-swiper.tsx +742 -0
- package/lib/runtime/components/react/mpx-switch.tsx +19 -15
- package/lib/runtime/components/react/mpx-text.tsx +8 -16
- package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
- package/lib/runtime/components/react/mpx-view.tsx +28 -77
- package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
- package/lib/runtime/components/react/pickerFaces.ts +10 -7
- package/lib/runtime/components/react/pickerVIewContext.ts +27 -0
- package/lib/runtime/components/react/pickerViewIndicator.tsx +34 -0
- package/lib/runtime/components/react/pickerViewMask.tsx +30 -0
- package/lib/runtime/components/react/types/{getInnerListeners.ts → getInnerListeners.d.ts} +4 -5
- package/lib/runtime/components/react/types/global.d.ts +12 -1
- package/lib/runtime/components/react/useAnimationHooks.ts +60 -15
- package/lib/runtime/components/react/utils.tsx +175 -71
- package/lib/runtime/components/web/mpx-checkbox.vue +1 -1
- package/lib/runtime/components/web/mpx-picker-view-column.vue +9 -4
- package/lib/runtime/components/web/mpx-web-view.vue +34 -20
- package/lib/runtime/optionProcessor.js +0 -22
- package/lib/style-compiler/index.js +1 -1
- package/lib/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/compiler.js +91 -39
- package/lib/utils/env.js +1 -6
- package/lib/utils/pre-process-json.js +9 -5
- package/lib/wxss/loader.js +15 -2
- package/package.json +4 -7
- package/lib/dependencies/AddEntryDependency.js +0 -24
- package/lib/runtime/components/react/dist/types/common.js +0 -1
- package/lib/runtime/components/react/dist/types/getInnerListeners.js +0 -1
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +0 -527
- package/lib/runtime/components/react/mpx-swiper/index.tsx +0 -80
- package/lib/runtime/components/react/mpx-swiper/type.ts +0 -87
- package/lib/runtime/components/react/pickerOverlay.tsx +0 -32
- package/lib/runtime/components/tenon/getInnerListeners.js +0 -334
- package/lib/runtime/components/tenon/tenon-button.vue +0 -309
- package/lib/runtime/components/tenon/tenon-image.vue +0 -66
- package/lib/runtime/components/tenon/tenon-input.vue +0 -171
- package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -26
- package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -127
- package/lib/runtime/components/tenon/tenon-switch.vue +0 -96
- package/lib/runtime/components/tenon/tenon-text.vue +0 -70
- package/lib/runtime/components/tenon/tenon-textarea.vue +0 -86
- package/lib/runtime/components/tenon/tenon-view.vue +0 -93
- package/lib/runtime/components/web/event.js +0 -105
- package/lib/runtime/optionProcessor.tenon.js +0 -84
- package/lib/style-compiler/plugins/hm.js +0 -20
- package/lib/tenon/index.js +0 -117
- package/lib/tenon/processJSON.js +0 -352
- package/lib/tenon/processScript.js +0 -203
- package/lib/tenon/processStyles.js +0 -21
- package/lib/tenon/processTemplate.js +0 -126
- package/lib/tenon/script-helper.js +0 -223
- package/lib/utils/get-relative-path.js +0 -25
- /package/lib/runtime/components/react/types/{common.ts → common.d.ts} +0 -0
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
const loaderUtils = require('loader-utils')
|
|
2
|
-
const normalize = require('../utils/normalize')
|
|
3
|
-
const createHelpers = require('../helpers')
|
|
4
|
-
const tabBarContainerPath = normalize.lib('runtime/components/web/mpx-tab-bar-container.vue')
|
|
5
|
-
const tabBarPath = normalize.lib('runtime/components/web/mpx-tab-bar.vue')
|
|
6
|
-
const addQuery = require('../utils/add-query')
|
|
7
|
-
const parseRequest = require('../utils/parse-request')
|
|
8
|
-
const shallowStringify = require('../utils/shallow-stringify')
|
|
9
|
-
|
|
10
|
-
function stringifyRequest (loaderContext, request) {
|
|
11
|
-
return loaderUtils.stringifyRequest(loaderContext, request)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function getAsyncChunkName (chunkName) {
|
|
15
|
-
if (chunkName && typeof chunkName !== 'boolean') {
|
|
16
|
-
return `/* webpackChunkName: "${chunkName}" */`
|
|
17
|
-
}
|
|
18
|
-
return ''
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function buildComponentsMap ({ localComponentsMap, builtInComponentsMap, loaderContext, jsonConfig }) {
|
|
22
|
-
const componentsMap = {}
|
|
23
|
-
if (localComponentsMap) {
|
|
24
|
-
Object.keys(localComponentsMap).forEach((componentName) => {
|
|
25
|
-
const componentCfg = localComponentsMap[componentName]
|
|
26
|
-
const componentRequest = stringifyRequest(loaderContext, componentCfg.resource)
|
|
27
|
-
if (componentCfg.async) {
|
|
28
|
-
// todo 暂时只处理局部注册的组件作为componentPlaceholder,暂不支持全局组件和原生组件,如使用了支持范围外的组件将不进行placeholder渲染及替换
|
|
29
|
-
if (jsonConfig.componentPlaceholder && jsonConfig.componentPlaceholder[componentName] && localComponentsMap[jsonConfig.componentPlaceholder[componentName]]) {
|
|
30
|
-
const placeholder = jsonConfig.componentPlaceholder[componentName]
|
|
31
|
-
const placeholderCfg = localComponentsMap[placeholder]
|
|
32
|
-
const placeholderRequest = stringifyRequest(loaderContext, placeholderCfg.resource)
|
|
33
|
-
if (placeholderCfg.async) {
|
|
34
|
-
loaderContext.emitWarning(
|
|
35
|
-
new Error(`[json processor][${loaderContext.resource}]: componentPlaceholder ${placeholder} should not be a async component, please check!`)
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
componentsMap[componentName] = `function(){return {component: import(${getAsyncChunkName(componentCfg.async)}${componentRequest}).then(function(res){return getComponent(res)}), loading: getComponent(require(${placeholderRequest}))}}`
|
|
39
|
-
} else {
|
|
40
|
-
componentsMap[componentName] = `function(){return import(${getAsyncChunkName(componentCfg.async)}${componentRequest}).then(function(res){return getComponent(res)})}`
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
componentsMap[componentName] = `getComponent(require(${componentRequest}))`
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
if (builtInComponentsMap) {
|
|
48
|
-
Object.keys(builtInComponentsMap).forEach((componentName) => {
|
|
49
|
-
const componentCfg = builtInComponentsMap[componentName]
|
|
50
|
-
const componentRequest = stringifyRequest(loaderContext, componentCfg.resource)
|
|
51
|
-
componentsMap[componentName] = `getComponent(require(${componentRequest}), {__mpxBuiltIn: true})`
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
return componentsMap
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function buildPagesMap ({ localPagesMap, loaderContext, tabBar, tabBarMap, tabBarStr, jsonConfig }) {
|
|
58
|
-
let globalTabBar = ''
|
|
59
|
-
let firstPage = ''
|
|
60
|
-
const pagesMap = {}
|
|
61
|
-
const tabBarPagesMap = {}
|
|
62
|
-
if (tabBar && tabBarMap) {
|
|
63
|
-
// 挂载tabBar组件
|
|
64
|
-
const tabBarRequest = stringifyRequest(loaderContext, addQuery(tabBar.custom ? './custom-tab-bar/index' : tabBarPath, { isComponent: true }))
|
|
65
|
-
tabBarPagesMap['mpx-tab-bar'] = `getComponent(require(${tabBarRequest}))`
|
|
66
|
-
// 挂载tabBar页面
|
|
67
|
-
Object.keys(tabBarMap).forEach((pagePath) => {
|
|
68
|
-
const pageCfg = localPagesMap[pagePath]
|
|
69
|
-
if (pageCfg) {
|
|
70
|
-
const pageRequest = stringifyRequest(loaderContext, pageCfg.resource)
|
|
71
|
-
if (pageCfg.async) {
|
|
72
|
-
tabBarPagesMap[pagePath] = `function(){return import(${getAsyncChunkName(pageCfg.async)}${pageRequest}).then(function(res) {return getComponent(res, {__mpxPageRoute: ${JSON.stringify(pagePath)}})})}`
|
|
73
|
-
} else {
|
|
74
|
-
tabBarPagesMap[pagePath] = `getComponent(require(${pageRequest}), {__mpxPageRoute: ${JSON.stringify(pagePath)}})`
|
|
75
|
-
}
|
|
76
|
-
} else {
|
|
77
|
-
loaderContext.emitWarning(
|
|
78
|
-
new Error(`[json processor][${loaderContext.resource}]: TabBar page path ${pagePath} is not exist in local page map, please check!`)
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
if (tabBarStr && tabBarPagesMap) {
|
|
84
|
-
globalTabBar += `
|
|
85
|
-
global.__tabBar = ${tabBarStr}
|
|
86
|
-
Vue.observable(global.__tabBar)
|
|
87
|
-
// @ts-ignore
|
|
88
|
-
global.__tabBarPagesMap = ${shallowStringify(tabBarPagesMap)}\n`
|
|
89
|
-
}
|
|
90
|
-
Object.keys(localPagesMap).forEach((pagePath) => {
|
|
91
|
-
const pageCfg = localPagesMap[pagePath]
|
|
92
|
-
const pageRequest = stringifyRequest(loaderContext, pageCfg.resource)
|
|
93
|
-
if (tabBarMap && tabBarMap[pagePath]) {
|
|
94
|
-
pagesMap[pagePath] = `getComponent(require(${stringifyRequest(loaderContext, tabBarContainerPath)}), {__mpxBuiltIn: true})`
|
|
95
|
-
} else {
|
|
96
|
-
if (pageCfg.async) {
|
|
97
|
-
pagesMap[pagePath] = `function(){return import(${getAsyncChunkName(pageCfg.async)} ${pageRequest}).then(function(res){return getComponent(res, {__mpxPageRoute: ${JSON.stringify(pagePath)}})})}`
|
|
98
|
-
} else {
|
|
99
|
-
// 为了保持小程序中app->page->component的js执行顺序,所有的page和component都改为require引入
|
|
100
|
-
pagesMap[pagePath] = `getComponent(require(${pageRequest}), {__mpxPageRoute: ${JSON.stringify(pagePath)}})`
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (pagePath === jsonConfig.entryPagePath) {
|
|
105
|
-
firstPage = pagePath
|
|
106
|
-
}
|
|
107
|
-
if (!firstPage && pageCfg.isFirst) {
|
|
108
|
-
firstPage = pagePath
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
return {
|
|
112
|
-
pagesMap,
|
|
113
|
-
firstPage,
|
|
114
|
-
globalTabBar
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function getRequireScript ({ script, ctorType, loaderContext }) {
|
|
119
|
-
let content = ' /** script content **/\n'
|
|
120
|
-
const { getRequire } = createHelpers(loaderContext)
|
|
121
|
-
const { resourcePath, queryObj } = parseRequest(loaderContext.resource)
|
|
122
|
-
const extraOptions = {
|
|
123
|
-
...script.src
|
|
124
|
-
? { ...queryObj, resourcePath }
|
|
125
|
-
: null,
|
|
126
|
-
ctorType,
|
|
127
|
-
lang: script.lang || 'js'
|
|
128
|
-
}
|
|
129
|
-
content += ` ${getRequire('script', script, extraOptions)}\n`
|
|
130
|
-
return content
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function buildGlobalParams ({
|
|
134
|
-
moduleId,
|
|
135
|
-
scriptSrcMode,
|
|
136
|
-
loaderContext,
|
|
137
|
-
isProduction,
|
|
138
|
-
jsonConfig,
|
|
139
|
-
webConfig,
|
|
140
|
-
isMain,
|
|
141
|
-
globalTabBar,
|
|
142
|
-
hasApp
|
|
143
|
-
}) {
|
|
144
|
-
let content = ''
|
|
145
|
-
if (isMain) {
|
|
146
|
-
content += `
|
|
147
|
-
global.getApp = function () {}
|
|
148
|
-
global.getCurrentPages = function () {
|
|
149
|
-
if (!(typeof window !== 'undefined')) {
|
|
150
|
-
console.error('[Mpx runtime error]: Dangerous API! global.getCurrentPages is running in non browser environment, It may cause some problems, please use this method with caution')
|
|
151
|
-
}
|
|
152
|
-
var router = global.__mpxRouter
|
|
153
|
-
if (!router) return []
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
return (router.lastStack || router.stack).map(function (item) {
|
|
156
|
-
var page
|
|
157
|
-
var vnode = item.vnode
|
|
158
|
-
if (vnode && vnode.componentInstance) {
|
|
159
|
-
page = vnode.tag.endsWith('mpx-tab-bar-container') ? vnode.componentInstance.$refs.tabBarPage : vnode.componentInstance
|
|
160
|
-
}
|
|
161
|
-
return page || { route: item.path.slice(1) }
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
global.__networkTimeout = ${JSON.stringify(jsonConfig.networkTimeout)}
|
|
165
|
-
global.__mpxGenericsMap = {}
|
|
166
|
-
global.__mpxOptionsMap = {}
|
|
167
|
-
global.__style = ${JSON.stringify(jsonConfig.style || 'v1')}
|
|
168
|
-
global.__mpxPageConfig = ${JSON.stringify(jsonConfig.window)}
|
|
169
|
-
global.__mpxTransRpxFn = ${webConfig.transRpxFn}\n`
|
|
170
|
-
if (globalTabBar) {
|
|
171
|
-
content += globalTabBar
|
|
172
|
-
}
|
|
173
|
-
} else {
|
|
174
|
-
if (!hasApp) {
|
|
175
|
-
content += ' global.__mpxGenericsMap = global.__mpxGenericsMap || {}\n'
|
|
176
|
-
content += ' global.__mpxOptionsMap = global.__mpxOptionsMap || {}\n'
|
|
177
|
-
content += ` global.__mpxTransRpxFn = ${webConfig.transRpxFn}\n`
|
|
178
|
-
}
|
|
179
|
-
content += ` global.currentModuleId = ${JSON.stringify(moduleId)}\n`
|
|
180
|
-
content += ` global.currentSrcMode = ${JSON.stringify(scriptSrcMode)}\n`
|
|
181
|
-
content += ` global.currentInject = ${JSON.stringify({ moduleId })}\n`
|
|
182
|
-
if (!isProduction) {
|
|
183
|
-
content += ` global.currentResource = ${JSON.stringify(loaderContext.resourcePath)}\n`
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return content
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function buildI18n ({ i18n, loaderContext }) {
|
|
190
|
-
let i18nContent = ''
|
|
191
|
-
const i18nObj = Object.assign({}, i18n)
|
|
192
|
-
i18nContent += `
|
|
193
|
-
import VueI18n from 'vue-i18n'
|
|
194
|
-
import { createI18n } from 'vue-i18n-bridge'
|
|
195
|
-
Vue.use(VueI18n , { bridge: true })\n`
|
|
196
|
-
const requestObj = {}
|
|
197
|
-
const i18nKeys = ['messages', 'dateTimeFormats', 'numberFormats']
|
|
198
|
-
i18nKeys.forEach((key) => {
|
|
199
|
-
if (i18nObj[`${key}Path`]) {
|
|
200
|
-
requestObj[key] = stringifyRequest(loaderContext, i18nObj[`${key}Path`])
|
|
201
|
-
delete i18nObj[`${key}Path`]
|
|
202
|
-
}
|
|
203
|
-
})
|
|
204
|
-
i18nContent += ` var i18nCfg = ${JSON.stringify(i18nObj)}\n`
|
|
205
|
-
Object.keys(requestObj).forEach((key) => {
|
|
206
|
-
i18nContent += ` i18nCfg.${key} = require(${requestObj[key]})\n`
|
|
207
|
-
})
|
|
208
|
-
i18nContent += `
|
|
209
|
-
i18nCfg.legacy = false
|
|
210
|
-
var i18n = createI18n(i18nCfg, VueI18n)
|
|
211
|
-
Vue.use(i18n)
|
|
212
|
-
Mpx.i18n = i18n\n`
|
|
213
|
-
return i18nContent
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
module.exports = {
|
|
217
|
-
buildPagesMap,
|
|
218
|
-
buildComponentsMap,
|
|
219
|
-
getRequireScript,
|
|
220
|
-
buildGlobalParams,
|
|
221
|
-
stringifyRequest,
|
|
222
|
-
buildI18n
|
|
223
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function getRelativePath (source, target) {
|
|
2
|
-
// make sure source and target are absolute path
|
|
3
|
-
/^\//.test(source) || (source = '/' + source);
|
|
4
|
-
/^\//.test(target) || (target = '/' + target)
|
|
5
|
-
|
|
6
|
-
source = source && source.replace(/\/[^/]*$/, '') // get dirname
|
|
7
|
-
// check if source or target is root path
|
|
8
|
-
const sourceArr = source.split('/').filter((item, index) => index !== 0 && !!item)
|
|
9
|
-
const targetArr = target.split('/').filter((item, index) => index !== 0 && !!item)
|
|
10
|
-
let i = 0
|
|
11
|
-
while (sourceArr[i] === targetArr[i] && i < sourceArr.length && i < targetArr.length) {
|
|
12
|
-
i++
|
|
13
|
-
}
|
|
14
|
-
let relativePath = ''
|
|
15
|
-
for (let j = 0; j < sourceArr.length - i; j++) {
|
|
16
|
-
relativePath += '../'
|
|
17
|
-
}
|
|
18
|
-
relativePath += targetArr.slice(i).join('/')
|
|
19
|
-
if (relativePath[0] !== '.') relativePath = './' + relativePath
|
|
20
|
-
return relativePath
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
getRelativePath
|
|
25
|
-
}
|
|
File without changes
|