Skip to content

Commit bffdb58

Browse files
committed
【UT/API/feature】 ol@4.6.5 升级至 ol@6.1.1,更新 UT,更新部分 API review by songym
1 parent 558632a commit bffdb58

File tree

255 files changed

+33779
-31755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+33779
-31755
lines changed

build/jsdocs/template/typeLinkExt.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
var olapi = "https://openlayers.org/en/v4.6.5/apidoc/";
1+
var olapi = "https://openlayers.org/en/v6.1.1/apidoc/";
22
var lfapi = "https://leafletjs.com/reference-1.5.1.html";
33
var mbglapi = "https://www.mapbox.com/mapbox-gl-js/api/";
44
var mapv = "https://github.com/huiyan-fe/mapv/blob/master/src/";
55
var classicapi="https://iclient.supermap.io/web/libs/iclient8c/apidoc/files/SuperMap"
66
var geojsonapi = "https://geojson.org";
77
var typeLinks = {
88
//openlayers
9-
"ol.Map": olapi + "ol.Map.html",
10-
"ol.View": olapi + "ol.View.html",
11-
"ol.extent": olapi + "ol.extent.html",
12-
"ol.feature": olapi + "ol.feature.html",
13-
"ol.geom.Polygon": olapi + "ol.geom.Polygon.html",
14-
"ol.geom.LineString": olapi + "ol.geom.LineString.html",
15-
"ol.geom.Point": olapi + "ol.geom.Point.html",
16-
"ol.geom.Geometry":olapi + "ol.geom.Geometry.html",
17-
"ol.format.GeoJSON": olapi + "ol.format.GeoJSON.html",
18-
"ol.proj.Projection": olapi + "ol.proj.Projection",
19-
"ol.Observable": olapi + "ol.Observable",
20-
"ol.style.Image": olapi + "ol.style.Image",
21-
"ol.style.Fill": olapi + "ol.style.Fill",
22-
"ol.style.Stroke": olapi + "ol.style.Stroke",
23-
"ol.Object": olapi + "ol.Object",
24-
"ol.source.ImageCanvas": olapi + "ol.source.ImageCanvas",
25-
"ol.source.TileImage": olapi + "ol.source.TileImage",
26-
"ol.source.WMTS": olapi + "ol.source.WMTS",
27-
"ol.source.XYZ": olapi + "ol.source.XYZ",
28-
"ol.source.Vector": olapi + "ol.source.Vector",
29-
"ol.source.VectorTile": olapi + "ol.source.VectorTile",
30-
"ol.Pixel": olapi + "ol.html#.Pixel",
31-
"ol.source.State": olapi + "ol.source.html#.State",
32-
"ol.layer.Layer": olapi + "ol.layer.Layer.html",
33-
"ol.FeatureStyleFunction": olapi + "ol.html#.FeatureStyleFunction",
34-
"ol.StyleFunction": olapi + "ol.html#.StyleFunction",
35-
"ol.control.ScaleLine": olapi + "ol.control.ScaleLine",
9+
"ol/Map": olapi + "module-ol_Map-Map",
10+
"ol/View": olapi + "module-ol_View-View",
11+
"ol/extent": olapi + "module-ol_extent.html",
12+
"ol/feature": olapi + "module-ol_Feature-Feature.html",
13+
"ol/geom/Polygon": olapi + "module-ol_geom_Polygon-Polygon.html",
14+
"ol/geom/LineString": olapi + "module-ol_geom_LineString-LineString.html",
15+
"ol/geom/Point": olapi + "module-ol_geom_Point-Point.html",
16+
"ol/geom/Geometry":olapi + "module-ol_geom_Geometry-Geometry.html",
17+
"ol/format/GeoJSON": olapi + "module-ol_format_GeoJSON-GeoJSON.html",
18+
"ol/proj/Projection": olapi + "module-ol_proj_Projection-Projection.html",
19+
"ol/Observable": olapi + "module-ol_Observable-Observable.html",
20+
"ol/style/Image": olapi + "module-ol_style_Image-ImageStyle.html",
21+
"ol/style/Fill": olapi + "module-ol_style_Fill-Fill.html",
22+
"ol/style/Stroke": olapi + "module-ol_style_Stroke-Stroke.html",
23+
"ol/Object": olapi + "module-ol_Object-BaseObject.html",
24+
"ol/source/ImageCanvas": olapi + "module-ol_source_ImageCanvas-ImageCanvasSource.html",
25+
"ol/source/TileImage": olapi + "module-ol_source_TileImage-TileImage.html",
26+
"ol/source/WMTS": olapi + "module-ol_source_WMTS-WMTS.html",
27+
"ol/source/XYZ": olapi + "module-ol_source_XYZ-XYZ.html",
28+
"ol/source/Vector": olapi + "module-ol_source_Vector-VectorSource.html",
29+
"ol/source/VectorTile": olapi + "module-ol_source_VectorTile-VectorTile.html",
30+
"ol/Pixel": olapi + "module-ol_pixel.html",
31+
"ol/source/State": olapi + "module-ol_source_State.html",
32+
"ol/layer/Layer": olapi + "module-ol_layer_Layer-Layer.html",
33+
"ol/StyleFunction": olapi + "module-ol_style_Style.html#~StyleFunction",
34+
"ol/control/ScaleLine": olapi + "module-ol_control_ScaleLine-ScaleLine.html",
35+
"ol/control/Control": olapi + "module-ol_control_Control-Control.html",
3636

3737

3838
//leaflet

build/server.js

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,61 @@
11
const path = require('path');
22
const express = require('express');
3-
const open = require("open");
4-
const serveIndex = require('serve-index')
5-
3+
const open = require('open');
4+
const serveIndex = require('serve-index');
65

76
const webpack = require('webpack');
87
const webpackDevMiddleware = require('webpack-dev-middleware');
98
const product = process.argv[2];
10-
const app = module.exports = express();
9+
const app = (module.exports = express());
1110
if (product) {
12-
const config = require(`./webpack.config.${product}.js`);
13-
const configBase = require(`./webpack.config.base.js`);
14-
const entry = [`./src/${product}/index.js`];
15-
const filename= product === 'classic' ? `iclient-classic` : `iclient-${product}`;
16-
config.output.filename = `${filename}-es6.min.js`;
17-
config.output.path = path.resolve(`${__dirname}/../dist/${product}`);
18-
if (['leaflet', 'openlayers'].includes(product)) {
19-
entry.push(`./src/${product}/css/index.js`);
20-
config.plugins = configBase.plugins(product, `${filename}.min`);
21-
}
22-
config.mode = 'development';
23-
config.entry = entry;
24-
config.devtool = 'cheap-module-eval-source-map';
25-
26-
27-
const compiler = webpack(config);
28-
const instance = webpackDevMiddleware(compiler, {
29-
publicPath: `/dist/${product}`,
30-
stats: {
31-
colors: true
11+
const config = require(`./webpack.config.${product}.js`);
12+
const configBase = require(`./webpack.config.base.js`);
13+
const entry = [`./src/${product}/${product === 'openlayers' ? 'namespace.js' : 'index.js'}`];
14+
const filename = product === 'classic' ? `iclient-classic` : `iclient-${product}`;
15+
config.output.filename = `${filename}-es6.min.js`;
16+
config.output.path = path.resolve(`${__dirname}/../dist/${product}`);
17+
if (['leaflet', 'openlayers'].includes(product)) {
18+
entry.push(`./src/${product}/css/index.js`);
19+
config.plugins = configBase.plugins(product, `${filename}.min`);
3220
}
33-
});
34-
app.use(instance);
35-
instance.waitUntilValid(() => {
36-
open(`http://localhost:8082/examples/${product}`);
37-
});
21+
config.mode = 'development';
22+
config.entry = entry;
23+
config.devtool = 'cheap-module-eval-source-map';
24+
25+
const compiler = webpack(config);
26+
const instance = webpackDevMiddleware(compiler, {
27+
publicPath: `/dist/${product}`,
28+
stats: {
29+
colors: true
30+
}
31+
});
32+
app.use(instance);
33+
instance.waitUntilValid(() => {
34+
open(`http://localhost:8082/examples/${product}`);
35+
});
3836
}
3937

4038
const server = app.listen(8082, () => {
41-
const host = server.address().address;
42-
const port = server.address().port;
43-
console.log('Example app listening at http://%s:%s', host, port);
39+
const host = server.address().address;
40+
const port = server.address().port;
41+
console.log('Example app listening at http://%s:%s', host, port);
4442
});
4543

4644
app.use(express.static('web'));
47-
app.use("/examples/template/header.html", express.static('web/template/header.html'));
48-
app.use("/examples", express.static('examples'), serveIndex('examples'));
49-
app.use("/examples-bug", express.static('examples-bug'), serveIndex('examples-bug'));
50-
app.use("/dist", express.static('dist'), serveIndex('dist'));
51-
app.use("/build", express.static('build'), serveIndex('build'));
52-
app.use("/docs", express.static('docs'), serveIndex('docs'));
53-
app.use("/web", express.static('web'), serveIndex('web'));
45+
app.use('/examples/template/header.html', express.static('web/template/header.html'));
46+
app.use('/examples', express.static('examples'), serveIndex('examples'));
47+
app.use('/examples-bug', express.static('examples-bug'), serveIndex('examples-bug'));
48+
app.use('/dist', express.static('dist'), serveIndex('dist'));
49+
app.use('/build', express.static('build'), serveIndex('build'));
50+
app.use('/docs', express.static('docs'), serveIndex('docs'));
51+
app.use('/web', express.static('web'), serveIndex('web'));
5452

55-
app.use("/en/examples/template/header.html", express.static('web/en/web/template/header.html'));
56-
app.use("/en/examples", express.static('examples'), serveIndex('examples'));
57-
app.use("/en/docs", express.static('docs'), serveIndex('docs'));
58-
app.use("/en/dist", express.static('dist'), serveIndex('dist'));
59-
app.use("/en/build", express.static('build'), serveIndex('build'));
60-
app.use("/en", express.static('web/en'), serveIndex('web/en'));
53+
app.use('/en/examples/template/header.html', express.static('web/en/web/template/header.html'));
54+
app.use('/en/examples', express.static('examples'), serveIndex('examples'));
55+
app.use('/en/docs', express.static('docs'), serveIndex('docs'));
56+
app.use('/en/dist', express.static('dist'), serveIndex('dist'));
57+
app.use('/en/build', express.static('build'), serveIndex('build'));
58+
app.use('/en', express.static('web/en'), serveIndex('web/en'));
6159
if (!product) {
62-
open(`http://localhost:8082`);
63-
}
60+
open(`http://localhost:8082`);
61+
}

build/webpack.config.openlayers.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1-
var configBase = require("./webpack.config.base");
1+
var configBase = require('./webpack.config.base');
22
//端名
3-
var libName = "openlayers";
3+
var libName = 'openlayers';
44
//产品包名
5-
var productName = "iclient-openlayers";
5+
var productName = 'iclient-openlayers';
6+
7+
var externals = [
8+
Object.assign({}, configBase.externals, {
9+
'@turf/turf': 'function(){try{return turf}catch(e){return {}}}()',
10+
'ol-mapbox-style': 'function(){try{return olms}catch(e){return {}}}()',
11+
'ol-mapbox-style/stylefunction': 'function(){try{return olms.stylefunction}catch(e){return {}}}()',
12+
'deck.gl': '(function(){try{return DeckGL}catch(e){return {}}})()',
13+
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
14+
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
15+
xlsx: 'function(){try{return XLSX}catch(e){return {}}}()',
16+
canvg: 'function(){try{return canvg}catch(e){return {}}}()',
17+
jsonsql: 'function(){try{return jsonsql}catch(e){return {}}}()'
18+
}),
19+
function(context, request, callback) {
20+
if (/^ol\//.test(request)) {
21+
return callback(null, request.replace(/\//g, '.'));
22+
}
23+
callback();
24+
}
25+
];
626

727
module.exports = {
828
mode: configBase.mode,
@@ -16,26 +36,14 @@ module.exports = {
1636
performance: configBase.performance,
1737
//其它解决方案配置
1838
resolve: configBase.resolve,
19-
externals: Object.assign({}, configBase.externals, {
20-
'openlayers': 'ol',
21-
'@turf/turf': "function(){try{return turf}catch(e){return {}}}()",
22-
'ol-mapbox-style': "function(){try{return olms}catch(e){return {}}}()",
23-
'ol-mapbox-style/stylefunction': "function(){try{return olms.stylefunction}catch(e){return {}}}()",
24-
'deck.gl': '(function(){try{return DeckGL}catch(e){return {}}})()',
25-
'luma.gl': '(function(){try{return luma}catch(e){return {}}})()',
26-
'webgl-debug': '(function(){try{return webgl-debug}catch(e){return {}}})()',
27-
'xlsx': "function(){try{return XLSX}catch(e){return {}}}()",
28-
'canvg': "function(){try{return canvg}catch(e){return {}}}()",
29-
'jsonsql': "function(){try{return jsonsql}catch(e){return {}}}()"
30-
}),
31-
39+
externals: externals,
3240
module: {
3341
noParse: /[\/\\]node_modules[\/\\]openlayers[\/\\]dist[\/\\]ol\.js$/,
34-
rules: (function () {
42+
rules: (function() {
3543
let moduleRules = [];
3644
moduleRules.push(configBase.module.rules.img);
3745
moduleRules.push(configBase.module.rules.eslint);
38-
if (configBase.moduleVersion === "es5") {
46+
if (configBase.moduleVersion === 'es5') {
3947
//打包为es5相关配置
4048
moduleRules.push({
4149
test: [/\.js$/],
@@ -45,11 +53,10 @@ module.exports = {
4553
presets: ['@babel/preset-env']
4654
}
4755
});
48-
4956
}
5057
moduleRules.push(configBase.module.rules.css);
51-
return moduleRules
58+
return moduleRules;
5259
})()
5360
},
5461
plugins: configBase.plugins(libName, productName)
55-
};
62+
};

0 commit comments

Comments
 (0)