mirror of https://github.com/django/django.git
Fixed #35553 -- Handled import*as in HashedFilesMixin.
This commit is contained in:
parent
fdc638bf4a
commit
6993c9d8c9
|
@ -53,7 +53,8 @@ class HashedFilesMixin:
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
r"""(?P<matched>import(?s:(?P<import>[\s\{].*?))"""
|
r"""(?P<matched>import"""
|
||||||
|
r"""(?s:(?P<import>[\s\{].*?|\*\s*as\s*\w+))"""
|
||||||
r"""\s*from\s*['"](?P<url>[./].*?)["']\s*;)"""
|
r"""\s*from\s*['"](?P<url>[./].*?)["']\s*;)"""
|
||||||
),
|
),
|
||||||
"""import%(import)s from "%(url)s";""",
|
"""import%(import)s from "%(url)s";""",
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
import rootConst from "/static/absolute_root.js";
|
import rootConst from "/static/absolute_root.js";
|
||||||
import testConst from "./module_test.js";
|
import testConst from "./module_test.js";
|
||||||
import * as NewModule from "./module_test.js";
|
import * as NewModule from "./module_test.js";
|
||||||
|
import*as m from "./module_test.js";
|
||||||
|
import *as m from "./module_test.js";
|
||||||
|
import* as m from "./module_test.js";
|
||||||
|
import* as m from "./module_test.js";
|
||||||
import { testConst as alias } from "./module_test.js";
|
import { testConst as alias } from "./module_test.js";
|
||||||
import { firstConst, secondConst } from "./module_test.js";
|
import { firstConst, secondConst } from "./module_test.js";
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -674,7 +674,7 @@ class TestCollectionJSModuleImportAggregationManifestStorage(CollectionTestCase)
|
||||||
|
|
||||||
def test_module_import(self):
|
def test_module_import(self):
|
||||||
relpath = self.hashed_file_path("cached/module.js")
|
relpath = self.hashed_file_path("cached/module.js")
|
||||||
self.assertEqual(relpath, "cached/module.55fd6938fbc5.js")
|
self.assertEqual(relpath, "cached/module.4326210cf0bd.js")
|
||||||
tests = [
|
tests = [
|
||||||
# Relative imports.
|
# Relative imports.
|
||||||
b'import testConst from "./module_test.477bbebe77f0.js";',
|
b'import testConst from "./module_test.477bbebe77f0.js";',
|
||||||
|
@ -686,6 +686,11 @@ class TestCollectionJSModuleImportAggregationManifestStorage(CollectionTestCase)
|
||||||
b'const dynamicModule = import("./module_test.477bbebe77f0.js");',
|
b'const dynamicModule = import("./module_test.477bbebe77f0.js");',
|
||||||
# Creating a module object.
|
# Creating a module object.
|
||||||
b'import * as NewModule from "./module_test.477bbebe77f0.js";',
|
b'import * as NewModule from "./module_test.477bbebe77f0.js";',
|
||||||
|
# Creating a minified module object.
|
||||||
|
b'import*as m from "./module_test.477bbebe77f0.js";',
|
||||||
|
b'import* as m from "./module_test.477bbebe77f0.js";',
|
||||||
|
b'import *as m from "./module_test.477bbebe77f0.js";',
|
||||||
|
b'import* as m from "./module_test.477bbebe77f0.js";',
|
||||||
# Aliases.
|
# Aliases.
|
||||||
b'import { testConst as alias } from "./module_test.477bbebe77f0.js";',
|
b'import { testConst as alias } from "./module_test.477bbebe77f0.js";',
|
||||||
b"import {\n"
|
b"import {\n"
|
||||||
|
@ -701,7 +706,7 @@ class TestCollectionJSModuleImportAggregationManifestStorage(CollectionTestCase)
|
||||||
|
|
||||||
def test_aggregating_modules(self):
|
def test_aggregating_modules(self):
|
||||||
relpath = self.hashed_file_path("cached/module.js")
|
relpath = self.hashed_file_path("cached/module.js")
|
||||||
self.assertEqual(relpath, "cached/module.55fd6938fbc5.js")
|
self.assertEqual(relpath, "cached/module.4326210cf0bd.js")
|
||||||
tests = [
|
tests = [
|
||||||
b'export * from "./module_test.477bbebe77f0.js";',
|
b'export * from "./module_test.477bbebe77f0.js";',
|
||||||
b'export { testConst } from "./module_test.477bbebe77f0.js";',
|
b'export { testConst } from "./module_test.477bbebe77f0.js";',
|
||||||
|
|
Loading…
Reference in New Issue