fix imports
parent
90fd143da4
commit
ff901ec709
|
@ -1,6 +1,6 @@
|
|||
class R3 {
|
||||
static version = '2.0.203';
|
||||
static compileDate = '2021 Sep 08 - 05:42:56 am';
|
||||
static version = '2.0.205';
|
||||
static compileDate = '2021 Sep 08 - 06:39:38 am';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4523,69 +4523,13 @@ class Touch extends Input {
|
|||
}
|
||||
|
||||
R3.System = System;
|
||||
R3.System.Input = SystemInput;
|
||||
R3.System.Linking = SystemLinking;
|
||||
R3.System.Socket = SystemSocket;
|
||||
R3.Event = Event;
|
||||
R3.Event.Runtime = Runtime;
|
||||
R3.Event.Coder = Coder;
|
||||
R3.Event.CodeMirror = CodeMirror;
|
||||
R3.Event.Default = Default;
|
||||
R3.Event.GUI = GUI;
|
||||
R3.Event.ControlKit = ControlKit;
|
||||
R3.Event.Graphics = Graphics;
|
||||
R3.Event.Three = Three;
|
||||
R3.Event.Physics = Physics;
|
||||
R3.Event.Bullet = Bullet;
|
||||
R3.Event.Socket = Socket;
|
||||
R3.Event.Statistics = Statistics;
|
||||
R3.Event.Stats = Stats;
|
||||
R3.Event.Object = R3Object;
|
||||
R3.Event.Component = Component;
|
||||
R3.Event.Image = Image;
|
||||
R3.Event.Input = Input;
|
||||
R3.Event.Touch = Touch;
|
||||
R3.Event.Project = Project;
|
||||
R3.Utils = Utils;
|
||||
R3.Runtime = Runtime;
|
||||
R3.Runtime.Coder = Coder;
|
||||
R3.Runtime.CodeMirror = CodeMirror;
|
||||
R3.Runtime.Default = Default;
|
||||
R3.Runtime.GUI = GUI;
|
||||
R3.Runtime.ControlKit = ControlKit;
|
||||
R3.Runtime.Graphics = Graphics;
|
||||
R3.Runtime.Three = Three;
|
||||
R3.Runtime.Physics = Physics;
|
||||
R3.Runtime.Bullet = Bullet;
|
||||
R3.Runtime.Socket = Socket;
|
||||
R3.Runtime.Statistics = Statistics;
|
||||
R3.Runtime.Stats = Stats;
|
||||
R3.Object = R3Object;
|
||||
R3.Object.Component = Component;
|
||||
R3.Object.Image = Image;
|
||||
R3.Object.Input = Input;
|
||||
R3.Object.Touch = Touch;
|
||||
R3.Object.Project = Project;
|
||||
R3.Coder = Coder;
|
||||
R3.Coder.CodeMirror = CodeMirror;
|
||||
R3.GUI = GUI;
|
||||
R3.GUI.ControlKit = ControlKit;
|
||||
R3.Graphics = Graphics;
|
||||
R3.Graphics.Three = Three;
|
||||
R3.Physics = Physics;
|
||||
R3.Physics.Bullet = Bullet;
|
||||
R3.Statistics = Statistics;
|
||||
R3.Statistics.Stats = Stats;
|
||||
R3.Component = Component;
|
||||
R3.Component.Image = Image;
|
||||
R3.Component.Input = Input;
|
||||
R3.Component.Touch = Touch;
|
||||
R3.Input = Input;
|
||||
R3.Input.Touch = Touch;
|
||||
|
||||
R3.Project = Project;
|
||||
console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
|
||||
|
||||
R3.System.Input.Start();
|
||||
R3.System.Linking.Start();
|
||||
R3.System.Socket.Start();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "r3",
|
||||
"version" : "2.0.203",
|
||||
"version" : "2.0.205",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
|
56
r3.php
56
r3.php
|
@ -1073,6 +1073,21 @@ function generateMethods($file, $tokens)
|
|||
|
||||
}
|
||||
|
||||
function buildChildBody($node, $child, &$body, $nameSpaceClassName)
|
||||
{
|
||||
if (sizeof($child->children) === 0) {
|
||||
array_push($body, $nameSpaceClassName . '.' . $child->nameSpaceClassName . ' = ' . $child->name . ';');
|
||||
return $body;
|
||||
}
|
||||
|
||||
foreach ($child->children as $anotherChild) {
|
||||
$nameSpaceClassName .= '.' . $child->nameSpaceClassName;
|
||||
array_push($body, $node->name . '.' . $child->nameSpaceClassName . ' = ' . $child->name . ';');
|
||||
return buildChildBody($node, $anotherChild, $body, $nameSpaceClassName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function generateIndex($types)
|
||||
{
|
||||
/**
|
||||
|
@ -1087,6 +1102,7 @@ function generateIndex($types)
|
|||
$template = file_get_contents('src/templates/index.template');
|
||||
|
||||
$imports = [];
|
||||
$body = [];
|
||||
$exports = [];
|
||||
|
||||
$children = $graph->flatten($node);
|
||||
|
@ -1100,15 +1116,22 @@ function generateIndex($types)
|
|||
$file = str_replace('src/r3/r3-' . strtolower($type), '.', $child->file);
|
||||
|
||||
array_push($imports, "const " . $child->name . ' = require(\'' . $file . "');");
|
||||
array_push($exports, $child->name);
|
||||
|
||||
}
|
||||
|
||||
foreach ($node->children as $child) {
|
||||
buildChildBody($node, $child, $body, $node->nameSpaceClassName);
|
||||
}
|
||||
|
||||
array_push($exports, 'module.exports = ' . $node->name . ';');
|
||||
|
||||
$indexFile = 'src/r3/r3-'. strtolower($type) . '/index.js';
|
||||
|
||||
file_put_contents($indexFile, $template);
|
||||
|
||||
updateSection($indexFile, 'GENERATED_IMPORTS', implode("\n", $imports));
|
||||
updateSection($indexFile, 'GENERATED_EXPORTS', " " . implode(",\n ", $exports));
|
||||
updateSection($indexFile, 'GENERATED_INDEX_BODY', implode("\n", $body));
|
||||
updateSection($indexFile, 'GENERATED_EXPORTS', implode("\n", $exports));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1119,29 +1142,18 @@ function generateR3($nodes, $graph)
|
|||
|
||||
foreach ($nodes as $node) {
|
||||
|
||||
if (
|
||||
$node->parent->parent === null || //i.e. is a base class
|
||||
$node->parent->name === 'Event' || //i.e. extends Event directly
|
||||
$node->parent->name === 'R3Object' //i.e. extends Object directly
|
||||
) {
|
||||
$file = str_replace('src/r3', '.', $node->file);
|
||||
|
||||
array_push($imports, "const " . $node->name . ' = require(\'' . $file . "');");
|
||||
|
||||
if ((sizeof($node->children) > 0)) {
|
||||
|
||||
$define = "R3." . $node->nameSpaceClassName . ' = ' . $node->name;
|
||||
array_push($defines, $define);
|
||||
|
||||
$children = $graph->flatten($node);
|
||||
|
||||
foreach ($children as $child) {
|
||||
$define = "R3." . $node->nameSpaceClassName . '.' . $child->nameSpaceClassName . ' = ' . $child->name;
|
||||
array_push($defines, $define);
|
||||
}
|
||||
|
||||
} else if ($node->parent->parent === null) {
|
||||
array_push($defines, $node->nameSpace . $node->nameSpaceClassName . ' = ' . $node->name);
|
||||
array_push($defines, 'R3.' . $node->nameSpaceClassName . ' = ' . $node->name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$r3File = 'src/r3/r3-r3.js';
|
||||
|
||||
save($r3File, getTokens('CUSTOM'));
|
||||
|
@ -1174,10 +1186,10 @@ function generateR3($nodes, $graph)
|
|||
file_put_contents($indexFile, $template);
|
||||
|
||||
$imports = ['const R3 = require(\'r3-r3.js\');'];
|
||||
$exports = ' R3';
|
||||
$exports = 'module.exports = R3;';
|
||||
$indexBody = [];
|
||||
|
||||
array_push($indexBody, "\nconsole.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);\n\n");
|
||||
array_push($indexBody, "console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);");
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
/**
|
||||
|
@ -1298,7 +1310,7 @@ function generateR3Dist($nodes)
|
|||
$template = str_replace('VERSION', $version, $template);
|
||||
fwrite($r3js, $template);
|
||||
|
||||
$generateTokens = getTokens('GENERATE');
|
||||
$generateTokens = getTokens('GENERATED');
|
||||
$customTokens = getTokens('CUSTOM');
|
||||
|
||||
$savedGenerate = save($r3jsSource, $generateTokens)[1];
|
||||
|
|
|
@ -3,17 +3,12 @@ const R3 = require('r3-r3.js');
|
|||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_INDEX_BODY_START
|
||||
|
||||
console.log('r3.js - version ' + R3.version + ' compiled ' + R3.compileDate);
|
||||
|
||||
|
||||
R3.System.Input.Start();
|
||||
R3.System.Linking.Start();
|
||||
R3.System.Socket.Start();
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
module.exports = {
|
||||
//GENERATED_EXPORTS_START
|
||||
R3
|
||||
//GENERATED_EXPORTS_END
|
||||
}
|
||||
//GENERATED_EXPORTS_START
|
||||
module.exports = R3;
|
||||
//GENERATED_EXPORTS_END
|
||||
|
|
|
@ -6,13 +6,11 @@ const Touch = require('./r3-touch.js');
|
|||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_INDEX_BODY_START
|
||||
Component.Image = Image;
|
||||
Component.Input = Input;
|
||||
Component.Input.Touch = Touch;
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
module.exports = {
|
||||
//GENERATED_EXPORTS_START
|
||||
Component,
|
||||
Image,
|
||||
Input,
|
||||
Touch
|
||||
//GENERATED_EXPORTS_END
|
||||
}
|
||||
//GENERATED_EXPORTS_START
|
||||
module.exports = Component;
|
||||
//GENERATED_EXPORTS_END
|
||||
|
|
|
@ -1,97 +1,26 @@
|
|||
class R3 {
|
||||
static version = '2.0.203';
|
||||
static compileDate = '2021 Sep 08 - 05:42:56 am';
|
||||
static version = '2.0.205';
|
||||
static compileDate = '2021 Sep 08 - 06:39:38 am';
|
||||
}
|
||||
|
||||
//GENERATED_IMPORTS_START
|
||||
const System = require('./r3-system/r3-system.js');
|
||||
const Event = require('./r3-event.js');
|
||||
const Utils = require('./r3-utils.js');
|
||||
const SystemInput = require('./r3-system/r3-system-input.js');
|
||||
const SystemLinking = require('./r3-system/r3-system-linking.js');
|
||||
const SystemSocket = require('./r3-system/r3-system-socket.js');
|
||||
const Runtime = require('./r3-runtime/r3-runtime.js');
|
||||
const R3Object = require('./r3-r3-object.js');
|
||||
const Coder = require('./r3-runtime/r3-coder.js');
|
||||
const Default = require('./r3-runtime/r3-default.js');
|
||||
const GUI = require('./r3-runtime/r3-g-u-i.js');
|
||||
const Graphics = require('./r3-runtime/r3-graphics.js');
|
||||
const Physics = require('./r3-runtime/r3-physics.js');
|
||||
const Socket = require('./r3-runtime/r3-socket.js');
|
||||
const Statistics = require('./r3-runtime/r3-statistics.js');
|
||||
const Component = require('./r3-component/r3-component.js');
|
||||
const Project = require('./r3-project.js');
|
||||
const CodeMirror = require('./r3-runtime/r3-code-mirror.js');
|
||||
const ControlKit = require('./r3-runtime/r3-control-kit.js');
|
||||
const Three = require('./r3-runtime/r3-three.js');
|
||||
const Bullet = require('./r3-runtime/r3-bullet.js');
|
||||
const Stats = require('./r3-runtime/r3-stats.js');
|
||||
const Image = require('./r3-component/r3-image.js');
|
||||
const Input = require('./r3-component/r3-input.js');
|
||||
const Touch = require('./r3-component/r3-touch.js');
|
||||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_DEFINES_START
|
||||
R3.System = System;
|
||||
R3.System.Input = SystemInput;
|
||||
R3.System.Linking = SystemLinking;
|
||||
R3.System.Socket = SystemSocket;
|
||||
R3.Event = Event;
|
||||
R3.Event.Runtime = Runtime;
|
||||
R3.Event.Coder = Coder;
|
||||
R3.Event.CodeMirror = CodeMirror;
|
||||
R3.Event.Default = Default;
|
||||
R3.Event.GUI = GUI;
|
||||
R3.Event.ControlKit = ControlKit;
|
||||
R3.Event.Graphics = Graphics;
|
||||
R3.Event.Three = Three;
|
||||
R3.Event.Physics = Physics;
|
||||
R3.Event.Bullet = Bullet;
|
||||
R3.Event.Socket = Socket;
|
||||
R3.Event.Statistics = Statistics;
|
||||
R3.Event.Stats = Stats;
|
||||
R3.Event.Object = R3Object;
|
||||
R3.Event.Component = Component;
|
||||
R3.Event.Image = Image;
|
||||
R3.Event.Input = Input;
|
||||
R3.Event.Touch = Touch;
|
||||
R3.Event.Project = Project;
|
||||
R3.Utils = Utils;
|
||||
R3.Runtime = Runtime;
|
||||
R3.Runtime.Coder = Coder;
|
||||
R3.Runtime.CodeMirror = CodeMirror;
|
||||
R3.Runtime.Default = Default;
|
||||
R3.Runtime.GUI = GUI;
|
||||
R3.Runtime.ControlKit = ControlKit;
|
||||
R3.Runtime.Graphics = Graphics;
|
||||
R3.Runtime.Three = Three;
|
||||
R3.Runtime.Physics = Physics;
|
||||
R3.Runtime.Bullet = Bullet;
|
||||
R3.Runtime.Socket = Socket;
|
||||
R3.Runtime.Statistics = Statistics;
|
||||
R3.Runtime.Stats = Stats;
|
||||
R3.Object = R3Object;
|
||||
R3.Object.Component = Component;
|
||||
R3.Object.Image = Image;
|
||||
R3.Object.Input = Input;
|
||||
R3.Object.Touch = Touch;
|
||||
R3.Object.Project = Project;
|
||||
R3.Coder = Coder;
|
||||
R3.Coder.CodeMirror = CodeMirror;
|
||||
R3.GUI = GUI;
|
||||
R3.GUI.ControlKit = ControlKit;
|
||||
R3.Graphics = Graphics;
|
||||
R3.Graphics.Three = Three;
|
||||
R3.Physics = Physics;
|
||||
R3.Physics.Bullet = Bullet;
|
||||
R3.Statistics = Statistics;
|
||||
R3.Statistics.Stats = Stats;
|
||||
R3.Component = Component;
|
||||
R3.Component.Image = Image;
|
||||
R3.Component.Input = Input;
|
||||
R3.Component.Touch = Touch;
|
||||
R3.Input = Input;
|
||||
R3.Input.Touch = Touch;
|
||||
R3.Project = Project;
|
||||
//GENERATED_DEFINES_END
|
||||
|
||||
//CUSTOM_CONVENIENT_DEFINES_START
|
||||
|
|
|
@ -15,22 +15,20 @@ const Stats = require('./r3-stats.js');
|
|||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_INDEX_BODY_START
|
||||
Runtime.Coder = Coder;
|
||||
Runtime.Coder.CodeMirror = CodeMirror;
|
||||
Runtime.Default = Default;
|
||||
Runtime.GUI = GUI;
|
||||
Runtime.GUI.ControlKit = ControlKit;
|
||||
Runtime.Graphics = Graphics;
|
||||
Runtime.Graphics.Three = Three;
|
||||
Runtime.Physics = Physics;
|
||||
Runtime.Physics.Bullet = Bullet;
|
||||
Runtime.Socket = Socket;
|
||||
Runtime.Statistics = Statistics;
|
||||
Runtime.Statistics.Stats = Stats;
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
module.exports = {
|
||||
//GENERATED_EXPORTS_START
|
||||
Runtime,
|
||||
Coder,
|
||||
CodeMirror,
|
||||
Default,
|
||||
GUI,
|
||||
ControlKit,
|
||||
Graphics,
|
||||
Three,
|
||||
Physics,
|
||||
Bullet,
|
||||
Socket,
|
||||
Statistics,
|
||||
Stats
|
||||
//GENERATED_EXPORTS_END
|
||||
}
|
||||
//GENERATED_EXPORTS_START
|
||||
module.exports = Runtime;
|
||||
//GENERATED_EXPORTS_END
|
||||
|
|
|
@ -6,13 +6,11 @@ const SystemSocket = require('./r3-system-socket.js');
|
|||
//GENERATED_IMPORTS_END
|
||||
|
||||
//GENERATED_INDEX_BODY_START
|
||||
System.Input = SystemInput;
|
||||
System.Linking = SystemLinking;
|
||||
System.Socket = SystemSocket;
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
module.exports = {
|
||||
//GENERATED_EXPORTS_START
|
||||
System,
|
||||
SystemInput,
|
||||
SystemLinking,
|
||||
SystemSocket
|
||||
//GENERATED_EXPORTS_END
|
||||
}
|
||||
//GENERATED_EXPORTS_START
|
||||
module.exports = System;
|
||||
//GENERATED_EXPORTS_END
|
||||
|
|
|
@ -4,7 +4,5 @@
|
|||
//GENERATED_INDEX_BODY_START
|
||||
//GENERATED_INDEX_BODY_END
|
||||
|
||||
module.exports = {
|
||||
//GENERATED_EXPORTS_START
|
||||
//GENERATED_EXPORTS_END
|
||||
}
|
||||
//GENERATED_EXPORTS_START
|
||||
//GENERATED_EXPORTS_END
|
||||
|
|
Loading…
Reference in New Issue