Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vkontakte/create-vk-mini-app

Package Overview
Dependencies
Maintainers
3
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vkontakte/create-vk-mini-app - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

2

package.json
{
"name": "@vkontakte/create-vk-mini-app",
"version": "2.0.4",
"version": "2.0.5",
"description": "VK Mini Apps Boilerplate",

@@ -5,0 +5,0 @@ "repository": "https://github.com/VKCOM/create-vk-mini-app",

@@ -25,5 +25,7 @@ {

"devDependencies": {
"@vitejs/plugin-legacy": "^5.3.1",
"@vitejs/plugin-react": "^4.2.1",
"@vkontakte/vk-miniapps-deploy": "^0.1.6",
"eruda": "^3.0.1",
"esbuild": "~0.20.0",
"eslint": "^8.55.0",

@@ -33,5 +35,5 @@ "eslint-plugin-react": "^7.33.2",

"eslint-plugin-react-refresh": "^0.4.5",
"node-html-parser": "^6.1.12",
"terser": "^5.4.0",
"vite": "^5.0.8"
}
}
import { defineConfig, transformWithEsbuild } from 'vite';
import react from '@vitejs/plugin-react';
import { parse } from 'node-html-parser';
import legacy from '@vitejs/plugin-legacy';

@@ -31,76 +31,33 @@ function handleModuleDirectivesPlugin() {

function odrPlugin() {
return {
name: 'odr-plugin',
transformIndexHtml(html) {
const tags = ['audio', 'video', 'img', 'link', 'script'];
const dom = parse(html);
/**
* Some chunks may be large.
* This will not affect the loading speed of the site.
* We collect several versions of scripts that are applied depending on the browser version.
* This is done so that your code runs equally well on the site and in the odr.
* The details are here: https://dev.vk.com/mini-apps/development/on-demand-resources.
*/
export default defineConfig({
base: './',
const htmlElementHandlers = {
removeCrossorigin: (element) => {
element.removeAttribute('crossorigin');
},
plugins: [
react(),
threatJsFilesAsJsx(),
handleModuleDirectivesPlugin(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
changeSrc: (element) => {
let value = element.getAttribute('src');
if (String(value).startsWith('/')) {
value && element.setAttribute('src', '.' + value);
}
value = element.getAttribute('href');
if (String(value).startsWith('/')) {
value && element.setAttribute('href', '.' + value);
}
},
removeScriptType: (element) => {
element.removeAttribute('type');
},
changeScriptLoadToDefer: (element) => {
element.setAttribute('defer', 'defer');
},
};
tags.forEach((tag) => {
dom.getElementsByTagName(tag).forEach((element) => {
htmlElementHandlers.changeSrc(element);
htmlElementHandlers.removeCrossorigin(element);
if (element.tagName === 'script'.toUpperCase()) {
htmlElementHandlers.removeScriptType(element);
htmlElementHandlers.changeScriptLoadToDefer(element);
}
});
});
return dom.toString();
},
};
}
export default ({ mode }) => {
return defineConfig({
plugins: [
react(),
threatJsFilesAsJsx(),
handleModuleDirectivesPlugin(),
mode === 'production' && odrPlugin(),
],
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
build: {
outDir: 'build',
},
});
};
build: {
outDir: 'build',
},
});

@@ -24,5 +24,7 @@ {

"devDependencies": {
"@vitejs/plugin-legacy": "^5.3.1",
"@vitejs/plugin-react": "^4.2.1",
"@vkontakte/vk-miniapps-deploy": "^0.1.6",
"eruda": "^3.0.1",
"esbuild": "~0.20.0",
"eslint": "^8.55.0",

@@ -32,5 +34,5 @@ "eslint-plugin-react": "^7.33.2",

"eslint-plugin-react-refresh": "^0.4.5",
"node-html-parser": "^6.1.12",
"terser": "^5.4.0",
"vite": "^5.0.8"
}
}
import { defineConfig, transformWithEsbuild } from 'vite';
import react from '@vitejs/plugin-react';
import { parse } from 'node-html-parser';
import legacy from '@vitejs/plugin-legacy';

@@ -31,76 +31,33 @@ function handleModuleDirectivesPlugin() {

function odrPlugin() {
return {
name: 'odr-plugin',
transformIndexHtml(html) {
const tags = ['audio', 'video', 'img', 'link', 'script'];
const dom = parse(html);
/**
* Some chunks may be large.
* This will not affect the loading speed of the site.
* We collect several versions of scripts that are applied depending on the browser version.
* This is done so that your code runs equally well on the site and in the odr.
* The details are here: https://dev.vk.com/mini-apps/development/on-demand-resources.
*/
export default defineConfig({
base: './',
const htmlElementHandlers = {
removeCrossorigin: (element) => {
element.removeAttribute('crossorigin');
},
plugins: [
react(),
threatJsFilesAsJsx(),
handleModuleDirectivesPlugin(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
changeSrc: (element) => {
let value = element.getAttribute('src');
if (String(value).startsWith('/')) {
value && element.setAttribute('src', '.' + value);
}
value = element.getAttribute('href');
if (String(value).startsWith('/')) {
value && element.setAttribute('href', '.' + value);
}
},
removeScriptType: (element) => {
element.removeAttribute('type');
},
changeScriptLoadToDefer: (element) => {
element.setAttribute('defer', 'defer');
},
};
tags.forEach((tag) => {
dom.getElementsByTagName(tag).forEach((element) => {
htmlElementHandlers.changeSrc(element);
htmlElementHandlers.removeCrossorigin(element);
if (element.tagName === 'script'.toUpperCase()) {
htmlElementHandlers.removeScriptType(element);
htmlElementHandlers.changeScriptLoadToDefer(element);
}
});
});
return dom.toString();
},
};
}
export default ({ mode }) => {
return defineConfig({
plugins: [
react(),
threatJsFilesAsJsx(),
handleModuleDirectivesPlugin(),
mode === 'production' && odrPlugin(),
],
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
optimizeDeps: {
force: true,
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
build: {
outDir: 'build',
},
});
};
build: {
outDir: 'build',
},
});

@@ -28,9 +28,11 @@ {

"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-legacy": "^5.3.1",
"@vitejs/plugin-react": "^4.2.1",
"@vkontakte/vk-miniapps-deploy": "^0.1.6",
"eruda": "^3.0.1",
"esbuild": "~0.20.0",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"node-html-parser": "^6.1.12",
"terser": "^5.4.0",
"typescript": "^5.2.2",

@@ -37,0 +39,0 @@ "vite": "^5.0.8"

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { HTMLElement, parse } from 'node-html-parser';
import legacy from '@vitejs/plugin-legacy';

@@ -18,68 +18,22 @@ function handleModuleDirectivesPlugin() {

/**
* This plugin is required for a single product build for the odr archive and a build for the site.
* If you have a complex system and a custom script connection system, we recommend using 2 different configurations
* for odr and for the site.
*
* Details: https://dev.vk.com/ru/mini-apps/development/on-demand-resources
* Some chunks may be large.
* This will not affect the loading speed of the site.
* We collect several versions of scripts that are applied depending on the browser version.
* This is done so that your code runs equally well on the site and in the odr.
* The details are here: https://dev.vk.com/mini-apps/development/on-demand-resources.
*/
function odrPlugin() {
return {
name: 'odr-plugin',
transformIndexHtml(html) {
const tags = ['audio', 'video', 'img', 'link', 'script'];
const dom = parse(html);
export default defineConfig({
base: './',
const htmlElementHandlers: Record<string, (element: HTMLElement) => void> = {
removeCrossorigin: (element) => {
element.removeAttribute('crossorigin');
},
plugins: [
react(),
handleModuleDirectivesPlugin(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
changeSrc: (element) => {
let value = element.getAttribute('src');
if (String(value).startsWith('/')) {
value && element.setAttribute('src', '.' + value);
}
value = element.getAttribute('href');
if (String(value).startsWith('/')) {
value && element.setAttribute('href', '.' + value);
}
},
removeScriptType: (element) => {
element.removeAttribute('type');
},
changeScriptLoadToDefer: (element) => {
element.setAttribute('defer', 'defer');
},
};
tags.forEach((tag) => {
dom.getElementsByTagName(tag).forEach((element) => {
htmlElementHandlers.changeSrc(element);
htmlElementHandlers.removeCrossorigin(element);
if (element.tagName === 'script'.toUpperCase()) {
htmlElementHandlers.removeScriptType(element);
htmlElementHandlers.changeScriptLoadToDefer(element);
}
});
});
return dom.toString();
},
};
}
export default ({ mode }) => {
return defineConfig({
plugins: [react(), handleModuleDirectivesPlugin(), mode === 'production' && odrPlugin()],
build: {
outDir: 'build',
},
});
};
build: {
outDir: 'build',
},
});

@@ -27,9 +27,11 @@ {

"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-legacy": "^5.3.1",
"@vitejs/plugin-react": "^4.2.1",
"@vkontakte/vk-miniapps-deploy": "^0.1.6",
"eruda": "^3.0.1",
"esbuild": "~0.20.0",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"node-html-parser": "^6.1.12",
"terser": "^5.4.0",
"typescript": "^5.2.2",

@@ -36,0 +38,0 @@ "vite": "^5.0.8"

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { HTMLElement, parse } from 'node-html-parser';
import legacy from '@vitejs/plugin-legacy';

@@ -18,68 +18,22 @@ function handleModuleDirectivesPlugin() {

/**
* This plugin is required for a single product build for the odr archive and a build for the site.
* If you have a complex system and a custom script connection system, we recommend using 2 different configurations
* for odr and for the site.
*
* Details: https://dev.vk.com/ru/mini-apps/development/on-demand-resources
* Some chunks may be large.
* This will not affect the loading speed of the site.
* We collect several versions of scripts that are applied depending on the browser version.
* This is done so that your code runs equally well on the site and in the odr.
* The details are here: https://dev.vk.com/mini-apps/development/on-demand-resources.
*/
function odrPlugin() {
return {
name: 'odr-plugin',
transformIndexHtml(html) {
const tags = ['audio', 'video', 'img', 'link', 'script'];
const dom = parse(html);
export default defineConfig({
base: './',
const htmlElementHandlers: Record<string, (element: HTMLElement) => void> = {
removeCrossorigin: (element) => {
element.removeAttribute('crossorigin');
},
plugins: [
react(),
handleModuleDirectivesPlugin(),
legacy({
targets: ['defaults', 'not IE 11'],
}),
],
changeSrc: (element) => {
let value = element.getAttribute('src');
if (String(value).startsWith('/')) {
value && element.setAttribute('src', '.' + value);
}
value = element.getAttribute('href');
if (String(value).startsWith('/')) {
value && element.setAttribute('href', '.' + value);
}
},
removeScriptType: (element) => {
element.removeAttribute('type');
},
changeScriptLoadToDefer: (element) => {
element.setAttribute('defer', 'defer');
},
};
tags.forEach((tag) => {
dom.getElementsByTagName(tag).forEach((element) => {
htmlElementHandlers.changeSrc(element);
htmlElementHandlers.removeCrossorigin(element);
if (element.tagName === 'script'.toUpperCase()) {
htmlElementHandlers.removeScriptType(element);
htmlElementHandlers.changeScriptLoadToDefer(element);
}
});
});
return dom.toString();
},
};
}
export default ({ mode }) => {
return defineConfig({
plugins: [react(), handleModuleDirectivesPlugin(), mode === 'production' && odrPlugin()],
build: {
outDir: 'build',
},
});
};
build: {
outDir: 'build',
},
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc