Require ol.ext dependencies directly
This commit is contained in:
@@ -3,5 +3,11 @@
|
|||||||
"version": "3.20.0-beta.1",
|
"version": "3.20.0-beta.1",
|
||||||
"description": "OpenLayers",
|
"description": "OpenLayers",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "BSD-2-Clause"
|
"license": "BSD-2-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"pbf": "3.0.5",
|
||||||
|
"pixelworks": "1.1.0",
|
||||||
|
"rbush": "2.0.1",
|
||||||
|
"vector-tile": "1.3.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
var pkg = require('../package.json');
|
||||||
|
|
||||||
function rename(name) {
|
function rename(name) {
|
||||||
const parts = name.split('.');
|
const parts = name.split('.');
|
||||||
return `_${parts.join('_')}_`;
|
return `_${parts.join('_')}_`;
|
||||||
@@ -6,6 +8,24 @@ function rename(name) {
|
|||||||
function resolve(fromName, toName) {
|
function resolve(fromName, toName) {
|
||||||
const fromParts = fromName.split('.');
|
const fromParts = fromName.split('.');
|
||||||
const toParts = toName.split('.');
|
const toParts = toName.split('.');
|
||||||
|
if (toParts[0] === 'ol' && toParts[1] === 'ext') {
|
||||||
|
let name = toParts[2];
|
||||||
|
let packageName;
|
||||||
|
for (let i = 0, ii = pkg.ext.length; i < ii; ++i) {
|
||||||
|
const dependency = pkg.ext[i];
|
||||||
|
if (dependency.module === name) {
|
||||||
|
packageName = name;
|
||||||
|
break;
|
||||||
|
} else if (dependency.name === name) {
|
||||||
|
packageName = dependency.module;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!packageName) {
|
||||||
|
throw new Error(`Can't find package name for ${toName}`);
|
||||||
|
}
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
var commonDepth = 1;
|
var commonDepth = 1;
|
||||||
var fromLength = fromParts.length;
|
var fromLength = fromParts.length;
|
||||||
while (commonDepth < fromLength - 1) {
|
while (commonDepth < fromLength - 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user