Skip to content

Commit b436986

Browse files
committed
Add new build process
1 parent 8217015 commit b436986

File tree

7 files changed

+4245
-513
lines changed

7 files changed

+4245
-513
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ or
1414
yarn add @three11/extract-query-arg
1515
```
1616

17+
## Usage
18+
19+
```
20+
import extractQueryArg from '@three11/extract-query-arg';
21+
22+
// Get name parameter from current browser URL
23+
extractQueryArg('name');
24+
```
25+
1726
## License
1827

1928
GNU GENERAL PUBLIC LICENSE

dist/index.js

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,95 @@
1+
(function webpackUniversalModuleDefinition(root, factory) {
2+
if(typeof exports === 'object' && typeof module === 'object')
3+
module.exports = factory();
4+
else if(typeof define === 'function' && define.amd)
5+
define([], factory);
6+
else if(typeof exports === 'object')
7+
exports["extractQueryArg"] = factory();
8+
else
9+
root["extractQueryArg"] = factory();
10+
})(window, function() {
11+
return /******/ (function(modules) { // webpackBootstrap
12+
/******/ // The module cache
13+
/******/ var installedModules = {};
14+
/******/
15+
/******/ // The require function
16+
/******/ function __webpack_require__(moduleId) {
17+
/******/
18+
/******/ // Check if module is in cache
19+
/******/ if(installedModules[moduleId]) {
20+
/******/ return installedModules[moduleId].exports;
21+
/******/ }
22+
/******/ // Create a new module (and put it into the cache)
23+
/******/ var module = installedModules[moduleId] = {
24+
/******/ i: moduleId,
25+
/******/ l: false,
26+
/******/ exports: {}
27+
/******/ };
28+
/******/
29+
/******/ // Execute the module function
30+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31+
/******/
32+
/******/ // Flag the module as loaded
33+
/******/ module.l = true;
34+
/******/
35+
/******/ // Return the exports of the module
36+
/******/ return module.exports;
37+
/******/ }
38+
/******/
39+
/******/
40+
/******/ // expose the modules object (__webpack_modules__)
41+
/******/ __webpack_require__.m = modules;
42+
/******/
43+
/******/ // expose the module cache
44+
/******/ __webpack_require__.c = installedModules;
45+
/******/
46+
/******/ // define getter function for harmony exports
47+
/******/ __webpack_require__.d = function(exports, name, getter) {
48+
/******/ if(!__webpack_require__.o(exports, name)) {
49+
/******/ Object.defineProperty(exports, name, {
50+
/******/ configurable: false,
51+
/******/ enumerable: true,
52+
/******/ get: getter
53+
/******/ });
54+
/******/ }
55+
/******/ };
56+
/******/
57+
/******/ // define __esModule on exports
58+
/******/ __webpack_require__.r = function(exports) {
59+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
60+
/******/ };
61+
/******/
62+
/******/ // getDefaultExport function for compatibility with non-harmony modules
63+
/******/ __webpack_require__.n = function(module) {
64+
/******/ var getter = module && module.__esModule ?
65+
/******/ function getDefault() { return module['default']; } :
66+
/******/ function getModuleExports() { return module; };
67+
/******/ __webpack_require__.d(getter, 'a', getter);
68+
/******/ return getter;
69+
/******/ };
70+
/******/
71+
/******/ // Object.prototype.hasOwnProperty.call
72+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
73+
/******/
74+
/******/ // __webpack_public_path__
75+
/******/ __webpack_require__.p = "";
76+
/******/
77+
/******/
78+
/******/ // Load entry module and return exports
79+
/******/ return __webpack_require__(__webpack_require__.s = 0);
80+
/******/ })
81+
/************************************************************************/
82+
/******/ ([
83+
/* 0 */
84+
/***/ (function(module, exports, __webpack_require__) {
85+
186
"use strict";
287

88+
389
Object.defineProperty(exports, "__esModule", {
490
value: true
591
});
6-
exports.extractQueryArg = void 0;
92+
exports.default = void 0;
793

894
var extractQueryArg = function extractQueryArg(queryArg) {
995
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.href;
@@ -21,4 +107,9 @@ var extractQueryArg = function extractQueryArg(queryArg) {
21107
return decodeURIComponent(matches[2].replace(/\+/g, ' '));
22108
};
23109

24-
exports.extractQueryArg = extractQueryArg;
110+
var _default = extractQueryArg;
111+
exports.default = _default;
112+
113+
/***/ })
114+
/******/ ])["default"];
115+
});

dist/index.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
{
22
"name": "@three11/extract-query-arg",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Extract query argument from url",
55
"main": "dist/index.js",
66
"scripts": {
7-
"build": "babel src -d dist"
7+
"build": "webpack"
88
},
99
"repository": {
1010
"type": "git",
1111
"url": "git+https://github.com/three11/extract-query-arg.git"
1212
},
13-
"keywords": [
14-
"extract",
15-
"query",
16-
"argument",
17-
"GET"
18-
],
13+
"keywords": ["extract", "query", "argument", "GET"],
1914
"authors": [
2015
{
2116
"name": "Three 11 Ltd",
@@ -39,9 +34,13 @@
3934
},
4035
"homepage": "https://github.com/three11/extract-query-arg#readme",
4136
"devDependencies": {
42-
"@babel/cli": "^7.0.0-beta.42",
43-
"@babel/core": "^7.0.0-beta.42",
44-
"@babel/preset-env": "^7.0.0-beta.42",
45-
"@babel/preset-stage-2": "^7.0.0-beta.42"
37+
"@babel/cli": "^7.0.0-beta.44",
38+
"@babel/core": "^7.0.0-beta.44",
39+
"@babel/preset-env": "^7.0.0-beta.44",
40+
"@babel/preset-stage-2": "^7.0.0-beta.44",
41+
"babel-loader": "^8.0.0-beta",
42+
"unminified-webpack-plugin": "^2.0.0",
43+
"webpack": "^4.5.0",
44+
"webpack-cli": "^2.0.14"
4645
}
4746
}

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const extractQueryArg = (queryArg, url = window.location.href) => {
1+
const extractQueryArg = (queryArg, url = window.location.href) => {
22
queryArg = queryArg.replace(/[\[\]]/g, '\\$&');
33

44
const matches = new RegExp(`[?&]${queryArg}(=([^&#]*)|&|#|$)`).exec(url);
@@ -13,3 +13,5 @@ export const extractQueryArg = (queryArg, url = window.location.href) => {
1313

1414
return decodeURIComponent(matches[2].replace(/\+/g, ' '));
1515
};
16+
17+
export default extractQueryArg;

webpack.config.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
2+
3+
module.exports = {
4+
mode: 'production',
5+
entry: './src/index.js',
6+
output: {
7+
filename: 'index.min.js',
8+
library: 'extractQueryArg',
9+
libraryTarget: 'umd',
10+
libraryExport: 'default'
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.(js)$/,
16+
loader: 'babel-loader'
17+
}
18+
]
19+
},
20+
plugins: [new UnminifiedWebpackPlugin()]
21+
};

0 commit comments

Comments
 (0)