forked from LanwyWriteXU/DoIt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore-node.js
More file actions
31 lines (26 loc) · 887 Bytes
/
core-node.js
File metadata and controls
31 lines (26 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file Blockly core module wrapper for node.js. This module loads
* blockly_compressed.js and jsdom, then calls
* Blockly.utils.xml.injectDependencies to supply needed XML-handling
* functions to Blocky.
*
* Note that, unlike index.js, this file does not get a UMD wrapper.
* This is because it is only used in node.js environments and so is
* guaranteed to be loaded as a CJS module.
*/
/* eslint-disable */
'use strict';
const Blockly = require('./blockly_compressed.js');
const {JSDOM} = require('jsdom');
// Override textToDomDocument and provide node.js alternatives to
// DOMParser and XMLSerializer.
if (typeof globalThis.document !== 'object') {
const {window} = new JSDOM(`<!DOCTYPE html>`);
Blockly.utils.xml.injectDependencies(window);
}
module.exports = Blockly;