Skip to content

Commit

Permalink
Webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuaz committed May 20, 2021
1 parent 71bb4e8 commit ac04774
Show file tree
Hide file tree
Showing 10 changed files with 548 additions and 1,304 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -9,8 +9,8 @@
"scripts": {
"build": "tsc && cp ./src/cjs.js ./lib",
"lint": "eslint",
"test:clean": "find -E test/**/build/ -regex '.*/*.(avif|jpg|jpeg|webp|png|js)' -delete",
"test": "npm run build && npm run test:clean && webpack --config=./test/jimp/webpack.config.js && webpack --config=./test/sharp/webpack.config.js && webpack --config=./test/cache/webpack.config.js && jest"
"test:clean": "find -E test/**/build/ -regex '.*/*.(avif|jpe?g|webp|png|js)' -delete",
"test": "npm run build && npm run test:clean && webpack --config=./test/jimp/webpack.config.js && webpack --config=./test/sharp/webpack.config.js && jest"
},
"files": [
"lib",
Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
@@ -1,5 +1,7 @@
import { validate } from 'schema-utils'
import * as schema from './schema.json'
import { validate } from 'schema-utils'
import { JSONSchema7 } from 'schema-utils/declarations/ValidationError'

import { parseOptions, getOutputAndPublicPath, createPlaceholder } from './utils'
import { cache } from './cache'
import type { LoaderContext } from 'webpack'
Expand All @@ -16,7 +18,6 @@ import type {
AdapterResizeResponse,
TransformParams,
} from './types'
import { JSONSchema7 } from 'schema-utils/declarations/ValidationError'

const DEFAULTS = {
quality: 85,
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Expand Up @@ -33,6 +33,8 @@ type ParsedOptions = {

function parseOptions(loaderContext: LoaderContext<any>, options: Options): ParsedOptions {
const outputContext: string = options.context || loaderContext.rootContext
// <path>/<to>/<folder>/responsive-loader

const outputPlaceholder = Boolean(options.placeholder)
const placeholderSize: number = parseInt(options.placeholderSize + '', 10)

Expand Down

0 comments on commit ac04774

Please sign in to comment.