Comparing version 0.16.2 to 0.17.0
@@ -0,1 +1,11 @@ | ||
## 0.17.0 | ||
- Major rework on CSS plugin | ||
- Support for resolving imports and URLs in CSS | ||
- Fix wrong source map in CSS | ||
- Added method to get CSS content out of CSS files | ||
- Support for importing values from other CSS files | ||
- CSS plugin now updates the exported object on hot reload | ||
- New option [`includeDefaultPlugins`](/docs/configurations.md#includedefaultplugins) | ||
- Updated dependencies | ||
## 0.16.2 | ||
@@ -2,0 +12,0 @@ - Fixed alias resolving |
@@ -41,3 +41,4 @@ const debug = (...data) => debugMode && console.log(...data); | ||
}); | ||
Reboost.reload = () => debugMode ? console.log('TRIGGER RELOAD') : self.location.reload(); | ||
// eslint-disable-next-line no-constant-condition | ||
Reboost.reload = () => (false && debugMode) ? console.log('TRIGGER RELOAD') : self.location.reload(); | ||
const aSelf = self; | ||
@@ -44,0 +45,0 @@ if (!aSelf.process) { |
@@ -9,8 +9,6 @@ "use strict"; | ||
name: 'core-loader-plugin', | ||
load(filePath) { | ||
return { | ||
code: fs_1.default.readFileSync(filePath).toString(), | ||
type: path_1.default.extname(filePath).substring(1) | ||
}; | ||
} | ||
load: (filePath) => ({ | ||
code: fs_1.default.readFileSync(filePath).toString(), | ||
type: path_1.default.extname(filePath).substring(1) | ||
}) | ||
}); |
@@ -109,2 +109,4 @@ /// <reference types="babel__traverse" /> | ||
entries: ([string, string] | [string, string, string])[]; | ||
/** Use plugins included by default */ | ||
includeDefaultPlugins?: boolean; | ||
/** Options for logging */ | ||
@@ -111,0 +113,0 @@ log?: false | { |
@@ -21,3 +21,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./plugins/removed"), exports); | ||
const INCOMPATIBLE_BELOW = '0.13.0'; | ||
const INCOMPATIBLE_BELOW = '0.17.0'; | ||
const DEFAULT_PORT = 7456; | ||
@@ -34,2 +34,3 @@ exports.DefaultConfig = { | ||
entries: null, | ||
includeDefaultPlugins: true, | ||
log: { | ||
@@ -157,9 +158,11 @@ info: true, | ||
it.plugins.push(...core_plugins_1.CorePlugins(it)); | ||
const pluginNames = it.plugins.map(({ name }) => name); | ||
if (!pluginNames.includes(esbuild_1.PluginName)) { | ||
it.plugins.push(esbuild_1.esbuildPlugin()); | ||
if (it.config.includeDefaultPlugins) { | ||
const pluginNames = it.plugins.map(({ name }) => name); | ||
if (!pluginNames.includes(esbuild_1.PluginName)) { | ||
it.plugins.push(esbuild_1.esbuildPlugin()); | ||
} | ||
if (!pluginNames.includes(css_1.PluginName)) { | ||
it.plugins.unshift(css_1.CSSPlugin()); | ||
} | ||
} | ||
if (!pluginNames.includes(css_1.PluginName)) { | ||
it.plugins.unshift(css_1.CSSPlugin()); | ||
} | ||
// Cache initialization | ||
@@ -272,5 +275,3 @@ it.cache = cache_1.initCache(it.config, it.plugins); | ||
if (contentServer) { | ||
const contentServerPath = (host, port) => { | ||
return `http://${host}:${port}${it.config.contentServer.basePath}`.replace(/\/$/, ''); | ||
}; | ||
const contentServerPath = (host, port) => (`http://${host}:${port}${it.config.contentServer.basePath}`.replace(/\/$/, '')); | ||
const startedAt = (address) => { | ||
@@ -277,0 +278,0 @@ it.log('info', chalk_1.default.green(`Content server started at: ${address}`)); |
@@ -79,3 +79,3 @@ "use strict"; | ||
try { | ||
const { js, jsSourceMap, warnings } = await (await loadService()).transform(data.code, { | ||
const { code, map, warnings } = await (await loadService()).transform(data.code, { | ||
sourcemap: 'external', | ||
@@ -103,4 +103,4 @@ sourcefile: path_1.default.relative(this.config.rootDir, filePath), | ||
return { | ||
code: js, | ||
map: JSON.parse(jsSourceMap), | ||
code, | ||
map: JSON.parse(map), | ||
type: 'js' | ||
@@ -107,0 +107,0 @@ }; |
@@ -6,11 +6,9 @@ "use strict"; | ||
name: 'core-file-plugin', | ||
transformIntoJS(_, filePath) { | ||
return { | ||
code: ` | ||
const serverAddress = new URL(import.meta.absoluteUrl).origin; | ||
const fileUrl = new URL('/raw?q=${encodeURIComponent(filePath)}', serverAddress); | ||
export default fileUrl; | ||
` | ||
}; | ||
} | ||
transformIntoJS: (_, filePath) => ({ | ||
code: ` | ||
const serverAddress = new URL(import.meta.absoluteUrl).origin; | ||
const fileUrl = new URL('/raw?q=${encodeURIComponent(filePath)}', serverAddress); | ||
export default fileUrl; | ||
` | ||
}) | ||
}); |
@@ -1,2 +0,2 @@ | ||
export { CSSPlugin } from './css'; | ||
export { CSSPlugin } from './css/index'; | ||
export { esbuildPlugin } from './esbuild'; | ||
@@ -6,3 +6,3 @@ export { FilePlugin } from './file'; | ||
export { UsePlugin } from './use'; | ||
import { CSSPluginOptions } from './css'; | ||
import { CSSPluginOptions } from './css/index'; | ||
import { esbuildPluginOptions } from './esbuild'; | ||
@@ -9,0 +9,0 @@ import { UsePluginOptions } from './use'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UsePlugin = exports.ReplacePlugin = exports.FilePlugin = exports.esbuildPlugin = exports.CSSPlugin = void 0; | ||
var css_1 = require("./css"); | ||
Object.defineProperty(exports, "CSSPlugin", { enumerable: true, get: function () { return css_1.CSSPlugin; } }); | ||
var index_1 = require("./css/index"); | ||
Object.defineProperty(exports, "CSSPlugin", { enumerable: true, get: function () { return index_1.CSSPlugin; } }); | ||
var esbuild_1 = require("./esbuild"); | ||
@@ -7,0 +7,0 @@ Object.defineProperty(exports, "esbuildPlugin", { enumerable: true, get: function () { return esbuild_1.esbuildPlugin; } }); |
@@ -22,5 +22,3 @@ "use strict"; | ||
const plugins = Array.isArray(options.use) ? options.use : [options.use]; | ||
const getHooks = (hookName) => { | ||
return plugins.map((plugin) => plugin[hookName]).filter(def); | ||
}; | ||
const getHooks = (hookName) => (plugins.map((plugin) => plugin[hookName]).filter(def)); | ||
const setupHooks = getHooks('setup'); | ||
@@ -103,4 +101,2 @@ const stopHooks = getHooks('stop'); | ||
}; | ||
exports.UsePlugin = (...options) => { | ||
return options.map(createPlugin); | ||
}; | ||
exports.UsePlugin = (...options) => (options.map(createPlugin)); |
@@ -37,3 +37,3 @@ "use strict"; | ||
if (source.startsWith('#/')) { | ||
finalPath = source.replace(/^#/, ''); | ||
finalPath = source.substring(1); | ||
routed = true; | ||
@@ -45,3 +45,3 @@ } | ||
if (resolvedPath.startsWith('#/')) { | ||
finalPath = resolvedPath.replace(/^#/, ''); | ||
finalPath = resolvedPath.substring(1); | ||
routed = true; | ||
@@ -48,0 +48,0 @@ } |
@@ -17,5 +17,3 @@ "use strict"; | ||
if (!pluginHooksMap.has(instance)) { | ||
const getHooks = (hookName) => { | ||
return instance.plugins.map((plugin) => plugin[hookName]).filter((a) => !!a); | ||
}; | ||
const getHooks = (hookName) => (instance.plugins.map((plugin) => plugin[hookName]).filter((a) => !!a)); | ||
pluginHooksMap.set(instance, { | ||
@@ -22,0 +20,0 @@ stopHooks: getHooks('stop'), |
@@ -17,6 +17,6 @@ "use strict"; | ||
instance.onStop("Closes proxy server's file watcher", () => watcher.close()); | ||
const rootRelative = (filePath) => path_1.default.relative(instance.config.rootDir, filePath); | ||
const formatPath = (filePath) => path_1.default.relative(instance.config.rootDir, filePath).replace(/\\/g, '/'); | ||
watcher.on('change', (filePath) => { | ||
filePath = path_1.default.normalize(filePath); | ||
instance.log('info', chalk_1.default.blue(`${utils_1.getTimestamp()} Changed: ${rootRelative(filePath)}`)); | ||
instance.log('info', chalk_1.default.blue(`${utils_1.getTimestamp()} Changed: ${formatPath(filePath)}`)); | ||
if (!dependentsMap.has(filePath)) | ||
@@ -34,3 +34,3 @@ return; | ||
filePath = path_1.default.normalize(filePath); | ||
instance.log('info', chalk_1.default.blue(`${utils_1.getTimestamp()} Deleted: ${rootRelative(filePath)}`)); | ||
instance.log('info', chalk_1.default.blue(`${utils_1.getTimestamp()} Deleted: ${formatPath(filePath)}`)); | ||
if (!dependentsMap.has(filePath)) | ||
@@ -59,3 +59,3 @@ return; | ||
watcher.add(dependency); | ||
instance.log('watchList', chalk_1.default.blue(`Watching ${rootRelative(dependency)}`)); | ||
instance.log('watchList', chalk_1.default.blue(`Watching ${formatPath(dependency)}`)); | ||
} | ||
@@ -74,3 +74,3 @@ const dependents = dependentsMap.get(dependency) || []; | ||
watcher.unwatch(dependency); | ||
instance.log('watchList', chalk_1.default.blue(`Unwatched ${rootRelative(dependency)}`)); | ||
instance.log('watchList', chalk_1.default.blue(`Unwatched ${formatPath(dependency)}`)); | ||
return; | ||
@@ -77,0 +77,0 @@ } |
{ | ||
"name": "reboost", | ||
"version": "0.16.2", | ||
"version": "0.17.0", | ||
"description": "A super fast dev server for rapid web development", | ||
@@ -49,8 +49,8 @@ "main": "./dist/node/index.js", | ||
"@types/babel__traverse": "^7.0.15", | ||
"@types/koa": "^2.11.5", | ||
"@types/koa": "^2.11.6", | ||
"anymatch": "^3.1.1", | ||
"chalk": "^4.1.0", | ||
"chokidar": "^3.4.3", | ||
"enhanced-resolve": "^5.2.0", | ||
"esbuild": "^0.7.16", | ||
"enhanced-resolve": "^5.3.1", | ||
"esbuild": "^0.8.2", | ||
"icss-utils": "^5.0.0", | ||
@@ -62,6 +62,6 @@ "koa": "^2.13.0", | ||
"md5-file": "^5.0.0", | ||
"node-html-parser": "^1.3.1", | ||
"node-html-parser": "^1.4.5", | ||
"open": "^7.3.0", | ||
"portfinder": "^1.0.28", | ||
"postcss": "^8.1.1", | ||
"postcss": "^8.1.4", | ||
"postcss-modules-extract-imports": "^3.0.0", | ||
@@ -71,2 +71,3 @@ "postcss-modules-local-by-default": "^4.0.0", | ||
"postcss-modules-values": "^4.0.0", | ||
"postcss-value-parser": "^4.1.0", | ||
"source-map": "^0.7.3", | ||
@@ -78,14 +79,14 @@ "tslib": "^2.0.3", | ||
"@types/babel__code-frame": "^7.0.2", | ||
"@types/jest": "^26.0.14", | ||
"@types/jest": "^26.0.15", | ||
"@types/koa-send": "^4.1.2", | ||
"@types/koa__cors": "^3.0.2", | ||
"@types/node": "^14.11.10", | ||
"@types/puppeteer": "^3.0.2", | ||
"@types/ws": "^7.2.7", | ||
"@types/node": "^14.14.6", | ||
"@types/puppeteer": "^5.4.0", | ||
"@types/ws": "^7.2.9", | ||
"concurrently": "^5.3.0", | ||
"jest": "^26.5.3", | ||
"puppeteer": "^5.3.1", | ||
"typescript": "^4.0.3" | ||
"jest": "^26.6.2", | ||
"puppeteer": "^5.4.1", | ||
"typescript": "^4.0.5" | ||
}, | ||
"gitHead": "5833d8072df2972d2d31014043e5279567bb3428" | ||
"gitHead": "07c2bb052e142d9b84e99eb11d7155995e4e06fa" | ||
} |
@@ -105,1 +105,5 @@ <p align="center"> | ||
Licensed under the [MIT License](/LICENSE). | ||
## Thanks for your support | ||
This project is nothing without your support. If you like this project then help us by giving | ||
a star on its GitHub repository 😃 |
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
182650
72
3809
109
32
+ Addedpostcss-value-parser@^4.1.0
+ Addedesbuild@0.8.57(transitive)
- Removedesbuild@0.7.22(transitive)
Updated@types/koa@^2.11.6
Updatedenhanced-resolve@^5.3.1
Updatedesbuild@^0.8.2
Updatednode-html-parser@^1.4.5
Updatedpostcss@^8.1.4