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

@mappable-world/mappable-cli

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mappable-world/mappable-cli - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

2

package.json
{
"name": "@mappable-world/mappable-cli",
"version": "0.0.24",
"version": "0.0.25",
"description": "Library for encapsulating the logic of autotests and building packages mappable.world js API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -30,2 +30,19 @@ # Contributing

## Development loader
For development, you shold load from `dist`:
```js
mappable.import.loaders.unshift(async (pkg) => {
if (!pkg.startsWith('%PACKAGE_NAME%')) return;
// Load script from dev server
await mappable.import.script(`./dist/index.js`);
return window['%PACKAGE_NAME%'];
});
```
## GitHub actions

@@ -32,0 +49,0 @@

@@ -19,3 +19,3 @@ # %PACKAGE_NAME% package

Recommended use `MMapEntityTileLoader` as usual npm package:
Recommended use `MMapButtonExample` as usual npm package:

@@ -29,40 +29,38 @@ ```sh

```js
const {MMapEntityTileLoader} = await import('%PACKAGE_NAME%/dist/esm/index');
await mappable.ready;
// ...
const {MMapButtonExample} = await import('%PACKAGE_NAME%');
// ...
map.addChild(new MMapButtonExample(props));
```
But you can use CDN with module loading handler in JS API:
### Usage without npm
### Development
You can use CDN with module loading handler in JS API on your page.
Just use `mappable.import`:
```js
mappable.import.loaders.unshift(async (pkg) => {
if (!pkg.startsWith('%PACKAGE_NAME%')) {
return;
}
await mappable.import.script(`./node_modules/%PACKAGE_NAME%/dist/index.js`);
return window['%PACKAGE_NAME%'];
});
const pkg = await mappable.import('%PACKAGE_NAME%')
```
### Production
By default `mappable.import` can load self modules.
If you want also load your package, should add `loader`:
```js
// Add loader at start loaders array
mappable.import.loaders.unshift(async (pkg) => {
if (!pkg.includes('%PACKAGE_NAME%')) {
return;
}
// Process only your package
if (!pkg.includes('%PACKAGE_NAME%')) return;
// You can use another CDN
await mappable.import.script(`https://unpkg.com/${pkg}/dist/index.js`);
// Load script directly. You can use another CDN
await mappable.import.script(`https://unpkg.com/${pkg}/dist/index.js`);
return window[`${pkg}`];
// Return result object
return window['%PACKAGE_NAME%'];
});
```
and in your final code just use `mappable.import`
```js
const pkg = await mappable.import('%PACKAGE_NAME%')
```
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