Compare commits
10 Commits
8aca291c2f
...
15be1dd3e1
| Author | SHA1 | Date | |
|---|---|---|---|
| 15be1dd3e1 | |||
| 1709c3966f | |||
| 7035d80b33 | |||
| f4319a2884 | |||
| f6061596f4 | |||
| 95833a3779 | |||
| de4259d6e5 | |||
| ee9f084e48 | |||
| 0bb7215843 | |||
| b6872f03b8 |
7340
package-lock.json
generated
7340
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Instacode",
|
||||
"description": "Scratchpad for instant JavaScript code running",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.3",
|
||||
"author": "Grzegorz Kućmierz",
|
||||
"homepage": "https://github.com/gkucmierz/instacode-app",
|
||||
"scripts": {
|
||||
@@ -11,8 +11,10 @@
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/lang-javascript": "^6.1.1",
|
||||
"@analytics/google-analytics": "^1.0.7",
|
||||
"@codemirror/lang-javascript": "^6.1.6",
|
||||
"@codemirror/theme-one-dark": "^6.1.0",
|
||||
"analytics": "^0.8.14",
|
||||
"codemirror": "^6.0.1",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"eventemitter3": "^4.0.7",
|
||||
|
||||
10
src/App.vue
10
src/App.vue
@@ -3,6 +3,16 @@ import { defineComponent } from 'vue';
|
||||
import HelpModal from './components/HelpModal.vue';
|
||||
import ShareModal from './components/ShareModal.vue';
|
||||
|
||||
import Analytics from 'analytics';
|
||||
import googleAnalytics from '@analytics/google-analytics';
|
||||
|
||||
const analytics = Analytics({
|
||||
app: 'instacode-app',
|
||||
plugins: [googleAnalytics({ measurementIds: ['G-919025NJDJ'] })]
|
||||
});
|
||||
|
||||
analytics.page();
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
HelpModal,
|
||||
|
||||
@@ -13,7 +13,7 @@ export default defineComponent({
|
||||
Codemirror,
|
||||
},
|
||||
data() {
|
||||
const extensions = [javascript(), oneDark]
|
||||
const extensions = [javascript(), oneDark];
|
||||
|
||||
// Codemirror EditorView instance ref
|
||||
const view = shallowRef();
|
||||
|
||||
@@ -42,9 +42,12 @@ const throttledPM = (() => {
|
||||
}
|
||||
|
||||
if (lastUpdate + updateDelay <= now || finish) {
|
||||
pm(limitData(dataCache.join('\n')));
|
||||
lastUpdate = now;
|
||||
dataCache = [];
|
||||
const data = limitData(dataCache.join('\n'));
|
||||
if (data) {
|
||||
pm(data);
|
||||
lastUpdate = now;
|
||||
dataCache = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (tryAgain) {
|
||||
|
||||
@@ -3,8 +3,10 @@ import { parseScript } from 'meriyah';
|
||||
|
||||
export const addDefaultLog = code => {
|
||||
const lines = code.split('\n');
|
||||
const tree = parseScript(code, { loc: true });
|
||||
|
||||
const tree = parseScript(code, {
|
||||
loc: true,
|
||||
next: true,
|
||||
});
|
||||
const insert = ({ line, column }, str, trim = false) => {
|
||||
const l = lines[line-1];
|
||||
lines[line-1] = [
|
||||
@@ -16,6 +18,11 @@ export const addDefaultLog = code => {
|
||||
|
||||
const exprs = (tree.body
|
||||
.filter(node => node.type === 'ExpressionStatement')
|
||||
.filter(node => {
|
||||
if (node.expression.type !== 'Literal') return true;
|
||||
if (node.expression.value !== 'use strict') return true;
|
||||
return false;
|
||||
})
|
||||
.filter(node => {
|
||||
const expr = node.expression;
|
||||
if (expr.type !== 'CallExpression') return true;
|
||||
|
||||
Reference in New Issue
Block a user