New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-import-static-files

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-import-static-files - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

assets/icon-8e5397281d54f75de5cb6f77d1f4bcc8.svg

4

lib/transform.js

@@ -26,5 +26,5 @@ 'use strict';

function getFile(state, absPath, opts) {
var root = state.file.opts.sourceRoot || process.cwd();
var root = process.env.APP_ROOT ? _path2.default.resolve(process.env.APP_ROOT) : state.file.opts.sourceRoot || process.cwd();
var file = absPath.replace(root, '');
console.log(process.env.APP_ROOT, process.cwd(), root, file, _path2.default.join(root, file), _path2.default.join(opts.baseDir, file));
if (opts.baseDir) {

@@ -31,0 +31,0 @@ file = _path2.default.join(opts.baseDir, file);

{
"name": "babel-plugin-import-static-files",
"version": "1.0.1",
"version": "1.0.2",
"description": "Transforms static files import and copy files to /static folder for next.js applications.",

@@ -14,3 +14,4 @@ "main": "lib/index.js",

"test:run": "nyc --reporter=text-summary mocha 'test/**/*.spec.js'",
"test:watch": "npm run test -- -- --watch"
"test:watch": "npm run test -- -- --watch",
"build:watch": "npm run build -- --watch"
},

@@ -17,0 +18,0 @@ "repository": {

@@ -7,3 +7,2 @@ # babel-plugin-import-static-files

[![npm][npm-badge]][npm-link]
[![Build Status][circle-badge]][circle-link]

@@ -14,5 +13,6 @@ ## Table of Contents

- [Installation](#installation)
- [Options](#options)
- [Usage](#usage)
- [via babelrc](#via-babelrc)
- [via Node API](#via-node-api)
- [via JavaScript](#via-javascript)

@@ -29,3 +29,3 @@ ## About

// icon.png and icon.svg will be copied to project's root under static folder
// icon.png and icon.svg will be copied to project's root under baseDir (defaults to "/static") folder
// and code will be transformed to:

@@ -53,2 +53,29 @@

## Options
Default options:
```json
{
"baseDir": "/static",
"hash": false,
"extensions": [
".gif",
".jpeg",
".jpg",
".png",
".svg"
]
}
```
When hash is true (useful for assets caching):
```js
import image from './path/to/icon.png';
// icon.png will be copied to project's root under baseDir (defaults to "/static") folder
// and code will be transformed to:
const image = '/static/icon-[hash].png';
```
## Usage

@@ -77,3 +104,3 @@

### via Node API
### via JavaScript

@@ -104,6 +131,3 @@ ```js

[circle-badge]: https://img.shields.io/circleci/project/github/ahalimkara/babel-plugin-import-static-files/master.svg?style=flat-square
[circle-link]: https://circleci.com/gh/ahalimkara/babel-plugin-import-static-files
[npm-badge]: https://img.shields.io/npm/v/babel-plugin-import-static-files.svg?style=flat-square
[npm-link]: https://www.npmjs.com/package/babel-plugin-import-static-files
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