Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 39cb24d

Browse files
authoredFeb 21, 2020
Merge pull request #1127 from NativeScript/vmutafov/kotlinjs
feat: Add initial support for KotlinJS
2 parents 661c3c4 + a04c0f8 commit 39cb24d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed
 

Diff for: ‎bundle-config-loader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getOptions } from "loader-utils";
44
import * as escapeRegExp from "escape-string-regexp";
55

66
// Matches all source, markup and style files that are not in App_Resources and in tests folder
7-
const defaultMatch = "(?<!\\bApp_Resources\\b.*)(?<!\\.\\/\\btests\\b\\/.*?)\\.(xml|css|js|(?<!\\.d\\.)ts|(?<!\\b_[\\w-]*\\.)scss)$";
7+
const defaultMatch = "(?<!\\bApp_Resources\\b.*)(?<!\\.\\/\\btests\\b\\/.*?)\\.(xml|css|js|kt|(?<!\\.d\\.)ts|(?<!\\b_[\\w-]*\\.)scss)$";
88

99
const loader: loader.Loader = function (source, map) {
1010
let {

Diff for: ‎index.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ exports.getEntryModule = function (appDirectory, platform) {
7979
const entry = getPackageJsonEntry(appDirectory);
8080

8181
const tsEntryPath = path.resolve(appDirectory, `${entry}.ts`);
82+
const ktEntryPath = path.resolve(appDirectory, `${entry}.kt`);
8283
const jsEntryPath = path.resolve(appDirectory, `${entry}.js`);
83-
let entryExists = existsSync(tsEntryPath) || existsSync(jsEntryPath);
84+
let entryExists = existsSync(tsEntryPath) || existsSync(ktEntryPath) || existsSync(jsEntryPath);
8485
if (!entryExists && platform) {
8586
const platformTsEntryPath = path.resolve(appDirectory, `${entry}.${platform}.ts`);
87+
const platformKtEntryPath = path.resolve(appDirectory, `${entry}.${platform}.kt`);
8688
const platformJsEntryPath = path.resolve(appDirectory, `${entry}.${platform}.js`);
87-
entryExists = existsSync(platformTsEntryPath) || existsSync(platformJsEntryPath);
89+
entryExists = existsSync(platformTsEntryPath) || existsSync(platformKtEntryPath) || existsSync(platformJsEntryPath);
8890
}
8991

9092
if (!entryExists) {
@@ -208,7 +210,7 @@ function getPackageJsonEntry(appDirectory) {
208210
throw new Error(`${appDirectory}/package.json must contain a 'main' attribute!`);
209211
}
210212

211-
return entry.replace(/\.js$/i, "");
213+
return entry.replace(/\.js$/i, "").replace(/\.kt$/i, "");
212214
}
213215

214216
function verifyEntryModuleDirectory(appDirectory) {

0 commit comments

Comments
 (0)