@rocket.chat/apps-compiler
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -11,2 +11,3 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const fallbackTypescript = __importStar(require("typescript")); | ||
@@ -24,3 +25,3 @@ const module_1 = require("module"); | ||
this.sourcePath = sourcePath; | ||
this.validator = new AppsEngineValidator_1.AppsEngineValidator(module_1.createRequire(`${sourcePath}/app.json`)); | ||
this.validator = new AppsEngineValidator_1.AppsEngineValidator(module_1.createRequire(path.join(sourcePath, 'app.json'))); | ||
this.typescriptCompiler = new TypescriptCompiler_1.TypescriptCompiler(sourcePath, ts, this.validator); | ||
@@ -27,0 +28,0 @@ this.bundler = bundler_1.default(bundler_1.AvailableBundlers.esbuild); |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -6,7 +13,11 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const os = __importStar(require("os")); | ||
const path_1 = __importDefault(require("path")); | ||
const esbuild_1 = require("esbuild"); | ||
const isWin = os.platform() === 'win32'; | ||
function normalizeAppModulePath(modulePath, parentDir) { | ||
return /\.\.?\//.test(modulePath) | ||
? path_1.default.resolve('/', path_1.default.dirname(parentDir), modulePath).substring(1).concat('.js') | ||
? isWin | ||
? path_1.default.join(path_1.default.dirname(parentDir), modulePath).concat('.js') | ||
: path_1.default.resolve('/', path_1.default.dirname(parentDir), modulePath).substring(1).concat('.js') | ||
: modulePath; | ||
@@ -41,8 +52,19 @@ } | ||
const modulePath = normalizeAppModulePath(args.path, args.importer); | ||
if (r.files[modulePath]) { | ||
const modulePathReplaced = modulePath.replace(':\\', ''); | ||
const hasFile = !!r.files[modulePathReplaced]; | ||
if (hasFile) { | ||
return { | ||
namespace: 'app-source', | ||
path: modulePath, | ||
path: modulePathReplaced, | ||
}; | ||
} | ||
if (/\.\.?\//.test(args.path)) { | ||
const indexModulePath = modulePath.replace(/\.js$/, `${path_1.default.sep}index.js`); | ||
if (r.files[indexModulePath]) { | ||
return { | ||
namespace: 'app-source', | ||
path: indexModulePath, | ||
}; | ||
} | ||
} | ||
const nodeModulePath = validator.resolveAppDependencyPath(args.path); | ||
@@ -49,0 +71,0 @@ if (!/@rocket\.chat\/apps-engine/.test(args.path) && path_1.default.isAbsolute(nodeModulePath)) { |
{ | ||
"name": "@rocket.chat/apps-compiler", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "The Rocket.Chat apps compiler", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58435
1342