Skip to content

Commit 55583a3

Browse files
committed
Remove node version from bundle
1 parent 5488ff9 commit 55583a3

10 files changed

Lines changed: 32 additions & 519 deletions

File tree

packages/devextreme/build/gulp/npm.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ const distGlobsPattern = (jsFolder, exclude) => [
7070
`!${jsFolder}/dx-diagram*`,
7171
`!${jsFolder}/dx-gantt*`,
7272
`!${jsFolder}/dx-quill*`,
73-
`!${jsFolder}/vectormap-utils/**/*`,
7473
];
7574

7675
const srcGlobs = esmSrcGlobs;

packages/devextreme/build/gulp/vectormap.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,29 @@ function transformFileName(fileName) {
2424

2525
gulp.task('vectormap-utils', function() {
2626
return merge(
27-
createVectorMapUtilsStream('browser', '.debug', false),
28-
createVectorMapUtilsStream('browser', '', true),
29-
createVectorMapUtilsStream('node', '', false)
27+
createBrowserVectorMapUtilsStream('.debug', false),
28+
createBrowserVectorMapUtilsStream('', true),
3029
);
3130
});
3231

33-
gulp.task('vectormap-data', gulp.series('vectormap-utils', function() {
32+
function buildNodeUtilsForDataGeneration() {
33+
const settings = require(path.join('../..', VECTORMAP_UTILS_PATH, '_settings.json'));
34+
const part = settings['node'];
35+
return gulp.src(settings.commonFiles.concat(part.files).map(transformFileName))
36+
.pipe(concat(part.fileName + '.js'))
37+
.pipe(headerPipes.useStrict())
38+
.pipe(gulp.dest(VECTORMAP_UTILS_RESULT_PATH));
39+
}
40+
41+
function cleanNodeUtils(done) {
42+
const nodeFile = path.join(VECTORMAP_UTILS_RESULT_PATH, 'dx.vectormaputils.node.js');
43+
if(fs.existsSync(nodeFile)) {
44+
fs.unlinkSync(nodeFile);
45+
}
46+
done();
47+
}
48+
49+
gulp.task('vectormap-data', gulp.series(buildNodeUtilsForDataGeneration, function() {
3450
const stream = merge();
3551
const processFiles = require(path.join('../..', VECTORMAP_UTILS_RESULT_PATH, 'dx.vectormaputils.node.js')).processFiles;
3652

@@ -57,7 +73,7 @@ gulp.task('vectormap-data', gulp.series('vectormap-utils', function() {
5773
});
5874
});
5975
return stream;
60-
}));
76+
}, cleanNodeUtils));
6177

6278
function patchVectorMapUtilsStream(stream, isMinify) {
6379
return stream.pipe(headerPipes.useStrict())
@@ -67,20 +83,17 @@ function patchVectorMapUtilsStream(stream, isMinify) {
6783
.pipe(gulp.dest(VECTORMAP_UTILS_RESULT_PATH));
6884
}
6985

70-
function createVectorMapUtilsStream(name, suffix, isMinify) {
86+
function createBrowserVectorMapUtilsStream(suffix, isMinify) {
7187
const settings = require(path.join('../..', VECTORMAP_UTILS_PATH, '_settings.json'));
72-
const part = settings[name];
88+
const part = settings['browser'];
7389
const stream = gulp.src(settings.commonFiles.concat(part.files).map(transformFileName))
7490
.pipe(concat(part.fileName + suffix + '.js'));
7591

76-
if(name === 'browser') {
77-
return stream.pipe(tap(file => {
78-
patchVectorMapUtilsStream(gulp.src('build/gulp/vectormaputils-template.jst')
79-
.pipe(template({ data: file.contents }))
80-
.pipe(rename(path.basename(file.path))), isMinify);
81-
}));
82-
}
83-
return patchVectorMapUtilsStream(stream, isMinify);
92+
return stream.pipe(tap(file => {
93+
patchVectorMapUtilsStream(gulp.src('build/gulp/vectormaputils-template.jst')
94+
.pipe(template({ data: file.contents }))
95+
.pipe(rename(path.basename(file.path))), isMinify);
96+
}));
8497
}
8598

8699
gulp.task('vectormap', gulp.series('vectormap-utils', 'vectormap-data'));

packages/devextreme/ports.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"qunit": "20060",
3-
"vectormap-utils-tester": "20061"
2+
"qunit": "20060"
43
}

packages/devextreme/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@
685685
"{projectRoot}/build/gulp/vectormap.js"
686686
],
687687
"outputs": [
688+
"{projectRoot}/artifacts/js/vectormap-utils",
688689
"{projectRoot}/artifacts/js/vectormap-data"
689690
]
690691
},
@@ -732,7 +733,6 @@
732733
"{projectRoot}/build/gulp/vendor.js"
733734
],
734735
"outputs": [
735-
"{projectRoot}/artifacts/js/vectormap-utils",
736736
"{projectRoot}/artifacts/js/cldr"
737737
]
738738
},

packages/devextreme/testing/helpers/vectormaputils-tester.js

Lines changed: 0 additions & 78 deletions
This file was deleted.

packages/devextreme/testing/runner/index.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
parseNumber,
2222
readBodyText,
2323
readFormBody,
24-
resolveNodePath,
2524
safeDecodeURIComponent,
2625
safeReadFile,
2726
splitCommaList,
@@ -35,7 +34,6 @@ import { createVectorMapService } from './lib/vectormap';
3534
import {
3635
sendHtml,
3736
sendJson,
38-
sendJsonText,
3937
sendNotFound,
4038
sendText,
4139
sendXml,
@@ -77,9 +75,6 @@ const RUN_FLAGS = {
7775

7876
const PORTS = loadPorts(path.join(PACKAGE_ROOT, 'ports.json'));
7977
const QUNIT_PORT = Number(PORTS.qunit);
80-
const VECTOR_MAP_TESTER_PORT = Number(PORTS['vectormap-utils-tester']);
81-
82-
const PATH_TO_NODE = resolveNodePath();
8378

8479
const logger = createRunnerLogger(RAW_LOG_FILENAME);
8580
const templates = createTemplateRenderer(TEMPLATES_ROOT, escapeHtml);
@@ -102,8 +97,6 @@ const vectorMapService = createVectorMapService({
10297
packageRoot: PACKAGE_ROOT,
10398
testingRoot: TESTING_ROOT,
10499
vectorDataDirectory: VECTOR_DATA_DIRECTORY,
105-
vectorMapTesterPort: VECTOR_MAP_TESTER_PORT,
106-
pathToNode: PATH_TO_NODE,
107100
});
108101
const staticFiles = createStaticFileService({
109102
escapeHtml,
@@ -312,35 +305,6 @@ async function handleRequest(req: http.IncomingMessage, res: http.ServerResponse
312305
return;
313306
}
314307

315-
if (req.method === 'GET') {
316-
const parseBufferMatch = /^\/TestVectorMapData\/ParseBuffer\/(.+)$/i.exec(pathname);
317-
if (parseBufferMatch) {
318-
const id = safeDecodeURIComponent(parseBufferMatch[1]);
319-
const responseText = await vectorMapService.redirectRequestToVectorMapNodeServer('parse-buffer', id);
320-
sendJsonText(res, responseText);
321-
return;
322-
}
323-
}
324-
325-
if (req.method === 'GET') {
326-
const readAndParseMatch = /^\/TestVectorMapData\/ReadAndParse\/(.+)$/i.exec(pathname);
327-
if (readAndParseMatch) {
328-
const id = safeDecodeURIComponent(readAndParseMatch[1]);
329-
const responseText = await vectorMapService.redirectRequestToVectorMapNodeServer('read-and-parse', id);
330-
sendJsonText(res, responseText);
331-
return;
332-
}
333-
}
334-
335-
if (req.method === 'GET') {
336-
const executeConsoleAppMatch = /^\/TestVectorMapData\/ExecuteConsoleApp(?:\/(.*))?$/i.exec(pathname);
337-
if (executeConsoleAppMatch) {
338-
const result = vectorMapService.executeVectorMapConsoleApp(requestUrl.searchParams);
339-
sendJson(res, result);
340-
return;
341-
}
342-
}
343-
344308
if (staticFiles.tryServeStatic(req, res, pathname, requestUrl.searchParams)) {
345309
return;
346310
}

packages/devextreme/testing/runner/lib/types.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,9 @@ export interface VectorMapDataItem {
100100
expected: string;
101101
}
102102

103-
export interface VectorMapOutputItem {
104-
file: string;
105-
variable: string | null;
106-
content: JsonValue;
107-
}
108-
109103
export interface PortsMap {
110104
[key: string]: number | string;
111105
qunit: number | string;
112-
'vectormap-utils-tester': number | string;
113106
}
114107

115108
export type TemplateVarValue = JsonValue | bigint | undefined;

packages/devextreme/testing/runner/lib/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ export function loadPorts(filePath: string): PortsMap {
4545
throw new Error(`Invalid ports definition: ${filePath}`);
4646
}
4747

48-
if (!isPortValue(parsed.qunit) || !isPortValue(parsed['vectormap-utils-tester'])) {
48+
if (!isPortValue(parsed.qunit)) {
4949
throw new Error(`Required ports are missing in ${filePath}`);
5050
}
5151

5252
const portsMap: PortsMap = {
5353
qunit: parsed.qunit,
54-
'vectormap-utils-tester': parsed['vectormap-utils-tester'],
5554
};
5655

5756
Object.entries(parsed).forEach(([key, value]) => {

0 commit comments

Comments
 (0)