@tmsfe/tms-core 0.0.71 → 0.0.72

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,7 @@ interface PostionType {
8
8
  province: string,
9
9
  cityCode: string,
10
10
  cityName: string,
11
+ district: string,
11
12
  latitude: number,
12
13
  longitude: number,
13
14
  }
@@ -55,6 +56,7 @@ class Location extends LocationBase {
55
56
  province: '广东省',
56
57
  cityCode: '440300',
57
58
  cityName: '深圳市',
59
+ district: '福田区',
58
60
  latitude: 22.54286,
59
61
  longitude: 114.05956,
60
62
  };
@@ -93,6 +95,7 @@ class Location extends LocationBase {
93
95
  nationCode: adInfo.nation_code,
94
96
  province: adInfo.province,
95
97
  cityName: adInfo.city,
98
+ district: adInfo.district,
96
99
  adCode: adInfo.adcode,
97
100
  cityCode: formatCityCode(adInfo.city_code, adInfo.nation_code),
98
101
  latitude: lat,
package/rollup.config.js DELETED
@@ -1,177 +0,0 @@
1
- import path from 'path';
2
- import ts from 'rollup-plugin-typescript2';
3
- import babel from '@rollup/plugin-babel';
4
- import json from '@rollup/plugin-json';
5
- import replace from 'rollup-plugin-replace';
6
- import nodeResolve from 'rollup-plugin-node-resolve';
7
- import commonjs from '@rollup/plugin-commonjs';
8
-
9
- if (!process.env.TARGET) {
10
- throw new Error('TARGET package must be specified via --environment flag.');
11
- }
12
-
13
- // 指定包地址
14
- const packageDir = path.resolve(__dirname);
15
- // 包名
16
- const name = path.basename(packageDir);
17
- // 环境
18
- const interEnv = process.env.INTER_ENV || 'public';
19
-
20
- // eslint-disable-next-line
21
- const packageJson = require('./package.json');
22
-
23
- const packageOptions = packageJson.buildOptions || {};
24
-
25
- function resolve(name) { // eslint-disable-line
26
- return path.resolve(packageDir, name);
27
- }
28
-
29
- const outputConfig = {
30
- esm: {
31
- dir: resolve('dist'),
32
- entryFileNames: '[name].js',
33
- format: 'es',
34
- },
35
- 'esm-browser': {
36
- dir: resolve('dist'),
37
- entryFileNames: '[name].esm-browser.js',
38
- format: 'es',
39
- },
40
- cjs: {
41
- dir: resolve('dist'),
42
- entryFileNames: '[name].cjs.js',
43
- format: 'cjs',
44
- },
45
- global: {
46
- dir: resolve('dist'),
47
- entryFileNames: '[name].global.js',
48
- format: 'iife',
49
- },
50
- };
51
-
52
- const defaultFormats = ['esm'];
53
- // 打包格式
54
- const packageFormats = packageOptions.formats || defaultFormats;
55
-
56
- const packageConfigs = packageFormats.map(format => createConfig(format, outputConfig[format]));
57
-
58
- export default packageConfigs;
59
-
60
- /**
61
- * format rollup package configuration object
62
- * @param {string} format 文件打包格式
63
- * @param {object} output 输出对象
64
- * @param {array} plugins 插件
65
- * @returns {object} rollup配置对象
66
- */
67
- function createConfig(format, output, plugins = []) {
68
- if (!output) {
69
- // eslint-disable-next-line
70
- console.log(require('chalk').yellow(`invalid format: "${format}"`)); // eslint-disable-line no-console
71
- process.exit(1);
72
- }
73
-
74
- output.sourceMap = true; // eslint-disable-line
75
- output.externalLiveBindings = false; // eslint-disable-line
76
-
77
- // 兼容不同的包的入口文件 -- 后面会统一为index.ts
78
- const entryFile = setEntryFile(name);
79
-
80
- // 定制化cjs的插件和esmodule的插件。
81
- const extralPlugin = setEsPlugin(output.format);
82
-
83
- return {
84
- input: entryFile,
85
- output,
86
- external: [],
87
- plugins: [
88
- json({
89
- namedExports: false,
90
- }),
91
- commonjs({
92
- ignoreDynamicRequires: true,
93
- // include: 'node_modules/**', // Default: undefined
94
- browser: true,
95
- }),
96
- babel({
97
- plugins: ['@babel/plugin-proposal-nullish-coalescing-operator', '@babel/plugin-proposal-optional-chaining'],
98
- // exclude: ['node_modules/**'],
99
- }),
100
- // terser(),
101
- createReplacePlugin(),
102
- ...extralPlugin,
103
- ...plugins,
104
- ],
105
- onwarn: (msg, warn) => {
106
- if (!/Circular/.test(msg)) {
107
- warn(msg);
108
- }
109
- },
110
- treeshake: {
111
- moduleSideEffects: false,
112
- },
113
- };
114
- }
115
-
116
- /**
117
- * 兼容现在的包会存在不同入口的情况。 后面会统一为index.ts
118
- * @param { string } packageN ame 包名称
119
- * @returns { Object } entryFile
120
- */
121
- function setEntryFile(packageName) {
122
- let entryFile = resolve('src/index.js');
123
-
124
- switch (packageName) {
125
- case 'tms-core':
126
- entryFile = {
127
- index: resolve('src/index'),
128
- request: resolve('src/request'),
129
- cloudService: resolve('src/cloudService'),
130
- 'index-proxy': resolve('src/index-proxy'),
131
- };
132
- break;
133
- case 'tms-websdk':
134
- entryFile = resolve('src/index.ts');
135
- break;
136
- default:
137
- entryFile = resolve('src/index.js');
138
- };
139
-
140
- return entryFile;
141
- }
142
-
143
- /**
144
- * 定制化cjs和esmodule的插件
145
- * @param { string } format 打包格式
146
- * @returns { Array<plugin> } 插件数组
147
- */
148
- function setEsPlugin(format) {
149
- const extralPlugins = [];
150
-
151
-
152
- if (format.indexOf('es') > -1) {
153
- extralPlugins.push(ts({
154
- tsconfig: resolve('tsconfig.json'),
155
- }));
156
- };
157
- if (format.indexOf('iife') > -1) {
158
- extralPlugins.push(nodeResolve({ jsnext: true, preferBuiltins: true, browser: true }));
159
- }
160
- return extralPlugins;
161
- }
162
-
163
- /**
164
- * 创建变量替换插件
165
- * @returns {function} 插件函数
166
- */
167
- function createReplacePlugin() {
168
- const replacements = {
169
- tmsCore: interEnv === 'public' ? '@tmsfe/tms-core' : '@tmsfe/tms-core',
170
- INTER_ENV_VB: JSON.stringify(interEnv || 'private'),
171
- };
172
-
173
- return replace({
174
- values: replacements,
175
- preventAssignment: true,
176
- });
177
- }