@polylith/builder 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +4 -1
- package/package.json +1 -1
- package/plugin-jsconfig.js +9 -0
package/App.js
CHANGED
|
@@ -5,6 +5,8 @@ import * as rollup from 'rollup';
|
|
|
5
5
|
import { babel } from '@rollup/plugin-babel';
|
|
6
6
|
import * as resolve from '@rollup/plugin-node-resolve';
|
|
7
7
|
import commonjs from '@rollup/plugin-commonjs';
|
|
8
|
+
import rollupJson from "@rollup/plugin-json"
|
|
9
|
+
|
|
8
10
|
import html from 'rollup-plugin-html';
|
|
9
11
|
import livereload from 'rollup-plugin-livereload';
|
|
10
12
|
import styles from "rollup-plugin-styles";
|
|
@@ -537,10 +539,12 @@ export default class App {
|
|
|
537
539
|
this.templateVariables['codeVariables'] = codeVariables;
|
|
538
540
|
|
|
539
541
|
var plugins = [
|
|
542
|
+
jsconfig(this.root),
|
|
540
543
|
resolve.nodeResolve({
|
|
541
544
|
extensions: ['.js', '.jsx']
|
|
542
545
|
}),
|
|
543
546
|
commonjs(),
|
|
547
|
+
rollupJson(),
|
|
544
548
|
babel({
|
|
545
549
|
presets: ['@babel/preset-react'],
|
|
546
550
|
babelHelpers: 'bundled',
|
|
@@ -548,7 +552,6 @@ export default class App {
|
|
|
548
552
|
loadConfigs(this.configs),
|
|
549
553
|
loader(this.loadables),
|
|
550
554
|
features(this.featureIndexes),
|
|
551
|
-
jsconfig(this.root),
|
|
552
555
|
html({
|
|
553
556
|
include: path.join(this.sourcePath, "**/*.html"),
|
|
554
557
|
}),
|
package/package.json
CHANGED
package/plugin-jsconfig.js
CHANGED
|
@@ -61,6 +61,10 @@ async function findPathMatch(base, source, paths) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
function isRelative(name) {
|
|
65
|
+
return name.slice(0, 2) === './' || name.slice(0, 3) === '../';
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
export default function jsconfig(root) {
|
|
65
69
|
var jsConfig;
|
|
66
70
|
var basePath;
|
|
@@ -99,6 +103,8 @@ export default function jsconfig(root) {
|
|
|
99
103
|
if (jsConfig === undefined) await readJsConfig();
|
|
100
104
|
if (!jsConfig) return null;
|
|
101
105
|
|
|
106
|
+
if (isRelative(source)) return null;
|
|
107
|
+
|
|
102
108
|
if (basePath) {
|
|
103
109
|
var tryName = path.join(root, basePath, source);
|
|
104
110
|
if (await fileExists(tryName)) {
|
|
@@ -106,6 +112,9 @@ export default function jsconfig(root) {
|
|
|
106
112
|
return tryName;
|
|
107
113
|
}
|
|
108
114
|
}
|
|
115
|
+
|
|
116
|
+
if (source[0] === '/') return null;
|
|
117
|
+
|
|
109
118
|
if (paths) {
|
|
110
119
|
if (source.indexOf(root) === 0) return null;
|
|
111
120
|
|