mirror of
https://github.com/suren-atoyan/monaco-react.git
synced 2025-12-08 20:16:13 +00:00
* update dependency (@monaco-editor/loader) version to - v1.0.0 * create useMonaco hook * export useMonaco from the entry file * rename the main utility: monaco -> loader * rename editorDidMount to onMount, add beforeMount * add defaultModelPath/originalModelPath/modifiedModelPath props * add defaultValue prop and use it during default model creation * rename the utility name: monaco -> loader * handle no-unused-expressions rule * move 'prop-types' to dependencies * remove prop * remove ControlledEditor * visually combine properties with the same type * prerelease v4 * prerelease v4: release candidate 0 * fix types according to changed * add onValidate prop: an event emitted when the length of the model markers of the current model isn't 0 * update package version to 4.0.0-rc.1 * rename monacoEditor to monaco in types * add state-local as a dependency * define state-local as a external library and set in UMD globals * use state-local to store the backup of the model markers setter * fix types in comments * create draft version of v4 README file * fix tabs in Documentation * make title upper case * add codesandbox likns
90 lines
1.9 KiB
JavaScript
90 lines
1.9 KiB
JavaScript
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
import replace from '@rollup/plugin-replace';
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
import babel from '@rollup/plugin-babel';
|
|
import { terser } from 'rollup-plugin-terser';
|
|
|
|
const defaultNodeResolveConfig = {};
|
|
const nodeResolvePlugin = nodeResolve(defaultNodeResolveConfig);
|
|
|
|
const commonPlugins = [
|
|
nodeResolvePlugin,
|
|
babel.default({
|
|
presets: [['@babel/preset-env', { targets: '> 2%, not dead' }], '@babel/preset-react'],
|
|
babelHelpers: 'bundled',
|
|
}),
|
|
commonjs(),
|
|
];
|
|
|
|
const developmentPlugins = [
|
|
...commonPlugins,
|
|
replace({
|
|
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
}),
|
|
];
|
|
|
|
const productionPlugins = [
|
|
...commonPlugins,
|
|
replace({
|
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
}),
|
|
terser({ mangle: false }),
|
|
];
|
|
|
|
const external = ['@monaco-editor/loader', 'state-local', 'react', 'prop-types'];
|
|
const globalsForUMD = {
|
|
'react': 'React',
|
|
'prop-types': 'PropTypes',
|
|
'@monaco-editor/loader': 'monaco_loader',
|
|
'state-local': 'state',
|
|
};
|
|
|
|
export default [
|
|
{
|
|
input: 'src/index.js',
|
|
external,
|
|
output: {
|
|
exports: 'named',
|
|
dir: 'lib/cjs/',
|
|
format: 'cjs',
|
|
preserveModules: true,
|
|
},
|
|
plugins: commonPlugins,
|
|
},
|
|
{
|
|
input: 'src/index.js',
|
|
external,
|
|
output: {
|
|
exports: 'named',
|
|
dir: 'lib/es/',
|
|
format: 'es',
|
|
preserveModules: true,
|
|
},
|
|
plugins: commonPlugins,
|
|
},
|
|
{
|
|
input: 'src/index.js',
|
|
external,
|
|
output: {
|
|
exports: 'named',
|
|
file: 'lib/umd/monaco-react.js',
|
|
format: 'umd',
|
|
globals: globalsForUMD,
|
|
name: 'monaco_react',
|
|
},
|
|
plugins: developmentPlugins,
|
|
},
|
|
{
|
|
input: 'src/index.js',
|
|
external,
|
|
output: {
|
|
exports: 'named',
|
|
file: 'lib/umd/monaco-react.min.js',
|
|
format: 'umd',
|
|
globals: globalsForUMD,
|
|
name: 'monaco_react',
|
|
},
|
|
plugins: productionPlugins,
|
|
},
|
|
];
|