UNPKG

atlassian-webresource-webpack-plugin

Version:

Auto-generates web-resource definitions from your webpacked code, for usage in an Atlassian product or plugin.

29 lines 1.33 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = __importDefault(require("path")); const EmptyExportsModule_1 = __importDefault(require("./EmptyExportsModule")); class WrmResourceModule extends EmptyExportsModule_1.default { constructor(resourceNameAndLocationPair, target, requestContext, rootContext) { super(resourceNameAndLocationPair, target); const resourcePair = resourceNameAndLocationPair.split('!'); let resPath = resourcePair[1]; // enable relative resource-paths. Still requires that this resource is correctly copied to the right location in target. if (resPath.startsWith('./') || resPath.startsWith('../')) { const fullResourcePath = path_1.default.join(requestContext, resPath); resPath = path_1.default.relative(rootContext, fullResourcePath); } this._resource = [resourcePair[0], resPath]; } getResourcePair() { return this._resource; } getResource() { const [name, location] = this._resource; return { name, location }; } } exports.default = WrmResourceModule; //# sourceMappingURL=WrmResourceModule.js.map