vite-plugin-stimulus-hmr
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -5,14 +5,12 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/index.ts | ||
var debug = _debug2.default.call(void 0, "stimulus:hmr"); | ||
function isSSR(options) { | ||
return typeof options === "object" ? options.ssr : options; | ||
} | ||
function StimulusHMRPlugin({appGlobal = "$$StimulusApp$$"} = {}) { | ||
let shouldSkip = false; | ||
return { | ||
name: "stimulus:hmr", | ||
configResolved(config) { | ||
shouldSkip = config.command === "build" || config.isProduction; | ||
}, | ||
transform(code, id, ssr) { | ||
if (shouldSkip || ssr) | ||
apply: "serve", | ||
transform(code, id, options) { | ||
if (isSSR(options) || id.includes("node_modules")) | ||
return; | ||
if (id.includes("node_modules")) | ||
return; | ||
const appRegex = /\n[^\n]*?\s(\w+)(?:\s*=\s*Application\.start\(\))/; | ||
@@ -19,0 +17,0 @@ const appVariable = (code.match(appRegex) || [])[1]; |
{ | ||
"name": "vite-plugin-stimulus-hmr", | ||
"description": "HMR for Stimulus controllers in Vite.js, tweak your JS without refreshing the page.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/index.js", | ||
@@ -39,7 +39,8 @@ "module": "dist/index.mjs", | ||
"release": "nr clean && nr build && npm publish", | ||
"postpublish" : "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags" | ||
"prepublishOnly": "npm run build", | ||
"postpublish": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.3.1", | ||
"stimulus-vite-helpers": "^1.0" | ||
"stimulus-vite-helpers": "^1.0.4" | ||
}, | ||
@@ -57,4 +58,4 @@ "devDependencies": { | ||
"typescript": "^4.1.3", | ||
"vite": "^2.0.0-beta.69" | ||
"vite": "^2.6.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
11026
8
119
Updatedstimulus-vite-helpers@^1.0.4