|
1 | | -import { getReservedScriptNames } from 'playcanvas'; |
2 | | - |
3 | 1 | // Should not start with a number and then should not contain invalid chars |
4 | 2 | const sanityRegex = /^[^0-9.#<>$+%!`&='{}@\\/:*?"|\n][^#<>$+%!`&='{}@\\/:*?"|\n]*$/; |
5 | 3 |
|
6 | 4 | // 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 | +]); |
8 | 16 |
|
9 | 17 | export function normalizeScriptName(filename: string): null | string { |
10 | 18 | filename = filename.trim(); |
|
0 commit comments