Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 18, 2024
1 parent 3881536 commit 88ddd19
Show file tree
Hide file tree
Showing 29 changed files with 273 additions and 253 deletions.
2 changes: 1 addition & 1 deletion packages/create-monkey/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-monkey",
"version": "1.35.0",
"version": "1.36.0",
"description": "create-monkey",
"main": "index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

console.log("hello world");

})();
})();
6 changes: 3 additions & 3 deletions packages/create-monkey/template-empty-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^5.1.6",
"vite": "^4.4.8",
"vite-plugin-monkey": "^3.4.0"
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vite-plugin-monkey": "^3.5.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

console.log("hello world");

})();
})();
4 changes: 2 additions & 2 deletions packages/create-monkey/template-empty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"devDependencies": {
"vite": "^4.4.8",
"vite-plugin-monkey": "^3.4.0"
"vite": "^5.0.11",
"vite-plugin-monkey": "^3.5.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
// @author monkey
// @icon https://vitejs.dev/logo.svg
// @match https://www.google.com/
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/preact.min.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/preact.min.js
// @grant GM_addStyle
// ==/UserScript==

(e=>{const o=document.createElement("style");o.dataset.source="vite-plugin-monkey",o.textContent=e,document.head.append(o)})(" #app{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.preact:hover{filter:drop-shadow(0 0 2em #673ab8aa)}.card{padding:2em}.read-the-docs{color:#888}:root{font-family:Inter,Avenir,Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}} ");
(o=>{if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const e=document.createElement("style");e.textContent=o,document.head.append(e)})(" #app{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.preact:hover{filter:drop-shadow(0 0 2em #673ab8aa)}.card{padding:2em}.read-the-docs{color:#888}:root{font-family:Inter,Avenir,Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}} ");

(function (preact) {
'use strict';

var t, r, u, i, o$1 = 0, f = [], c = [], e = preact.options.__b, a = preact.options.__r, v = preact.options.diffed, l = preact.options.__c, m = preact.options.unmount;
var t, r, u$1, i, o = 0, f$1 = [], c = [], e = preact.options.__b, a = preact.options.__r, v = preact.options.diffed, l = preact.options.__c, m = preact.options.unmount;
function d(t2, u2) {
preact.options.__h && preact.options.__h(r, t2, o$1 || u2), o$1 = 0;
preact.options.__h && preact.options.__h(r, t2, o || u2), o = 0;
var i2 = r.__H || (r.__H = { __: [], __h: [] });
return t2 >= i2.__.length && i2.__.push({ __V: c }), i2.__[t2];
}
function h(n) {
return o$1 = 1, s(B, n);
return o = 1, s(B, n);
}
function s(n, u2, i2) {
var o2 = d(t++, 2);
Expand Down Expand Up @@ -59,7 +60,7 @@
return o2.__N || o2.__;
}
function b() {
for (var t2; t2 = f.shift(); )
for (var t2; t2 = f$1.shift(); )
if (t2.__P && t2.__H)
try {
t2.__H.__h.forEach(k), t2.__H.__h.forEach(w), t2.__H.__h = [];
Expand All @@ -72,15 +73,15 @@
}, preact.options.__r = function(n) {
a && a(n), t = 0;
var i2 = (r = n.__c).__H;
i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n2) {
i2 && (u$1 === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n2) {
n2.__N && (n2.__ = n2.__N), n2.__V = c, n2.__N = n2.i = void 0;
})) : (i2.__h.forEach(k), i2.__h.forEach(w), i2.__h = [], t = 0)), u = r;
})) : (i2.__h.forEach(k), i2.__h.forEach(w), i2.__h = [], t = 0)), u$1 = r;
}, preact.options.diffed = function(t2) {
v && v(t2);
var o2 = t2.__c;
o2 && o2.__H && (o2.__H.__h.length && (1 !== f.push(o2) && i === preact.options.requestAnimationFrame || ((i = preact.options.requestAnimationFrame) || j)(b)), o2.__H.__.forEach(function(n) {
o2 && o2.__H && (o2.__H.__h.length && (1 !== f$1.push(o2) && i === preact.options.requestAnimationFrame || ((i = preact.options.requestAnimationFrame) || j)(b)), o2.__H.__.forEach(function(n) {
n.i && (n.__H = n.i), n.__V !== c && (n.__ = n.__V), n.i = void 0, n.__V = c;
})), u = r = null;
})), u$1 = r = null;
}, preact.options.__c = function(t2, r2) {
r2.some(function(t3) {
try {
Expand Down Expand Up @@ -122,61 +123,61 @@
function B(n, t2) {
return "function" == typeof t2 ? t2(n) : t2;
}
const preactLogo = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBhcmlhLWhpZGRlbj0idHJ1ZSIgcm9sZT0iaW1nIiBjbGFzcz0iaWNvbmlmeSBpY29uaWZ5LS1sb2dvcyIgd2lkdGg9IjI3LjY4IiBoZWlnaHQ9IjMyIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0IiB2aWV3Qm94PSIwIDAgMjU2IDI5NiI+PHBhdGggZmlsbD0iIzY3M0FCOCIgZD0ibTEyOCAwbDEyOCA3My45djE0Ny44bC0xMjggNzMuOUwwIDIyMS43VjczLjl6Ij48L3BhdGg+PHBhdGggZmlsbD0iI0ZGRiIgZD0iTTM0Ljg2NSAyMjAuNDc4YzE3LjAxNiAyMS43OCA3MS4wOTUgNS4xODUgMTIyLjE1LTM0LjcwNGM1MS4wNTUtMzkuODg4IDgwLjI0LTg4LjM0NSA2My4yMjQtMTEwLjEyNmMtMTcuMDE3LTIxLjc4LTcxLjA5NS01LjE4NC0xMjIuMTUgMzQuNzA0Yy01MS4wNTUgMzkuODktODAuMjQgODguMzQ2LTYzLjIyNCAxMTAuMTI2Wm03LjI3LTUuNjhjLTUuNjQ0LTcuMjIyLTMuMTc4L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MjYgNTQuMDYgNTcuOTIzYzEwLjc1MiAxNy44NSAxMy4yMTggMzIuMDMgNy41NzQgMzkuMjU0WiI+PC9wYXRoPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0xMjcuNTUyIDE2Ny42NjdjMTAuODI3IDAgMTkuNjAzLTguNzc3IDE5LjYwMy0xOS42MDRjMC0xMC44MjYtOC43NzYtMTkuNjAzLTE5LjYwMy0xOS42MDNjLTEwLjgyNyAwLTE5LjYwNCA4Ljc3Ny0xOS42MDQgMTkuNjAzYzAgMTAuODI3IDguNzc3IDE5LjYwNCAxOS42MDQgMTkuNjA0WiI+PC9wYXRoPjwvc3ZnPg==";
var _ = 0;
function o(o2, e2, n, t2, f2, l2) {
var s2, u2, a2 = {};
for (u2 in e2)
"ref" == u2 ? s2 = e2[u2] : a2[u2] = e2[u2];
var i2 = { type: o2, props: a2, key: n, ref: s2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: --_, __source: f2, __self: l2 };
if ("function" == typeof o2 && (s2 = o2.defaultProps))
for (u2 in s2)
void 0 === a2[u2] && (a2[u2] = s2[u2]);
return preact.options.vnode && preact.options.vnode(i2), i2;
const preactLogo = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20aria-hidden='true'%20role='img'%20class='iconify%20iconify--logos'%20width='27.68'%20height='32'%20preserveAspectRatio='xMidYMid%20meet'%20viewBox='0%200%20256%20296'%3e%3cpath%20fill='%23673AB8'%20d='m128%200l128%2073.9v147.8l-128%2073.9L0%20221.7V73.9z'%3e%3c/path%3e%3cpath%20fill='%23FFF'%20d='M34.865%20220.478c17.016%2021.78%2071.095%205.185%20122.15-34.704c51.055-39.888%2080.24-88.345%2063.224-110.126c-17.017-21.78-71.095-5.184-122.15%2034.704c-51.055%2039.89-80.24%2088.346-63.224%20110.126Zm7.27-5.68c-5.644-7.222-3.178-21.402%207.573-39.253c11.322-18.797%2030.541-39.548%2054.06-57.923c23.52-18.375%2048.303-32.004%2069.281-38.442c19.922-6.113%2034.277-5.075%2039.92%202.148c5.644%207.223%203.178%2021.403-7.573%2039.254c-11.322%2018.797-30.541%2039.547-54.06%2057.923c-23.52%2018.375-48.304%2032.004-69.281%2038.441c-19.922%206.114-34.277%205.076-39.92-2.147Z'%3e%3c/path%3e%3cpath%20fill='%23FFF'%20d='M220.239%20220.478c17.017-21.78-12.169-70.237-63.224-110.126C105.96%2070.464%2051.88%2053.868%2034.865%2075.648c-17.017%2021.78%2012.169%2070.238%2063.224%20110.126c51.055%2039.889%20105.133%2056.485%20122.15%2034.704Zm-7.27-5.68c-5.643%207.224-19.998%208.262-39.92%202.148c-20.978-6.437-45.761-20.066-69.28-38.441c-23.52-18.376-42.74-39.126-54.06-57.923c-10.752-17.851-13.218-32.03-7.575-39.254c5.644-7.223%2019.999-8.261%2039.92-2.148c20.978%206.438%2045.762%2020.067%2069.281%2038.442c23.52%2018.375%2042.739%2039.126%2054.06%2057.923c10.752%2017.85%2013.218%2032.03%207.574%2039.254Z'%3e%3c/path%3e%3cpath%20fill='%23FFF'%20d='M127.552%20167.667c10.827%200%2019.603-8.777%2019.603-19.604c0-10.826-8.776-19.603-19.603-19.603c-10.827%200-19.604%208.777-19.604%2019.603c0%2010.827%208.777%2019.604%2019.604%2019.604Z'%3e%3c/path%3e%3c/svg%3e";
var f = 0;
function u(e2, t2, n, o2, i2, u2) {
var a2, c2, p = {};
for (c2 in t2)
"ref" == c2 ? a2 = t2[c2] : p[c2] = t2[c2];
var l2 = { type: e2, props: p, key: n, ref: a2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --f, __i: -1, __u: 0, __source: i2, __self: u2 };
if ("function" == typeof e2 && (a2 = e2.defaultProps))
for (c2 in a2)
void 0 === p[c2] && (p[c2] = a2[c2]);
return preact.options.vnode && preact.options.vnode(l2), l2;
}
function App() {
const [count, setCount] = h(0);
return o(preact.Fragment, {
children: [o("div", {
children: [o("a", {
return u(preact.Fragment, {
children: [u("div", {
children: [u("a", {
href: "https://vitejs.dev",
target: "_blank",
children: o("img", {
children: u("img", {
src: preactLogo,
class: "logo",
alt: "Vite logo"
})
}), o("a", {
}), u("a", {
href: "https://preactjs.com",
target: "_blank",
children: o("img", {
children: u("img", {
src: preactLogo,
class: "logo preact",
alt: "Preact logo"
})
})]
}), o("h1", {
}), u("h1", {
children: "Vite + Preact"
}), o("div", {
}), u("div", {
class: "card",
children: [o("button", {
children: [u("button", {
onClick: () => setCount((count2) => count2 + 1),
children: ["count is ", count]
}), o("p", {
children: ["Edit ", o("code", {
}), u("p", {
children: ["Edit ", u("code", {
children: "src/app.tsx"
}), " and save to test HMR"]
})]
}), o("p", {
}), u("p", {
class: "read-the-docs",
children: "Click on the Vite and Preact logos to learn more"
})]
});
}
preact.render(o(App, {}), (() => {
const app2 = document.createElement("div");
document.body.append(app2);
return app2;
preact.render(u(App, {}), (() => {
const app = document.createElement("div");
document.body.append(app);
return app;
})());

})(preact);
})(preact);
10 changes: 5 additions & 5 deletions packages/create-monkey/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"preview": "vite preview"
},
"dependencies": {
"preact": "10.16.0"
"preact": "10.19.3"
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"typescript": "^5.1.6",
"vite": "^4.4.8",
"vite-plugin-monkey": "^3.4.0"
"@preact/preset-vite": "^2.8.1",
"typescript": "^5.3.3",
"vite": "^5.0.11",
"vite-plugin-monkey": "^3.5.1"
}
}
Loading

0 comments on commit 88ddd19

Please sign in to comment.