Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const rollupReplacePlugin = require('rollup-plugin-replace');
const compatPolyfills = require('compat-polyfills');
const { getModulePath } = require('lwc');
// -- Build Config -------------------------------------------
const mode = process.env.MODE || 'compat';
const isCompat = /compat/.test(mode);
const isProd = /prod/.test(mode);
const engineModeFile = getModulePath(
'engine',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const shadowModeFile = getModulePath(
'synthetic-shadow',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const wireServicePath = getModulePath(
'wire-service',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const todoPath = path.join(require.resolve('../src/shared/todo.js'));
const testSufix = '.test.js';
const testPrefix = 'test-';
const path = require('path');
const lwcCompiler = require('@lwc/rollup-plugin');
const replace = require('rollup-plugin-replace');
const copy = require('rollup-plugin-copy');
const { getModulePath } = require('lwc');
const isCompat = /^compat$/i.test(process.env.mode);
const fwEngine = getModulePath('engine', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const fwShadow = getModulePath('synthetic-shadow', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const globalModules = {
lwc: 'LWC',
};
module.exports = {
input: path.resolve('src/index.js'),
external: id => id in globalModules,
output: {
file: path.resolve('build/app.js'),
format: 'iife',
globals: globalModules,
sourcemap: !isCompat,
},
plugins: [
lwcCompiler({
rootDir: path.join(__dirname, 'src/modules'),
const isProd = /prod/.test(mode);
const engineModeFile = getModulePath(
'engine',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const shadowModeFile = getModulePath(
'synthetic-shadow',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const wireServicePath = getModulePath(
'wire-service',
'iife',
isCompat ? 'es5' : 'es2017',
isProd ? 'prod' : 'dev'
);
const todoPath = path.join(require.resolve('../src/shared/todo.js'));
const testSufix = '.test.js';
const testPrefix = 'test-';
const functionalTestDir = path.join(__dirname, '../', 'src/components');
const functionalTests = fs.readdirSync(functionalTestDir);
const testOutput = path.join(__dirname, '../', 'public');
const testSharedOutput = path.join(testOutput, 'shared');
const testEntries = functionalTests.reduce((seed, functionalFolder) => {
const path = require('path');
const lwcCompiler = require('@lwc/rollup-plugin');
const replace = require('rollup-plugin-replace');
const copy = require('rollup-plugin-copy');
const { getModulePath } = require('lwc');
const isCompat = /^compat$/i.test(process.env.mode);
const fwEngine = getModulePath('engine', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const fwShadow = getModulePath('synthetic-shadow', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const globalModules = {
lwc: 'LWC',
};
module.exports = {
input: path.resolve('src/index.js'),
external: id => id in globalModules,
output: {
file: path.resolve('build/app.js'),
format: 'iife',
globals: globalModules,
sourcemap: !isCompat,
},
plugins: [
lwcCompiler({
module.exports = (options = {}) => {
const { isCompat } = options;
const outputDir = path.join(__dirname, './../build/engine');
const engine = getModulePath('engine', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const wire = getModulePath('wire-service', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
fs.ensureDirSync(outputDir);
fs.copyFileSync(engine, path.join(outputDir, 'engine.js'));
fs.copyFileSync(wire, path.join(outputDir, 'wire.js'));
fs.writeFileSync(
path.join(outputDir, 'downgrade.js'),
compatPolyfills.loadDowngrade()
);
fs.writeFileSync(
path.join(outputDir, 'polyfills.js'),
compatPolyfills.loadPolyfills()
);
};
*/
'use strict';
const path = require('path');
const { getModulePath } = require('lwc');
const karmaPluginLwc = require('../karma-plugins/lwc');
const karmaPluginEnv = require('../karma-plugins/env');
const babelIstanbulInstrumenter = require('../karma-plugins/babel-istanbul-instrumenter');
const BASE_DIR = path.resolve(__dirname, '../../test');
const COVERAGE_DIR = path.resolve(__dirname, '../../coverage');
const SHADOW_POLYFILL = getModulePath('synthetic-shadow', 'iife', 'es2017', 'dev');
const SHADOW_POLYFILL_COMPAT = getModulePath('synthetic-shadow', 'iife', 'es5', 'dev');
const LWC_ENGINE = getModulePath('engine', 'iife', 'es2017', 'dev');
const LWC_ENGINE_COMPAT = getModulePath('engine', 'iife', 'es5', 'dev');
const WIRE_SERVICE = getModulePath('wire-service', 'iife', 'es2017', 'dev');
const WIRE_SERVICE_COMPAT = getModulePath('wire-service', 'iife', 'es5', 'dev');
const POLYFILL_COMPAT = require.resolve('es5-proxy-compat/polyfills.js');
const TEST_UTILS = require.resolve('../../helpers/test-utils');
function createPattern(location, config = {}) {
return {
...config,
pattern: location,
};
}
function getLwcConfig(config) {
const compat = Boolean(config.compat);
'use strict';
const path = require('path');
const { getModulePath } = require('lwc');
const karmaPluginLwc = require('../karma-plugins/lwc');
const karmaPluginEnv = require('../karma-plugins/env');
const babelIstanbulInstrumenter = require('../karma-plugins/babel-istanbul-instrumenter');
const BASE_DIR = path.resolve(__dirname, '../../test');
const COVERAGE_DIR = path.resolve(__dirname, '../../coverage');
const SHADOW_POLYFILL = getModulePath('synthetic-shadow', 'iife', 'es2017', 'dev');
const SHADOW_POLYFILL_COMPAT = getModulePath('synthetic-shadow', 'iife', 'es5', 'dev');
const LWC_ENGINE = getModulePath('engine', 'iife', 'es2017', 'dev');
const LWC_ENGINE_COMPAT = getModulePath('engine', 'iife', 'es5', 'dev');
const WIRE_SERVICE = getModulePath('wire-service', 'iife', 'es2017', 'dev');
const WIRE_SERVICE_COMPAT = getModulePath('wire-service', 'iife', 'es5', 'dev');
const POLYFILL_COMPAT = require.resolve('es5-proxy-compat/polyfills.js');
const TEST_UTILS = require.resolve('../../helpers/test-utils');
function createPattern(location, config = {}) {
return {
...config,
pattern: location,
};
}
function getLwcConfig(config) {
const compat = Boolean(config.compat);
const nativeShadow = Boolean(config.nativeShadow);
const path = require('path');
const { getModulePath } = require('lwc');
const karmaPluginLwc = require('../karma-plugins/lwc');
const karmaPluginEnv = require('../karma-plugins/env');
const babelIstanbulInstrumenter = require('../karma-plugins/babel-istanbul-instrumenter');
const BASE_DIR = path.resolve(__dirname, '../../test');
const COVERAGE_DIR = path.resolve(__dirname, '../../coverage');
const SHADOW_POLYFILL = getModulePath('synthetic-shadow', 'iife', 'es2017', 'dev');
const SHADOW_POLYFILL_COMPAT = getModulePath('synthetic-shadow', 'iife', 'es5', 'dev');
const LWC_ENGINE = getModulePath('engine', 'iife', 'es2017', 'dev');
const LWC_ENGINE_COMPAT = getModulePath('engine', 'iife', 'es5', 'dev');
const WIRE_SERVICE = getModulePath('wire-service', 'iife', 'es2017', 'dev');
const WIRE_SERVICE_COMPAT = getModulePath('wire-service', 'iife', 'es5', 'dev');
const POLYFILL_COMPAT = require.resolve('es5-proxy-compat/polyfills.js');
const TEST_UTILS = require.resolve('../../helpers/test-utils');
function createPattern(location, config = {}) {
return {
...config,
pattern: location,
};
}
function getLwcConfig(config) {
const compat = Boolean(config.compat);
const nativeShadow = Boolean(config.nativeShadow);
const tags = [`${nativeShadow ? 'native' : 'synthetic'}-shadow`, compat && 'compat'].filter(
'use strict';
const path = require('path');
const { getModulePath } = require('lwc');
const karmaPluginLwc = require('../karma-plugins/lwc');
const karmaPluginEnv = require('../karma-plugins/env');
const babelIstanbulInstrumenter = require('../karma-plugins/babel-istanbul-instrumenter');
const BASE_DIR = path.resolve(__dirname, '../../test');
const COVERAGE_DIR = path.resolve(__dirname, '../../coverage');
const SHADOW_POLYFILL = getModulePath('synthetic-shadow', 'iife', 'es2017', 'dev');
const SHADOW_POLYFILL_COMPAT = getModulePath('synthetic-shadow', 'iife', 'es5', 'dev');
const LWC_ENGINE = getModulePath('engine', 'iife', 'es2017', 'dev');
const LWC_ENGINE_COMPAT = getModulePath('engine', 'iife', 'es5', 'dev');
const WIRE_SERVICE = getModulePath('wire-service', 'iife', 'es2017', 'dev');
const WIRE_SERVICE_COMPAT = getModulePath('wire-service', 'iife', 'es5', 'dev');
const POLYFILL_COMPAT = require.resolve('es5-proxy-compat/polyfills.js');
const TEST_UTILS = require.resolve('../../helpers/test-utils');
function createPattern(location, config = {}) {
return {
...config,
pattern: location,
};
}
function getLwcConfig(config) {
const compat = Boolean(config.compat);
const nativeShadow = Boolean(config.nativeShadow);
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
'use strict';
const path = require('path');
const { getModulePath } = require('lwc');
const karmaPluginLwc = require('../karma-plugins/lwc');
const karmaPluginEnv = require('../karma-plugins/env');
const babelIstanbulInstrumenter = require('../karma-plugins/babel-istanbul-instrumenter');
const BASE_DIR = path.resolve(__dirname, '../../test');
const COVERAGE_DIR = path.resolve(__dirname, '../../coverage');
const SHADOW_POLYFILL = getModulePath('synthetic-shadow', 'iife', 'es2017', 'dev');
const SHADOW_POLYFILL_COMPAT = getModulePath('synthetic-shadow', 'iife', 'es5', 'dev');
const LWC_ENGINE = getModulePath('engine', 'iife', 'es2017', 'dev');
const LWC_ENGINE_COMPAT = getModulePath('engine', 'iife', 'es5', 'dev');
const WIRE_SERVICE = getModulePath('wire-service', 'iife', 'es2017', 'dev');
const WIRE_SERVICE_COMPAT = getModulePath('wire-service', 'iife', 'es5', 'dev');
const POLYFILL_COMPAT = require.resolve('es5-proxy-compat/polyfills.js');
const TEST_UTILS = require.resolve('../../helpers/test-utils');
function createPattern(location, config = {}) {
return {
...config,
pattern: location,
};
}