How to use compat-polyfills - 6 common examples

To help you get started, we’ve selected a few compat-polyfills examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / lwc / packages / integration-tests / scripts / build.js View on Github external
const baseOutputConfig = { format: 'iife', globals: globalModules };

// -- Build shared artifacts -----------------------------------------------------

if (!fs.existsSync(engineModeFile)) {
    throw new Error(
        'Compat version of engine not generated in expected location: ' +
            engineModeFile +
            '.\nGenerate artifacts from the top-level Lightning Web Components project first'
    );
}

// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput, 'engine.js'));
fs.copySync(shadowModeFile, path.join(testSharedOutput, 'shadow.js'));
fs.writeFileSync(path.join(testSharedOutput, 'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput, 'polyfills.js'), compatPolyfills.loadPolyfills());

fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));

// -- Build component tests -----------------------------------------------------=

testEntries
    .reduce(async (promise, test) => {
        await promise;
        const { name: testName, path: testEntry, namespace: testNamespace } = test;
        console.log(`Building integration test: ${testName}`);
        const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });

        await bundle.write({
            ...baseOutputConfig,
github salesforce / lwc / packages / integration-tests / scripts / build.js View on Github external
// -- Build shared artifacts -----------------------------------------------------

if (!fs.existsSync(engineModeFile)) {
    throw new Error(
        'Compat version of engine not generated in expected location: ' +
            engineModeFile +
            '.\nGenerate artifacts from the top-level Lightning Web Components project first'
    );
}

// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput, 'engine.js'));
fs.copySync(shadowModeFile, path.join(testSharedOutput, 'shadow.js'));
fs.writeFileSync(path.join(testSharedOutput, 'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput, 'polyfills.js'), compatPolyfills.loadPolyfills());

fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));

// -- Build component tests -----------------------------------------------------=

testEntries
    .reduce(async (promise, test) => {
        await promise;
        const { name: testName, path: testEntry, namespace: testNamespace } = test;
        console.log(`Building integration test: ${testName}`);
        const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });

        await bundle.write({
            ...baseOutputConfig,
            file: `${testOutput}/${testNamespace}/${testName}/${testName}.js`,
github salesforce / lwc / packages / lwc-integration / scripts / build.js View on Github external
testCaseComponentResolverPlugin(),
    ].filter(Boolean)
};

const baseOutputConfig = { format: 'iife', globals: globalModules };

// -- Build shared artifacts -----------------------------------------------------

if (!fs.existsSync(engineModeFile)) {
    throw new Error("Compat version of engine not generated in expected location: " + engineModeFile
        + ".\nGenerate artifacts from the top-level Raptor project first");
}

// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput,'engine.js'));
fs.writeFileSync(path.join(testSharedOutput,'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput,'polyfills.js'), compatPolyfills.loadPolyfills());

fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));

// -- Build component tests -----------------------------------------------------=

testEntries.reduce(async (promise, test) => {
    await promise;
    const { name: testName, path: testEntry, namespace: testNamespace } = test;
    console.log(`Building integration test: ${testName}`);
    const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });

    const result = await bundle.write({
        ...baseOutputConfig,
        file: `${testOutput}/${testNamespace}/${testName}/${testName}.js`
github salesforce / lwc / packages / lwc-integration / scripts / build.js View on Github external
].filter(Boolean)
};

const baseOutputConfig = { format: 'iife', globals: globalModules };

// -- Build shared artifacts -----------------------------------------------------

if (!fs.existsSync(engineModeFile)) {
    throw new Error("Compat version of engine not generated in expected location: " + engineModeFile
        + ".\nGenerate artifacts from the top-level Raptor project first");
}

// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput,'engine.js'));
fs.writeFileSync(path.join(testSharedOutput,'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput,'polyfills.js'), compatPolyfills.loadPolyfills());

fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));

// -- Build component tests -----------------------------------------------------=

testEntries.reduce(async (promise, test) => {
    await promise;
    const { name: testName, path: testEntry, namespace: testNamespace } = test;
    console.log(`Building integration test: ${testName}`);
    const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });

    const result = await bundle.write({
        ...baseOutputConfig,
        file: `${testOutput}/${testNamespace}/${testName}/${testName}.js`
    });
github salesforce / lwc-test / packages / wdio-lwc-service / scripts / copy-engine-files.js View on Github external
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()
    );
};
github salesforce / lwc-test / packages / wdio-lwc-service / scripts / copy-engine-files.js View on Github external
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()
    );
};

compat-polyfills

Polyfills required for COMPAT

MIT
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages