UNPKG

@communities-webruntime/services

Version:

If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).

42 lines 1.38 kB
"use strict"; /** @hidden */ /** * Copyright (c) 2019, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ Object.defineProperty(exports, "__esModule", { value: true }); const MESSAGE_CHANNEL_PREFIX = '@salesforce/messageChannel/'; const MESSAGE_CHANNEL_MODULE_CODE = ` import { createMessageChannel } from 'lightning/messageService'; export default createMessageChannel(); `; /** * Check whether the given id is a @salesforce/messageChannel scoped module id */ function isMessageChannelScopedModule(id) { return id && id.startsWith(MESSAGE_CHANNEL_PREFIX); } /** * Rollup plugin that resolves @salesforce/messageChannel */ function plugin() { return { name: 'rollup-plugin-salesforce-message-channel', /** * Return * 1. the code of an ES6 module to create a message channel * or * 2. null if the id is not a message channel scope module id */ load(id) { return isMessageChannelScopedModule(id) ? MESSAGE_CHANNEL_MODULE_CODE : null; }, resolveId(id) { return isMessageChannelScopedModule(id) ? id : null; }, }; } exports.default = plugin; //# sourceMappingURL=rollup-plugin-salesforce-message-channel.js.map