Convert backend code to ES modules
Bundling code now with Rollup for its flat bundling and tree shaking support. Front end code still goes through Webpack for browser support.
This commit is contained in:
1 parent
824639976f
commit
1e41c72d60
62 files changed
+718
-898
No files matched your search
+11
-19
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const config = require("./config");
|
||||
const common = require("./common");
|
||||
const device = require("./device");
|
||||
const scheduling = require("./scheduling");
|
||||
import * as config from "./config";
|
||||
import * as common from "./common";
|
||||
import * as device from "./device";
|
||||
import * as scheduling from "./scheduling";
|
||||
|
||||
const MAX_DEPTH = config.get("MAX_DEPTH");
|
||||
|
||||
function refresh(sessionContext, provision, declarations) {
|
||||
export function refresh(sessionContext, provision, declarations) {
|
||||
const path = common.parsePath(provision[1]).slice();
|
||||
const l = path.length;
|
||||
path.length = MAX_DEPTH;
|
||||
@@ -48,7 +48,7 @@ function refresh(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function value(sessionContext, provision, declarations) {
|
||||
export function value(sessionContext, provision, declarations) {
|
||||
const path = common.parsePath(provision[1]);
|
||||
declarations.push({
|
||||
path: path,
|
||||
@@ -62,7 +62,7 @@ function value(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function tag(sessionContext, provision, declarations) {
|
||||
export function tag(sessionContext, provision, declarations) {
|
||||
const path = ["Tags", provision[1]];
|
||||
|
||||
declarations.push({
|
||||
@@ -77,7 +77,7 @@ function tag(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function reboot(sessionContext, provision, declarations) {
|
||||
export function reboot(sessionContext, provision, declarations) {
|
||||
declarations.push({
|
||||
path: ["Reboot"],
|
||||
pathGet: 1,
|
||||
@@ -90,7 +90,7 @@ function reboot(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function reset(sessionContext, provision, declarations) {
|
||||
export function reset(sessionContext, provision, declarations) {
|
||||
declarations.push({
|
||||
path: ["FactoryReset"],
|
||||
pathGet: 1,
|
||||
@@ -103,7 +103,7 @@ function reset(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function download(sessionContext, provision, declarations) {
|
||||
export function download(sessionContext, provision, declarations) {
|
||||
const alias = [
|
||||
["FileType"],
|
||||
provision[1] || "",
|
||||
@@ -134,7 +134,7 @@ function download(sessionContext, provision, declarations) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function instances(
|
||||
export function instances(
|
||||
sessionContext,
|
||||
provision,
|
||||
declarations,
|
||||
@@ -178,11 +178,3 @@ function instances(
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
exports.refresh = refresh;
|
||||
exports.value = value;
|
||||
exports.tag = tag;
|
||||
exports.reboot = reboot;
|
||||
exports.reset = reset;
|
||||
exports.download = download;
|
||||
exports.instances = instances;
|
||||
Reference in new issue
Block a user