Skip to content

Commit 53cf544

Browse files
fix : bundled JS entry point error
1 parent c8425b0 commit 53cf544

11 files changed

+29
-27
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For ES5 users,
1717
<body>
1818
<script src="../dist/url-knife.bundle.js"></script>
1919
<--! OR !-->
20-
<script src="https://cdn.jsdelivr.net/gh/patternknife/url-knife@3.2.1/dist/url-knife.bundle.min.js"></script>
20+
<script src="https://cdn.jsdelivr.net/gh/patternknife/url-knife@4.0.1/dist/url-knife.bundle.min.js"></script>
2121

2222
<script type="text/javascript">
2323
</script>
@@ -29,7 +29,7 @@ For ES6 npm users, run 'npm install --save url-knife' on console.
2929
(**Requred Node v18.20.4**)
3030

3131
``` html
32-
import Pattern from 'url-knife';
32+
import {TextArea, UrlArea, XmlArea} from 'url-knife';
3333
```
3434

3535
## Syntax & Usage

dist/controller.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33
return (mod && mod.__esModule) ? mod : { "default": mod };
44
};
55
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.XmlArea = exports.UrlArea = exports.TextArea = void 0;
67
const service_1 = __importDefault(require("./service"));
78
const OptionalUrlPatternBuilder_1 = require("./pattern/OptionalUrlPatternBuilder");
89
const DomainPatterns_1 = require("./pattern/DomainPatterns");
@@ -109,6 +110,7 @@ const TextArea = {
109110
return obj_final;
110111
},
111112
};
113+
exports.TextArea = TextArea;
112114
const UrlArea = {
113115
/**
114116
* @brief
@@ -131,6 +133,7 @@ const UrlArea = {
131133
return service_1.default.Url.normalizeUrl(url);
132134
}
133135
};
136+
exports.UrlArea = UrlArea;
134137
const XmlArea = {
135138
/**
136139
*
@@ -405,8 +408,4 @@ const XmlArea = {
405408
return obj;
406409
}
407410
};
408-
exports.default = {
409-
TextArea,
410-
UrlArea,
411-
XmlArea
412-
};
411+
exports.XmlArea = XmlArea;

dist/entry.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
2-
var __importDefault = (this && this.__importDefault) || function (mod) {
3-
return (mod && mod.__esModule) ? mod : { "default": mod };
4-
};
52
Object.defineProperty(exports, "__esModule", { value: true });
6-
const controller_1 = __importDefault(require("./controller"));
7-
exports.default = controller_1.default;
3+
exports.XmlArea = exports.UrlArea = exports.TextArea = void 0;
4+
const controller_1 = require("./controller");
5+
Object.defineProperty(exports, "TextArea", { enumerable: true, get: function () { return controller_1.TextArea; } });
6+
Object.defineProperty(exports, "UrlArea", { enumerable: true, get: function () { return controller_1.UrlArea; } });
7+
Object.defineProperty(exports, "XmlArea", { enumerable: true, get: function () { return controller_1.XmlArea; } });

dist/url-knife.bundle.js

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "url-knife",
3-
"version": "4.0.0",
3+
"version": "4.0.1",
44
"description": "Extract and decompose (fuzzy) URLs (including emails, which are conceptually a part of URLs) in texts with robust patterns.",
55
"main": "src/entry.ts",
66
"scripts": {

public/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@
138138
<script type="text/javascript">
139139

140140

141-
// TextArea (URL) - All tags are just string
142141
const textStr = 'http://[::1]:8000에서 http ://www.example.com/wpstyle/?p=364 is ok \n' +
143142
'HTTP://foo.com/blah_blah_(wikipedia) https://www.google.com/maps/place/USA/@36.2218457,... tnae1ver.com:8000on the internet Asterisk\n ' +
144143
'the packed1book.net. 가나다@apacbook.ac.kr? [email protected]... fakeshouldnotbedetected.url?abc=fake s5houl7十七日dbedetected.jp?japan=go&html=<span>가나다@pacbook.travelersinsurance</span>; abc.com/ad/fg/?kk=5 [email protected]' +

src/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ const XmlArea = {
585585

586586
};
587587

588-
export default {
588+
export {
589589
TextArea,
590590
UrlArea,
591591
XmlArea

src/entry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
import Pattern from './controller';
2-
export default Pattern;
1+
import { TextArea, UrlArea, XmlArea } from './controller';
2+
export {
3+
TextArea, UrlArea, XmlArea
4+
};

test/test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Pattern from "../src/entry";
1+
import {TextArea, UrlArea} from "../src/entry";
2+
23
const assert = require('assert');
34
/*function test(title, testCode) {
45
try {
@@ -37,11 +38,11 @@ describe('BDD style', function() {
3738

3839
describe('UrlArea', function() {
3940
it('normalizeUrl', function() {
40-
expect(Pattern.UrlArea.normalizeUrl("htp/:/abcgermany.,def;:9094 #park//noon??abc=retry").normalizedUrl)
41+
expect(UrlArea.normalizeUrl("htp/:/abcgermany.,def;:9094 #park//noon??abc=retry").normalizedUrl)
4142
.toBe("http://abcgermany.de:9094#park/noon?abc=retry");
4243
});
4344
it('parseUrl', function() {
44-
expect(Pattern.UrlArea.parseUrl("xtp://gooppalgo.com/park/tree/?abc=1").onlyUriWithParams)
45+
expect(UrlArea.parseUrl("xtp://gooppalgo.com/park/tree/?abc=1").onlyUriWithParams)
4546
.toBe("/park/tree/?abc=1");
4647
});
4748
});
@@ -59,7 +60,7 @@ describe('BDD style', function() {
5960

6061

6162
it('extractAllUrls', function() {
62-
assert.deepEqual(Pattern.TextArea.extractAllUrls(textStr), [
63+
assert.deepEqual(TextArea.extractAllUrls(textStr), [
6364
{
6465
"value": {
6566
"url": "http://[::1]:8000",
@@ -324,7 +325,7 @@ describe('BDD style', function() {
324325
});
325326

326327
it('extractAllUrlsWithIntranets', function() {
327-
assert.deepEqual(Pattern.TextArea.extractAllUrls(textStr, {ip_v4 : false, ip_v6 :false, localhost : false, intranet : true}), [
328+
assert.deepEqual(TextArea.extractAllUrls(textStr, {ip_v4 : false, ip_v6 :false, localhost : false, intranet : true}), [
328329
{
329330
"value": {
330331
"url": "http://[::1]:8000",
@@ -648,7 +649,7 @@ describe('BDD style', function() {
648649
});
649650

650651
it('extractAllEmails', function() {
651-
assert.deepEqual(Pattern.TextArea.extractAllEmails(textStr, true), [
652+
assert.deepEqual(TextArea.extractAllEmails(textStr, true), [
652653
{
653654
"value": {
654655
"email": "가나다@apacbook.ac.kr",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"module": "CommonJS",
55
"esModuleInterop": true,
66
"outDir": "./dist",
7-
"rootDir": "./src",
7+
"rootDir": "./src"
88
},
99
"include": ["src/**/*"],
1010
"exclude": ["node_modules", "dist"]

webpack.config.babel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ module.exports = {
99
publicPath: '../dist/',
1010
filename: 'url-knife.bundle.js',
1111
chunkFilename: '[id].bundle.js',
12-
libraryTarget: 'var',
1312
library: 'Pattern',
13+
libraryTarget: 'umd',
14+
globalObject: 'this',
1415
},
1516
resolve: {
1617
extensions: ['.ts', '.js'],

0 commit comments

Comments
 (0)