From df0f79ea03d03ab72c450d7308a92ad6b164b2c7 Mon Sep 17 00:00:00 2001 From: OJ Kwon Date: Fri, 13 Jul 2018 22:31:46 -0700 Subject: [PATCH] feat(cli): experimental compile cache --- package-lock.json | 3 +-- package.json | 3 ++- src/cli.ts | 1 - src/verbose.ts | 9 ++++++++- webpack.config.ts | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index e657c19..6c8314e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12996,8 +12996,7 @@ "v8-compile-cache": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.0.tgz", - "integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==", - "dev": true + "integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==" }, "validate-npm-package-license": { "version": "3.0.3", diff --git a/package.json b/package.json index e679a8c..901694e 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,8 @@ "get-stdin": "^6.0.0", "source-map-support": "^0.5.6", "tslib": "^1.9.3", - "unixify": "^1.0.0" + "unixify": "^1.0.0", + "v8-compile-cache": "^2.0.0" }, "devDependencies": { "@commitlint/cli": "^7.0.0", diff --git a/src/cli.ts b/src/cli.ts index 9eaf887..5612a71 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -9,7 +9,6 @@ import { OutputStyle } from './index'; import { buildContext } from './interop/context'; import { SassOptionsInterface } from './interop/options/sassOptions'; import { SassContextInterface } from './interop/sassContext'; -import './verbose'; const d = debug('libsass:cli'); const styleOptions = ['nested', 'expanded', 'compact', 'compressed']; diff --git a/src/verbose.ts b/src/verbose.ts index fdae9ea..0582124 100644 --- a/src/verbose.ts +++ b/src/verbose.ts @@ -1,8 +1,15 @@ -/** side effect module to enable few verbose logging */ +/** + * side effect module to enable few verbose logging. + * This is actual entry point to cli, loads necessary modules up front. + */ /* tslint:disable:no-var-requires no-require-imports */ +require('v8-compile-cache'); + if (!!process.env.DEBUG) { require('source-map-support').install(); const { log, enableLogger } = require('./util/logger'); enableLogger(require('debug')('libsass:logger')); log('Enabling verbose log'); } + +require('./cli'); diff --git a/webpack.config.ts b/webpack.config.ts index 462bf58..5fb5847 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -4,7 +4,7 @@ import * as webpack from 'webpack'; module.exports = { mode: 'production', - entry: './src/cli.ts', + entry: './src/verbose.ts', devtool: 'source-map', output: {