Skip to content

Commit 35f7d18

Browse files
authored
Code editor engine bundle fixes (#1736)
* feat: remove engine from being bundled into code-editor with explicit script name listing * chore: change output format of code-editor from UMD to ES module in rollup configuration
1 parent 8f93f2d commit 35f7d18

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/common/script-names.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
import { getReservedScriptNames } from 'playcanvas';
2-
31
// Should not start with a number and then should not contain invalid chars
42
const sanityRegex = /^[^0-9.#<>$+%!`&='{}@\\/:*?"|\n][^#<>$+%!`&='{}@\\/:*?"|\n]*$/;
53

64
// Some reserved names (e.g. "data", "move", "swap", ...) can not be used and would lead to some issues.
7-
const reservedScriptNames = getReservedScriptNames();
5+
// Inlined from playcanvas engine (src/framework/script/script-create.js) to avoid bundling the entire engine.
6+
const reservedScriptNames = new Set([
7+
'system', 'entity', 'create', 'destroy', 'swap', 'move', 'data',
8+
'scripts', '_scripts', '_scriptsIndex', '_scriptsData',
9+
'enabled', '_oldState', 'onEnable', 'onDisable', 'onPostStateChange',
10+
'_onSetEnabled', '_checkState', '_onBeforeRemove',
11+
'_onInitializeAttributes', '_onInitialize', '_onPostInitialize',
12+
'_onUpdate', '_onPostUpdate',
13+
'_callbacks', '_callbackActive', 'has', 'get', 'on', 'off', 'fire', 'once', 'hasEvent',
14+
'worker'
15+
]);
816

917
export function normalizeScriptName(filename: string): null | string {
1018
filename = filename.trim();

0 commit comments

Comments
 (0)