Fix missing Envrionemnt

This commit is contained in:
pengfei.zhou 2022-08-04 14:12:11 +08:00 committed by osborn
parent ee9b8102f2
commit d886458832
4 changed files with 43 additions and 33 deletions

View File

@ -1,4 +1,7 @@
const Environment = {
platform:"web"
};
/**++++++++SandBox++++++++*/ /**++++++++SandBox++++++++*/
var doric = (function (exports) { var doric = (function (exports) {
'use strict'; 'use strict';
@ -3905,12 +3908,13 @@ exports.Display = void 0;
exports.jsx = void 0; exports.jsx = void 0;
(function (jsx) { (function (jsx) {
function createElement(constructor, config, ...children) { function createElement(constructor, config, ...children) {
var _a;
if (!!constructor.isViewClass) { if (!!constructor.isViewClass) {
const e = new constructor(); const e = new constructor();
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children; return children;
} }
e.layoutConfig = layoutConfig().fit(); e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (config) { if (config) {
e.apply(config); e.apply(config);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,23 @@
import resolve from '@rollup/plugin-node-resolve' import resolve from "@rollup/plugin-node-resolve";
import commonjs from '@rollup/plugin-commonjs' import commonjs from "@rollup/plugin-commonjs";
import jsonPlugin from '@rollup/plugin-json' import jsonPlugin from "@rollup/plugin-json";
import fs from 'fs' import fs from "fs";
import path from 'path' import path from "path";
const sandboxBundle = fs.readFileSync(path.resolve("./node_modules/doric/bundle/doric-sandbox.js"), 'utf-8') const sandboxBundle = fs.readFileSync(
path.resolve("./node_modules/doric/bundle/doric-sandbox.js"),
"utf-8"
);
const doricLibBundle = fs.readFileSync(path.resolve("./node_modules/doric/bundle/doric-lib.js"), 'utf-8') const doricLibBundle = fs.readFileSync(
path.resolve("./node_modules/doric/bundle/doric-lib.js"),
"utf-8"
);
const builtinScript = ` const builtinScript = `
const Environment = {
platform:"web"
};
/**++++++++SandBox++++++++*/ /**++++++++SandBox++++++++*/
${sandboxBundle} ${sandboxBundle}
/**--------SandBox--------*/ /**--------SandBox--------*/
@ -20,7 +29,7 @@ ${doricLibBundle}
return __module.exports; return __module.exports;
},this,[{exports:{}}])]); },this,[{exports:{}}])]);
/**--------Lib--------*/ /**--------Lib--------*/
` `;
export default { export default {
input: `build/index.js`, input: `build/index.js`,
@ -32,17 +41,15 @@ export default {
banner: builtinScript, banner: builtinScript,
globals: { globals: {
doric: "doric_lib", doric: "doric_lib",
'doric/src/runtime/sandbox': 'doric', "doric/src/runtime/sandbox": "doric",
}, },
}, },
plugins: [ plugins: [resolve({ mainFields: ["jsnext"] }), commonjs(), jsonPlugin()],
resolve({ mainFields: ["jsnext"] }), external: ["axios", "reflect-metadata", "doric"],
commonjs(),
jsonPlugin(),
],
external: ['axios', 'reflect-metadata', 'doric'],
onwarn: function (warning) { onwarn: function (warning) {
if (warning.code === 'THIS_IS_UNDEFINED') { return; } if (warning.code === "THIS_IS_UNDEFINED") {
return;
}
console.warn(warning.message); console.warn(warning.message);
}, },
} };

View File

@ -1,4 +1,3 @@
import axios from 'axios'
import { loadDoricJSBundle } from './DoricBundleLoader' import { loadDoricJSBundle } from './DoricBundleLoader'
import { DoricContext } from './DoricContext' import { DoricContext } from './DoricContext'