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++++++++*/
var doric = (function (exports) {
'use strict';
@ -3905,12 +3908,13 @@ exports.Display = void 0;
exports.jsx = void 0;
(function (jsx) {
function createElement(constructor, config, ...children) {
var _a;
if (!!constructor.isViewClass) {
const e = new constructor();
if (e instanceof Fragment) {
return children;
}
e.layoutConfig = layoutConfig().fit();
e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (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 commonjs from '@rollup/plugin-commonjs'
import jsonPlugin from '@rollup/plugin-json'
import fs from 'fs'
import path from 'path'
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import jsonPlugin from "@rollup/plugin-json";
import fs from "fs";
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 Environment = {
platform:"web"
};
/**++++++++SandBox++++++++*/
${sandboxBundle}
/**--------SandBox--------*/
@ -20,29 +29,27 @@ ${doricLibBundle}
return __module.exports;
},this,[{exports:{}}])]);
/**--------Lib--------*/
`
`;
export default {
input: `build/index.js`,
output: {
format: "iife",
name: "doric_web",
file: `dist/index.js`,
sourcemap: true,
banner: builtinScript,
globals: {
doric: "doric_lib",
'doric/src/runtime/sandbox': 'doric',
},
input: `build/index.js`,
output: {
format: "iife",
name: "doric_web",
file: `dist/index.js`,
sourcemap: true,
banner: builtinScript,
globals: {
doric: "doric_lib",
"doric/src/runtime/sandbox": "doric",
},
plugins: [
resolve({ mainFields: ["jsnext"] }),
commonjs(),
jsonPlugin(),
],
external: ['axios', 'reflect-metadata', 'doric'],
onwarn: function (warning) {
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
console.warn(warning.message);
},
}
},
plugins: [resolve({ mainFields: ["jsnext"] }), commonjs(), jsonPlugin()],
external: ["axios", "reflect-metadata", "doric"],
onwarn: function (warning) {
if (warning.code === "THIS_IS_UNDEFINED") {
return;
}
console.warn(warning.message);
},
};

View File

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